Kaynağa Gözat

吉香居代码更新

master
pengliangyang 2 yıl önce
ebeveyn
işleme
799a5e0dc9
47 değiştirilmiş dosya ile 1659 ekleme ve 857 silme
  1. +0
    -1
      BPASmartClient.JXJFoodBigStation/App.xaml.cs
  2. +2
    -2
      BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
  3. +33
    -39
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
  4. +0
    -90
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs
  5. +1
    -1
      BPASmartClient.JXJFoodBigStation/Model/LocalRecipeDataColl.cs
  6. +47
    -85
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  7. +0
    -92
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/DeviceAddress.cs
  8. +2
    -2
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/LocalRecipe.cs
  9. +3
    -3
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterial.cs
  10. +0
    -44
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialDeviceStatus.cs
  11. +0
    -48
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialModel.cs
  12. +2
    -2
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
  13. +0
    -45
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeModel.cs
  14. +1
    -1
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs
  15. +14
    -0
      BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipe.cs
  16. +9
    -8
      BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
  17. +16
    -16
      BPASmartClient.JXJFoodBigStation/Model/TestData.cs
  18. +40
    -10
      BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
  19. +1
    -1
      BPASmartClient.JXJFoodBigStation/ViewModel/ChangeDeviceNameViewModel.cs
  20. +51
    -6
      BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs
  21. +15
    -16
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
  22. +9
    -9
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
  23. +4
    -5
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs
  24. +8
    -1
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  25. +9
    -1
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  26. +13
    -0
      BPASmartClient.JXJFoodSmallStation/Model/GVL/GVL.cs
  27. +117
    -0
      BPASmartClient.JXJFoodSmallStation/Model/GVL/ReadSmallMaterial.cs
  28. +185
    -0
      BPASmartClient.JXJFoodSmallStation/Model/GVL/WriteSmallMaterial.cs
  29. +10
    -11
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  30. +2
    -2
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/LocalRecipeDataColl.cs
  31. +4
    -4
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs
  32. +6
    -6
      BPASmartClient.JXJFoodSmallStation/Model/TestData.cs
  33. +235
    -0
      BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml
  34. +3
    -2
      BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml.cs
  35. +0
    -236
      BPASmartClient.JXJFoodSmallStation/View/NewRemoteRecipeView.xaml
  36. +35
    -33
      BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml
  37. +1
    -0
      BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml.cs
  38. +26
    -8
      BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml
  39. +150
    -0
      BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml
  40. +29
    -0
      BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml.cs
  41. +370
    -0
      BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml
  42. +28
    -0
      BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml.cs
  43. +33
    -4
      BPASmartClient.JXJFoodSmallStation/ViewModel/NewLocalRecipeViewModel.cs
  44. +0
    -3
      BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeInfosViewModel.cs
  45. +23
    -20
      BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs
  46. +53
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/SiemensRecipeReceiveViewModel.cs
  47. +69
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/WindSendParViewModel.cs

+ 0
- 1
BPASmartClient.JXJFoodBigStation/App.xaml.cs Dosyayı Görüntüle

@@ -128,7 +128,6 @@ namespace BPASmartClient.JXJFoodBigStation
AssemblyName = "BPASmartClient.JXJFoodBigStation",
ToggleWindowPath = "View.HardwareStatusView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "",


+ 2
- 2
BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs Dosyayı Görüntüle

@@ -33,9 +33,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public int AgvPickUpPosition { get; set; }

/// <summary>
/// 配方配料的状态 0:无意义 ,1:plc允许下发配方 2:上位机下发配方 3:plc接收到配方(配料中) 4:配料完成
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public int RecipeDosingStatus { get; set; }
public int RecipeDosingStatus { get; set; }
/// <summary>
/// 是否处于手动下发配方
/// </summary>


+ 33
- 39
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs Dosyayı Görüntüle

@@ -24,50 +24,44 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
}
}
/// <summary>
/// 单个配料机配料完成
/// </summary>
/// <param name="value"></param>
public void SingleDosing(uint value)
{
if (IsConnected)
{
HK_PLC_S7.Write(HKPlcCommAddress.SingleStockBinLocationToPLC, value);
HK_PLC_S7.Write(HKPlcCommAddress.SingleDosingFinishToPLC, (ushort)1);
}
}
/// <summary>
/// 复位plc允许接料信号
/// </summary>
public void AllowDosingSignReset()
{
HK_PLC_S7.Write(HKPlcCommAddress.IsAllowDosing,(ushort)0);
}
/// <summary>
/// 复位plc到达某料仓信号
/// </summary>
public void StockStateSignReset()
{
HK_PLC_S7.Write(HKPlcCommAddress.StockState, (ushort)0);
}
/// <summary>
/// 复位一个配方配料完成信号
/// </summary>
public void RecipeDosingFinishReset()
{
HK_PLC_S7.Write(HKPlcCommAddress.RecipeDosingFinish, (ushort)0);
}
/// <summary>
/// 下发配方数据
/// </summary>
/// <param name="BarrelNum">单个桶的编号</param>
/// <param name="StockBinLocation">单个桶对应的料仓位置</param>
public void StockBinPar(short[] Num, short[] Location,short[] Weight)
public void StockBinPar(RecipeData recipe)
{
if (IsConnected)
{
HK_PLC_S7.Write<short[]>(HKPlcCommAddress.BarrelNumToPLC, Num);
HK_PLC_S7.Write<short[]>(HKPlcCommAddress.StockBinLocationToPLC, Location);
HK_PLC_S7.Write<short[]>(HKPlcCommAddress.WeightToPLC, Weight);
if (recipe != null)
{
for (int barrel = 1; barrel < 6; barrel++)
{
for (int loc = 1; loc < 13; loc++)
{
int index = Array.FindIndex(recipe.RawMaterial.ToArray(), p => p.RawMaterialBarrelNum == barrel && p.RawMaterialLocation == loc);
if (barrel >= 3)//PLC没有3号桶的重量位置,故4,5号桶地址向前偏移48个位置
{
if (index != -1)
{
HK_PLC_S7.Write<float>("MD" + 4120 + (loc - 1) * 4 + (barrel - 1 - 1) * 48, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
}
else//不存在的原料信息,重量写0
{
HK_PLC_S7.Write<float>("MD" + 4120 + (loc - 1) * 4 + (barrel - 1 - 1) * 48, 0);
}
}
else
{
if (index != -1)
{
HK_PLC_S7.Write<float>("MD" + 4120 + (loc - 1) * 4 + (barrel - 1) * 48, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
}
else//不存在的原料信息,重量写0
{
HK_PLC_S7.Write<float>("MD" + 4120 + (loc - 1) * 4 + (barrel - 1) * 48, 0);
}
}
}
}
}
}
}
}


+ 0
- 90
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs Dosyayı Görüntüle

@@ -8,96 +8,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
public class HKPlcCommAddress
{
#region 海科PLC ==> 上位机
public static string HeartHealth { get; set; } = "M5000.0";
/// <summary>
/// 是否允许配料
/// </summary>
public static string IsAllowDosing { get; set; } = "";
/// <summary>
///
/// </summary>
public static string StockBinLocation { get; set; } = "";
/// <summary>
/// 当前料仓的状态(0:无意义,1:到达接料位置)
/// </summary>
public static string StockState { get; set; } = "";
#endregion

#region 上位机 ==> 海科PLC
/// <summary>
/// 料仓位置(配置该配方,所需要多个原料桶,每个原料桶有多个料仓位置)
/// </summary>
public static string StockBinLocationToPLC { get; set; } = "";
/// <summary>
/// 对应桶号
/// </summary>
public static string BarrelNumToPLC { get; set; } = "";
/// <summary>
/// 对应桶号
/// </summary>
public static string WeightToPLC { get; set; } = "";
/// <summary>
/// 当前配料机配料完成
/// </summary>
public static string SingleDosingFinishToPLC { get; set; } = "";
/// <summary>
/// 当前配料料仓的位置
/// </summary>
public static string SingleStockBinLocationToPLC { get; set; } = "";
/// <summary>
/// 配方配料完成
/// </summary>
public static string RecipeDosingFinish { get; set; } = "";
#endregion

#region AGV进出站
/// <summary>
/// Agv送货 进站申请
/// </summary>
public static string DeliveryAGVApply { get; set; } = "M4002";
/// <summary>
/// Agv送货 进站申请
/// </summary>
public static string DeliveryAGVIsApply { get; set; } = "M5002";
/// <summary>
/// Agv送货 进站顶升申请
/// </summary>
public static string DeliveryAGVApplyJack { get; set; } = "M4004";
/// <summary>
/// Agv送货 进站顶升申请
/// </summary>
public static string DeliveryAGVIsApplyJack { get; set; } = "M5004";
/// <summary>
/// Agv送货 送货完成
/// </summary>
public static string DeliveryAGVFinsih { get; set; } = "M4005";
/// <summary>
/// Agv送货 工位上有货架
/// </summary>
public static string StationHaveCargo { get; set; } = "M5005";
/// <summary>
/// Agv送货 进站申请
/// </summary>
public static string PickAGVApply { get; set; } = "M4003";
/// <summary>
/// Agv送货 进站申请
/// </summary>
public static string PickAGVIsApply { get; set; } = "M5003";
/// <summary>
/// Agv送货 取货架完成
/// </summary>
public static string PickCargoAGVFinish { get; set; } = "M4006";
/// <summary>
/// Agv送货 取料完成
/// </summary>
public static string PickAGVFinish { get; set; } = "M5006";
/// <summary>
/// 工位上是否有小车
/// </summary>
public static string StationIsExistTray { get; set; } = "M4007";
#endregion

public static string StationIsExistCar { get; set; }
}
}

+ 1
- 1
BPASmartClient.JXJFoodBigStation/Model/LocalRecipeDataColl.cs Dosyayı Görüntüle

@@ -9,6 +9,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
public class LocalRecipeDataColl
{
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>();
public ObservableCollection<RecipeData> Recipes { get; set; } = new ObservableCollection<RecipeData>();
}
}

+ 47
- 85
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs Dosyayı Görüntüle

@@ -21,7 +21,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl());
private ProcessControl() { }

public ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
public HKDeviceStatus HKDevice = new HKDeviceStatus();
GVL_BigStation BigStation = new GVL_BigStation();
@@ -29,11 +29,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// <summary>
/// 配方数据
/// </summary>
public ObservableCollection<RemoteRecipeData> RemoteRecipes = new ObservableCollection<RemoteRecipeData>();
public ObservableCollection<RecipeData> RemoteRecipes = new ObservableCollection<RecipeData>();
/// <summary>
/// 配方数据
/// </summary>
public ObservableCollection<RemoteRecipeData> IssuedComplete = new ObservableCollection<RemoteRecipeData>();
public ObservableCollection<RecipeData> IssuedComplete = new ObservableCollection<RecipeData>();
/// <summary>
/// 原料的名称和料仓的位置对应
/// </summary>
@@ -52,74 +52,41 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public RecipeRawMaterial RawMaterial;
public void Init()
{
ActionManage.GetInstance.Register(new Action<DL_Start_DB>((res) =>
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
ObservableCollection<RawMaterial> RawMaterials = new ObservableCollection<RawMaterial>();
if (SiemensDevice.IsConnected)
{
if (res != null)
if (res != null && res is DL_Start_DB recipe)
{
RawMaterials.Clear();
for (int i = 0; i < 15; i++)
{
if (RawMaterialsNamePos.ContainsKey(res.RecipeName))
if (RawMaterialsNamePos.ContainsKey(recipe.RecipeName))
{
RawMaterials.Add(new RemoteRecipeRawMaterial()
RawMaterials.Add(new RawMaterial()
{
RawMaterialName = res.Material[i].Material_Name,
RawMaterialBarrelNum = res.Material[i].Material_BarrelNum,
RawMaterialWeight = res.Material[i].Material_Weight,
RawMaterialLocation = (int)RawMaterialsNamePos[res.Material[i].Material_Name]
});
RawMaterialName = recipe.Material[i].Material_Name,
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
RawMaterialWeight = recipe.Material[i].Material_Weight,
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name]
});
}
else
{
//报警,配方的原料名称下发和设备不一致
}
}
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
Json<RemoteRecipe>.Data.Recipes.Add(new RecipeData()
{
RecipeName = res.RecipeName,
RecipeCode = res.RecipeCode,
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = res.TrayCode
TrayCode = recipe.TrayCode
});
}
}
}), "西门子下发配方", true);
ActionManage.GetInstance.Register(new Action<RecipeModel>((res) =>
{
if (SiemensDevice.IsConnected)
{
if (res != null)
{
RawMaterials.Clear();
for (int i = 0; i < 15; i++)
{
if (RawMaterialsNamePos.ContainsKey(res.Material[i].Material_Name))
{
RawMaterials.Add(new RemoteRecipeRawMaterial()
{
RawMaterialName = res.Material[i].Material_Name,
RawMaterialBarrelNum = res.Material[i].Material_BarrelNum,
RawMaterialWeight = res.Material[i].Material_Weight,
RawMaterialLocation = (int)RawMaterialsNamePos[res.Material[i].Material_Name]
});
}
else
{
//报警,配方的原料名称下发和设备不一致
}
}
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
{
RecipeName = res.RecipeName,
RecipeCode = res.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = res.TrayCode
});
}
}
}), "西门子下发配方", true);
}), "SiemensSendRecipe", true);
string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"];
string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"];
try
@@ -143,6 +110,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据
ThreadManage.GetInstance().StartLong(new Action(() =>
{
ReadPLCDeviceInfo();
ReceviceData();
RecipeInfoToHKPLC();
Thread.Sleep(10);
@@ -240,8 +208,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
private void AgvGetInOut()
{
//获取工位上是否有小车
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.StationIsExistCar, (bool)
HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.StationIsExistTray));
SiemensDevice.Siemens_PLC_S7.Write<bool>(SiemensCommAddress.StationIsExistCar, (bool)
HKDevice.HK_PLC_S7.Read<bool>("M4007.0"));
//检测AGV到站信号
if (AGVToWorkStationQueue.Count > 0)
{
@@ -254,7 +222,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (BigStation.AgvDeliveryPosition == 5)
{
BigStation.AgvDeliveryPosition = 0;
//AGVToWorkStationQueue.TryDequeue(out RecipeCode);
}
AGV_Pick(TrayLocation - 1);
if (BigStation.AgvPickUpPosition == 3)
@@ -269,7 +236,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
if (!BigStation.IsAllowManual && RemoteRecipes.Count == 0)//一个配方执行完成后,再获取配方数据
{
RemoteRecipes = Json<RemoteRecipeDataColl>.Data.Recipes;
RemoteRecipes = Json<RemoteRecipe>.Data.Recipes;
}
else if (BigStation.IsAllowManual && RemoteRecipes.Count == 0)
{
@@ -283,41 +250,36 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RecipeQueue.Enqueue(data.RecipeCode);
}
}
else
{
RecipeQueue.Clear();
BigStation.RecipeDosingStatus = 0;
}
}
short[] BarrelNum = new short[15];
short[] Location = new short[15];
short[] Weight = new short[15];
private void RecipeInfoToHKPLC()
{
if (RecipeQueue.Count > 0)
{
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue.ElementAt(0));
if (index >= 0 && index <= RemoteRecipes.Count)
if (index >= 0 && index < RemoteRecipes.Count)
{
string code = RemoteRecipes.ElementAt(index).RecipeCode;
if (HKDevice.HK_PLC_S7.Read<bool>("M5001.0") && BigStation.RecipeDosingStatus == 0)//配方1是否允许下发配发
int trayCode = RemoteRecipes.ElementAt(index).TrayCode;
if (RTrig.GetInstance("M5001.0").Start(HKDevice.HK_PLC_S7.Read<bool>("M5001.0")) && BigStation.RecipeDosingStatus == 0)//配方1是否允许下发配发
{
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}允许下发");
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write<bool>("M4001.0", true);//配发下发完成,to plc
HKDevice.HK_PLC_S7.Write<bool>("M5001.0", false);//复位允许下发配方1信号
BigStation.RecipeDosingStatus = 1;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
BarrelNum[i] = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
Location[i] = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialLocation;
Weight[i] = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialWeight;
}
HKDevice.StockBinPar(BarrelNum, Location, Weight);
HKDevice.HK_PLC_S7.Write("M4001.0", 1);//配发下发完成,to plc
HKDevice.HK_PLC_S7.Write("M5001.0", 0);//复位允许下发配方1信号
BigStation.RecipeDosingStatus = 2;
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
if (HKDevice.HK_PLC_S7.Read<bool>("M5001.4") && BigStation.RecipeDosingStatus == 2)
if (HKDevice.HK_PLC_S7.Read<bool>("M5001.4") && BigStation.RecipeDosingStatus == 1)
{
BigStation.RecipeDosingStatus = 3;
HKDevice.HK_PLC_S7.Write("M5001.4", 0);//复位允许下发配方1信号
BigStation.RecipeDosingStatus = 2;
HKDevice.HK_PLC_S7.Write<bool>("M5001.4", false);//
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
}
if (BigStation.RecipeDosingStatus == 3)
if (BigStation.RecipeDosingStatus == 2)
{
for (int i = 0; i < 12; i++)
{
@@ -325,12 +287,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
if (HKDevice.HK_PLC_S7.Read<bool>("M5008." + (i)))//根据配料完成信号,
{
int a = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
int a = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == (i+1));
if (a >= 0)
{
int barrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).RawMaterialBarrelNum;
string address = "MD" + 5060 + i * 4 + (barrelNum - 1) * 48;
float weight = HKDevice.HK_PLC_S7.Read<float>(address);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).Laying_Off_Weight = HKDevice.HK_PLC_S7.Read<float>(address);//料仓配料完成后的出料重量
}
}
}
@@ -343,21 +305,21 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
int barrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).RawMaterialBarrelNum;
string address = "MD" + 5060 + i * 4 + (barrelNum - 1) * 48;
float weight = HKDevice.HK_PLC_S7.Read<float>(address);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).Laying_Off_Weight = HKDevice.HK_PLC_S7.Read<float>(address);
}
}
}
}
if (RTrig.GetInstance("StockState").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.RecipeDosingFinish)) || true)
if (RTrig.GetInstance("StockState").Start(HKDevice.HK_PLC_S7.Read<bool>("M5007.0")))
{
BigStation.RecipeDosingStatus = 4;
BigStation.RecipeDosingStatus = 3;
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
HKDevice.RecipeDosingFinishReset();
HKDevice.HK_PLC_S7.Write<bool>("M5007.0",false);
RecipeQueue.TryDequeue(out code);
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
if (!BigStation.IsAllowManual)
{
Json<RemoteRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
}
else
{
@@ -390,7 +352,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
if (HKDevice.IsConnected)
{
GetSiemensStatus("", new Action<object>((obj) =>
GetHKStatus("", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0)
{
@@ -424,12 +386,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
if (SiemensDevice.IsConnected)
{
SiemensDevice.Siemens_PLC_S7.Write(Address, Value);
SiemensDevice.Siemens_PLC_S7.Write<object>(Address, Value);
}
}
private void WriteHKPLC(string Address, object Value)
{
HKDevice.HK_PLC_S7.Write(Address, Value);
HKDevice.HK_PLC_S7.Write<object>(Address, Value);
}
private object ReadSiemens(string Address)
{


+ 0
- 92
BPASmartClient.JXJFoodBigStation/Model/RawMaterial/DeviceAddress.cs Dosyayı Görüntüle

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

namespace BPASmartClient.JXJFoodBigStation.Model
{
public class DeviceAddress
{
#region 源地址
///// <summary>
///// 设备名称起始地址
///// </summary>
//public static string DeviceName { get; set; } = "LW0";

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

///// <summary>
///// 重量设置地址
///// </summary>
//public static string WeightSet { get; set; } = "LW21";//LW200

///// <summary>
///// 启动信号地址
///// </summary>
//public static string Start { get; set; } = "LW20";//LW210

///// <summary>
///// 下料重量反馈地址
///// </summary>
//public static string CutWeightFeedback { get; set; } = "LW54";//LW202

///// <summary>
///// 设备运行状态地址
///// </summary>
//public static string RunStatus { get; set; } = "LW55";//LW206

///// <summary>
///// 料仓的位置
///// </summary>
//public static string Location { get; set; } = "LW53";
#endregion
#region 上位机下发
/// <summary>
/// 原料出料重量
/// </summary>
public static string WeightSet { get; set; } = "LW11";
/// <summary>
/// 启动开始配料
/// </summary>
public static string Start { get; set; } = "LW12";
#endregion
#region 上位机读取
/// <summary>
/// 设备运行状态地址
/// </summary>
public static string RunStatus { get; set; } = "LW50";
/// <summary>
/// 报警字
/// </summary>
public static string AlarmInfo { get; set; } = "LW51";
/// <summary>
/// 原料名称
/// </summary>
public static string DeviceName { get; set; } = "LW52";
/// <summary>
/// 料仓的位置
/// </summary>
public static string Location { get; set; } = "LW53";
/// <summary>
/// 原料类型
/// </summary>
public static string RawMaterialType { get; set; } = "LW54";
/// <summary>
/// 出料完成信号
/// </summary>
public static string OutRawMaterialFinish { get; set; } = "LW55";
/// <summary>
/// 料仓重量反馈起始地址
/// </summary>
public static string WeightFeedback { get; set; } = "LW56";
/// <summary>
/// 下料重量反馈地址
/// </summary>
public static string CutWeightFeedback { get; set; } = "LW57";
#endregion
}
}

BPASmartClient.JXJFoodBigStation/Model/RawMaterial/LocaPar.cs → BPASmartClient.JXJFoodBigStation/Model/RawMaterial/LocalRecipe.cs Dosyayı Görüntüle

@@ -8,8 +8,8 @@ using BPASmartClient.JXJFoodBigStation.ViewModel;

namespace BPASmartClient.JXJFoodBigStation.Model
{
public class LocaPar
public class LocalRecipe
{
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>();
public ObservableCollection<RecipeData> Recipes { get; set; } = new ObservableCollection<RecipeData>();
}
}

BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeRawMaterial.cs → BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterial.cs Dosyayı Görüntüle

@@ -7,7 +7,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model
{
public class RemoteRecipeRawMaterial :ObservableObject
public class RawMaterial :ObservableObject
{
private int _mIp;
public int DeviceIp { get { return _mIp; } set { _mIp = value; }}
@@ -27,8 +27,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// <summary>
/// 需要原料重量
/// </summary>
public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
private double _mRawMaterialWeight;
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
private float _mRawMaterialWeight;

/// <summary>
/// 实际的下料中重量

+ 0
- 44
BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialDeviceStatus.cs Dosyayı Görüntüle

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

namespace BPASmartClient.JXJFoodBigStation.Model
{
public class RawMaterialDeviceStatus
{
/// <summary>
/// 原料类型
/// 1:液体
/// 2:膏体
/// 3:粉体
/// </summary>
public ushort RawMaterialType { get; set; }

/// <summary>
/// 料仓重量反馈
/// </summary>
public float WeightFeedback { get; set; }

/// <summary>
/// 上限反馈
/// </summary>
public bool UpLimitFeedback { get; set; }

/// <summary>
/// 下限反馈
/// </summary>
public bool DownLimitFeedback { get; set; }

/// <summary>
/// 下料重量反馈
/// </summary>
public float CutWeightFeedback { get; set; }

/// <summary>
/// 设备运行状态
/// </summary>
public ushort RunStatus { get; set; }
}
}

+ 0
- 48
BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialModel.cs Dosyayı Görüntüle

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

namespace BPASmartClient.JXJFoodBigStation.Model
{
/// <summary>
/// 原料模块
/// </summary>
public class RawMaterialModel : ObservableObject
{
private int _mIp;
public int DeviceIp { get { return _mIp; } set { _mIp = value; } }
/// <summary>
/// 原料名称
/// </summary>
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; } }
private string _mRawMaterialName;

/// <summary>
/// 原料对应的桶号
/// </summary>
public int RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } }
private int _mRawMaterialBarrelNum;

/// <summary>
/// 需要原料重量
/// </summary>
public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
private double _mRawMaterialWeight;

/// <summary>
/// 实际的下料中重量
/// </summary>
public float Laying_Off_Weight { get { return _mLaying_Off_Weight; } set { _mLaying_Off_Weight = value; } }
private float _mLaying_Off_Weight;

/// <summary>
/// 原料对应料仓的位置/名称
/// </summary>
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } }
private int _mRawMaterialLocation;
}
}

BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeData.cs → BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs Dosyayı Görüntüle

@@ -8,7 +8,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model
{
public class RemoteRecipeData : ObservableObject
public class RecipeData : ObservableObject
{
/// <summary>
/// 配方名称
@@ -31,7 +31,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// <summary>
/// 原料数据
/// </summary>
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterial { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
public ObservableCollection<RawMaterial> RawMaterial { get; set; } = new ObservableCollection<RawMaterial>();


}

+ 0
- 45
BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeModel.cs Dosyayı Görüntüle

@@ -1,45 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPASmartClient.JXJFoodBigStation.ViewModel;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.JXJFoodBigStation.Model
{
/// <summary>
/// 配方模块
/// </summary>
public class RecipeModel : ObservableObject
{
/// <summary>
/// 配方名称
/// </summary>
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
private string _mRecipeName;

/// <summary>
/// 配方ID
/// </summary>
public string RecipeCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } }
private string _mRecipCode;

/// <summary>
/// 托盘编号
/// </summary>
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } }
private int _mTrayCode;

[Newtonsoft.Json.JsonIgnore]
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false);

/// <summary>
/// 原料集合
/// </summary>
public ObservableCollection<RawMaterialModel> RawMaterial { get; set; } = new ObservableCollection<RawMaterialModel>();

}
}

+ 1
- 1
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs Dosyayı Görüntüle

@@ -11,7 +11,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
/// <summary>
/// 生产工单
/// </summary>
public string Order_No;
public string RecipeCode;
/// <summary>
/// 配料开始
/// </summary>


+ 14
- 0
BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipe.cs Dosyayı Görüntüle

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

namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
public class RemoteRecipe
{
public ObservableCollection<RecipeData> Recipes { get; set; } = new ObservableCollection<RecipeData>();
}
}

+ 9
- 8
BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs Dosyayı Görüntüle

@@ -26,44 +26,45 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(3);
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ask_For_Send_Bit))
{
ActionManage.GetInstance.Send("西门子下发配方", res);
res.Ask_For_Send_Bit = false;
ActionManage.GetInstance.Send("SiemensSendRecipe", res);
res.Ask_For_Send_Bit = false;//接受配方信号复位
res.Ack_Ask_For_Send_Bit = true;//配方接受完成
this.Siemens_PLC_S7.WriteClass<DL_Start_DB>(res, 1);
}

if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.Allow_AGV_Put[0]))
{
ActionManage.GetInstance.Send("AGV到工位1信号", res1);
ActionManage.GetInstance.Send("AGVToStation1Sign", res1);
res1.Allow_AGV_Put[0] = false;
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2);
}
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(res1.Allow_AGV_Put[1]))
{
ActionManage.GetInstance.Send("AGV到工位2信号", res1);
ActionManage.GetInstance.Send("AGVToStation2Sign", res1);
res1.Allow_AGV_Put[1] = false;
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2);
}
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[2]").Start(res1.Allow_AGV_Put[2]))
{
ActionManage.GetInstance.Send("AGV到工位3信号", res1);
ActionManage.GetInstance.Send("AGVToStation3Sign", res1);
res1.Allow_AGV_Put[2] = false;
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2);
}
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[3]").Start(res1.Allow_AGV_Put[3]))
{
ActionManage.GetInstance.Send("AGV到工位4信号", res1);
ActionManage.GetInstance.Send("AGVToStation4Sign", res1);
res1.Allow_AGV_Put[3] = false;
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2);
}
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[4]").Start(res1.Allow_AGV_Put[4]))
{
ActionManage.GetInstance.Send("AGV到工位5信号", res1);
ActionManage.GetInstance.Send("AGVToStation5Sign", res1);
res1.Allow_AGV_Put[4] = false;
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2);
}
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[5]").Start(res1.Allow_AGV_Put[5]))
{
ActionManage.GetInstance.Send("AGV到工位6信号", res1);
ActionManage.GetInstance.Send("AGVToStation6Sign", res1);
res1.Allow_AGV_Put[5] = false;
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2);
}


+ 16
- 16
BPASmartClient.JXJFoodBigStation/Model/TestData.cs Dosyayı Görüntüle

@@ -13,40 +13,40 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
public volatile static TestData Instance;
public static TestData GetInstance => Instance ?? (Instance = new TestData());
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>();
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
public ObservableCollection<RecipeData> Recipes { get; set; } = new ObservableCollection<RecipeData>();
public ObservableCollection<RawMaterial> RawMaterials { get; set; } = new ObservableCollection<RawMaterial>();
public TestData()
{
string recipeName = "配方1";
string recipeCode = "10001";
int Traycode = 1;

double RawmaterialWeight = 10;
float RawmaterialWeight = 10;
short RawMaterialbarrelNum = 1;
int RawMaterialLocation = 5;

double RawmaterialWeight1 = 20;
float RawmaterialWeight1 = 20;
short RawMaterialbarrelNum1 = 2;
int RawMaterialLocation1 = 7;

double RawmaterialWeight2 = 30;
float RawmaterialWeight2 = 30;
short RawMaterialbarrelNum2 = 3;
int RawMaterialLocation2 = 9;
RawMaterials.Add(new RemoteRecipeRawMaterial()
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight,
RawMaterialBarrelNum = RawMaterialbarrelNum,
RawMaterialLocation = RawMaterialLocation
});
RawMaterials.Add(new RemoteRecipeRawMaterial()
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight1,
RawMaterialBarrelNum = RawMaterialbarrelNum1,
RawMaterialLocation = RawMaterialLocation1
});
RawMaterials.Add(new RemoteRecipeRawMaterial()
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight2,
@@ -54,7 +54,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RawMaterialLocation = RawMaterialLocation2
});

Recipes.Add(new Model.RemoteRecipeData()
Recipes.Add(new Model.RecipeData()
{
RecipeName = recipeName,
RecipeCode = recipeCode,
@@ -67,32 +67,32 @@ namespace BPASmartClient.JXJFoodBigStation.Model
string recipeCode_2 = "20001";
int Traycode_2 = 3;

double RawmaterialWeight_2 = 10;
float RawmaterialWeight_2 = 10;
short RawMaterialbarrelNum_2 = 1;
int RawMaterialLocation_2 = 5;

double RawmaterialWeight1_2 = 20;
float RawmaterialWeight1_2 = 20;
short RawMaterialbarrelNum1_2 = 2;
int RawMaterialLocation1_2 = 7;

double RawmaterialWeight2_2 = 30;
float RawmaterialWeight2_2 = 30;
short RawMaterialbarrelNum2_2 = 3;
int RawMaterialLocation2_2 = 9;
RawMaterials.Add(new RemoteRecipeRawMaterial()
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight_2,
RawMaterialBarrelNum = RawMaterialbarrelNum_2,
RawMaterialLocation = RawMaterialLocation_2
});
RawMaterials.Add(new RemoteRecipeRawMaterial()
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight1_2,
RawMaterialBarrelNum = RawMaterialbarrelNum1_2,
RawMaterialLocation = RawMaterialLocation1_2
});
RawMaterials.Add(new RemoteRecipeRawMaterial()
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight2_2,
@@ -100,7 +100,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RawMaterialLocation = RawMaterialLocation2_2
});

Recipes.Add(new Model.RemoteRecipeData()
Recipes.Add(new Model.RecipeData()
{
RecipeName = recipeName_2,
RecipeCode = recipeCode_2,


+ 40
- 10
BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml Dosyayı Görüntüle

@@ -374,7 +374,7 @@
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8"
Columns="6"
Rows="1" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
@@ -384,25 +384,34 @@
<Border Margin="5" Background="Transparent">
<Grid Height="220">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<!--<RowDefinition Height="0.1*"/>-->
</Grid.RowDefinitions>

<!--<TextBox
Margin="0,0,0,35"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
FontSize="25"
Text="{Binding DeviceName}">
</TextBox>-->
<TextBlock
Margin="0,0,0,35"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
FontSize="25"
Foreground="#ffccd61f"
Text="{Binding DeviceName}" />
Text="{Binding DeviceName}"
/>
<StackPanel
Grid.RowSpan="2"
Panel.ZIndex="1"
Margin="55,100,0,0"
HorizontalAlignment="Center">

<Path x:Name="path" Tag="{Binding DeviceName}" Visibility="Collapsed" Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z">
<Path x:Name="path" Tag="{Binding DeviceName}" Visibility="Hidden" Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z">
<Path.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90"/>
@@ -425,7 +434,7 @@

<StackPanel
Grid.Row="1"
Margin="0,25,0,0"
Margin="0,5,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
@@ -443,7 +452,7 @@

<StackPanel
Grid.Row="1"
Margin="0,70,0,0"
Margin="0,45,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
@@ -456,6 +465,18 @@
Text=" 号仓" />
</StackPanel>

<Button Grid.Row="2"
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding DataContext.UpdateRawMaterName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}}"
CommandParameter="{Binding DeviceName}"
Content="修改原料名称"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>


<Image
Grid.RowSpan="2"
Source="/BPASmartClient.CustomResource;component/Image/光柱.png"
@@ -537,7 +558,7 @@
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8"
Columns="6"
Rows="1" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
@@ -547,6 +568,7 @@
<Border Margin="5" Background="Transparent">
<Grid Height="220">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<!--<RowDefinition Height="0.1*"/>-->
@@ -585,7 +607,7 @@
</StackPanel>
<StackPanel
Grid.Row="1"
Margin="0,25,0,0"
Margin="0,5,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
@@ -602,7 +624,7 @@

<StackPanel
Grid.Row="1"
Margin="0,70,0,0"
Margin="0,45,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
@@ -615,7 +637,15 @@
Foreground="#FF0084FF"
Text=" 号仓" />
</StackPanel>

<Button Grid.Row="2"
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding DataContext.UpdateRawMaterName, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}}"
CommandParameter="{Binding DeviceName}"
Content="修改原料名称"
FontSize="20"
Style="{StaticResource ImageButtonStyle}"></Button>
<Image
Grid.RowSpan="2"
Source="/BPASmartClient.CustomResource;component/Image/光柱.png"


+ 1
- 1
BPASmartClient.JXJFoodBigStation/ViewModel/ChangeDeviceNameViewModel.cs Dosyayı Görüntüle

@@ -40,7 +40,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
ErrorInfo = "设备名称不能为空";
return;
}
ActionManage.GetInstance.Send("UpdateDeviceName", DeviceName);
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose");
});
}


+ 51
- 6
BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs Dosyayı Görüntüle

@@ -10,6 +10,8 @@ using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.View;
using System.Windows.Forms;

namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
@@ -17,17 +19,18 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
public HardwareStatusViewModel()
{
for (int i = 0; i <8; i++)

for (int i = 6; i > 0; i--)
{
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
DeviceName = i.ToString(),
DeviceNum=i,
RunStatus = false,
RunStatus = true,
Weight = new Random().Next(0, 100)
});
}
for (int i = 8; i < 16; i++)
for (int i = 7; i < 13; i++)
{
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
@@ -37,7 +40,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
Weight = new Random().Next(0, 100)
});
}

StartCommand = new RelayCommand<string>((deviceName) => {
//PLC控制

@@ -74,11 +76,54 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
}
}
});
}

UpdateRawMaterName = new RelayCommand<string>((deviceName) =>
{
ActionManage.GetInstance.CancelRegister("UpdateDeviceName");
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
if (res != null && res is string newName)
{
int cnt = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName);
if (cnt >= 0)
{

int index = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName);
int index1 = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName);
if (index == -1 && index1 == -1)
{
var obj = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
obj.DeviceName = newName;
}
else
{
System.Windows.Forms.MessageBox.Show("设备名称与其他名称冲突", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
int index = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName);
int index1 = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName);
if (index == -1 && index1 == -1)
{
var obj = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
obj.DeviceName = newName;
}
else
{
System.Windows.Forms.MessageBox.Show("设备名称与其他名称冲突", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}), "UpdateDeviceName");
ChangeDeviceNameView view = new ChangeDeviceNameView();
view.ShowDialog();
});
}
public ObservableCollection<DeviceCurrentStatus> AllDeviceCurrentStatuses;
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();

public RelayCommand<string> UpdateRawMaterName { get; set; }
public RelayCommand<string> StartCommand { get; set; }

public RelayCommand<string> StopCommand { get; set; }


+ 15
- 16
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs Dosyayı Görüntüle

@@ -20,7 +20,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is RecipeModel rm)
if (o != null && o is RecipeData rm)
{
RecipeName = rm.RecipeName;
RecipeCode = rm.RecipeCode;
@@ -36,23 +36,23 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
}), "RecipeInfo");

AddRecipe = new RelayCommand(() => {
RawMaterialsInfo.Add(new RawMaterialModel());
RawMaterialsInfo.Add(new RawMaterial());
});
Comfirm = new RelayCommand(() =>
{
var bom= Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode);
var bom= Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode);
if (bom == null)//新配方
{
var name= Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName);
var name= Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName);
if (name == null)
{
go:
string recipeCode = new Random().Next(10000, 99999).ToString();
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
if (res == null)
{
Json<LocaPar>.Data.Recipes.Add(new RecipeModel { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode});
Json<LocaPar>.Save();
Json<LocalRecipe>.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode});
Json<LocalRecipe>.Save();
}
else
{
@@ -74,24 +74,24 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
}
bom.RecipeName = RecipeName;
bom.TrayCode = TrayCode;
Json<LocaPar>.Save();
Json<LocalRecipe>.Save();
ActionManage.GetInstance.Send("CloseRecipeInfosView");
}
});

SaveAs = new RelayCommand(() => {

var bom = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName);
var rec = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode);
var bom = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName);
var rec = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode);
if (bom == null && rec != null)//配方名称更改
{
prop: string recipeCode = new Random().Next(10000, 99999).ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
if (res == null)
{
Json<LocaPar>.Data.Recipes.Add(new RecipeModel { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode });//配方添加
Json<LocaPar>.Save();
Json<LocalRecipe>.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode });//配方添加
Json<LocalRecipe>.Save();
}
else
{
@@ -107,8 +107,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
});

RemoveRecipe = new RelayCommand<string>((materilaName) => {

var res= RawMaterialsInfo.FirstOrDefault(p=>p.RawMaterialName==materilaName);
var res = RawMaterialsInfo.FirstOrDefault(p => p.RawMaterialName == materilaName);
if (res != null)
RawMaterialsInfo.Remove(res);
});
@@ -133,6 +132,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel

public RelayCommand<string> RemoveRecipe { get; set; }

public ObservableCollection<RawMaterialModel> RawMaterialsInfo { get; set; } = new ObservableCollection<RawMaterialModel>() ;
public ObservableCollection<RawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RawMaterial>() ;
}
}

+ 9
- 9
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs Dosyayı Görüntüle

@@ -23,18 +23,18 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
public class RecipeReceiveViewModel : ObservableObject
{
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>();
public ObservableCollection<RawMaterial> RawMaterials { get; set; } = new ObservableCollection<RawMaterial>();
public RecipeReceiveViewModel()
{
Json<LocaPar>.Read();
Recipes = Json<LocaPar>.Data.Recipes;
Json<LocalRecipe>.Read();
Recipes = Json<LocalRecipe>.Data.Recipes;
DetailsCommand = new RelayCommand<object>((o) =>
{
if (o != null && o is string num)
{
ActionManage.GetInstance.CancelRegister("RecipeInfo");
RecipeInfosView nrv = new RecipeInfosView();
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num);
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num);
ActionManage.GetInstance.Send("RecipeInfo", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
@@ -85,17 +85,17 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
//});
ClearAllRecipe = new RelayCommand(() =>
{
Json<LocaPar>.Data.Recipes.Clear();
Json<LocaPar>.Save();
Json<LocalRecipe>.Data.Recipes.Clear();
Json<LocalRecipe>.Save();
});

RemoveCommand = new RelayCommand<string>((recipeCode) => {

var res = Recipes.FirstOrDefault(p=>p.RecipeCode==recipeCode);
if(res!=null)
if (res != null)
{
Recipes.Remove(res);
Json<LocaPar>.Save();
Json<LocalRecipe>.Save();
}
});
@@ -109,6 +109,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel

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

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

+ 4
- 5
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs Dosyayı Görüntüle

@@ -14,19 +14,19 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
internal class RecipeSendDownViewModel:ObservableObject
{

public ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocaPar>.Data.Recipes;
public ObservableCollection<RecipeData> Recipes { get; set; } = Json<LocalRecipe>.Data.Recipes;
/// <summary>
/// 当前正在制作的配方
/// </summary>
public static ObservableCollection<RawMaterialModel> recipeProcesses { get; set; } = new ObservableCollection<RawMaterialModel>();
public static ObservableCollection<RawMaterial> recipeProcesses { get; set; } = new ObservableCollection<RawMaterial>();
/// <summary>
/// 等待制作的配方
/// </summary>
public static ObservableCollection<RecipeModel> UserTreeWait { get; set; } = new ObservableCollection<RecipeModel>();
public static ObservableCollection<RecipeData> UserTreeWait { get; set; } = new ObservableCollection<RecipeData>();
/// <summary>
/// 已完成的配方
/// </summary>
public static ObservableCollection<RecipeModel> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeModel>();
public static ObservableCollection<RecipeData> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeData>();

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

@@ -41,7 +41,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
ActionManage.GetInstance.Send("手动下发本地配方", res);
}
});
}
}
}

+ 8
- 1
BPASmartClient.JXJFoodSmallStation/App.xaml.cs Dosyayı Görüntüle

@@ -73,11 +73,18 @@ namespace BPASmartClient.JXJFoodSmallStation
});
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "服务配方管理",
SubMenuName = "本地配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.RecipeReceiveView"
});
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "西门子配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.SiemensRecipeReceiveView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",


+ 9
- 1
BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj Dosyayı Görüntüle

@@ -26,7 +26,15 @@
<Page Update="View\DeviceListView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
<Page Update="View\NewRemoteRecipeView.xaml">
<Page Update="View\SiemensRecipeReceiveView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\WindSendParView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\NewLocalRecipeView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>


+ 13
- 0
BPASmartClient.JXJFoodSmallStation/Model/GVL/GVL.cs Dosyayı Görüntüle

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

namespace BPASmartClient.JXJFoodSmallStation.Model.GVL
{
public class GVL
{
public static bool IsUseLocalRecipe { get; set; }
}
}

+ 117
- 0
BPASmartClient.JXJFoodSmallStation/Model/GVL/ReadSmallMaterial.cs Dosyayı Görüntüle

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

namespace BPASmartClient.JXJFoodSmallStation.Model.GVL
{
public class ReadSmallMaterial
{
/// <summary>
/// PLC到上位机心跳
/// </summary>
public bool Heart { get; set; }
public bool Agv1 { get; set; }
public bool Agv2 { get; set; }
public bool Agv3 { get; set; }
public bool Agv4 { get; set; }
public bool Agv5 { get; set; }
public bool Agv6 { get; set; }
/// <summary>
/// 1#托盘工位占用
/// </summary>
public bool Tray1BeOccupied { get; set; }
/// <summary>
/// 2#托盘工位占用
/// </summary>
public bool Tray2BeOccupied { get; set; }
/// <summary>
/// 1#托盘工位配料完成
/// </summary>
public bool Tray1MaterialFinish { get; set; }
/// <summary>
/// 2#托盘工位配料完成
/// </summary>
public bool Tray2MaterialFinish { get; set; }
/// <summary>
/// 接收托盘1配方数据完成
/// </summary>
public bool Tray1ReceiveFinish { get; set; }
/// <summary>
/// 接收托盘2配方数据完成
/// </summary>
public bool Tray2ReceiveFinish { get; set; }

public int Reserve1 { get; set; }
public int Receive2 { get; set; }
/// <summary>
/// 托盘1_1#桶位置反馈
/// </summary>
public float Tray1Barrel1Location { get; set; }
/// <summary>
/// 托盘1_2#桶位置反馈
/// </summary>
public float Tray1Barrel2Location { get; set; }
/// <summary>
/// 托盘1_3#桶位置反馈
/// </summary>
public float Tray1Barrel3Location { get; set; }
/// <summary>
/// 托盘1_4#桶位置反馈
/// </summary>
public float Tray1Barrel4Location { get; set; }
/// <summary>
/// 托盘2_1#桶位置反馈
/// </summary>
public float Tray2Barrel1Location { get; set; }
/// <summary>
/// 托盘2_2#桶位置反馈
/// </summary>
public float Tray2Barrel2Location { get; set; }
/// <summary>
/// 托盘2_3#桶位置反馈
/// </summary>
public float Tray2Barrel3Location { get; set; }
/// <summary>
/// 托盘2_4#桶位置反馈
/// </summary>
public float Tray2Barrel4Location { get; set; }

public int Reserve3 { get; set; }
public int Receive4 { get; set; }
/// <summary>
/// 托盘1_1#桶允许配料
/// </summary>
public float Tray1Barrel1AllowDosing { get; set; }
/// <summary>
/// 托盘1_2#桶允许配料
/// </summary>
public float Tray1Barrel2AllowDosing { get; set; }
/// <summary>
/// 托盘1_3#桶允许配料
/// </summary>
public float Tray1Barrel3AllowDosing { get; set; }
/// <summary>
/// 托盘1_4#桶允许配料
/// </summary>
public float Tray1Barrel4AllowDosing { get; set; }
/// <summary>
/// 托盘2_1#桶允许配料
/// </summary>
public float Tray2Barrel1AllowDosing { get; set; }
/// <summary>
/// 托盘2_2#桶允许配料
/// </summary>
public float Tray2Barrel2AllowDosing { get; set; }
/// <summary>
/// 托盘2_3#桶允许配料
/// </summary>
public float Tray2Barrel3AllowDosing { get; set; }
/// <summary>
/// 托盘2_4#桶允许配料
/// </summary>
public float Tray2Barrel4AllowDosing { get; set; }

}
}

+ 185
- 0
BPASmartClient.JXJFoodSmallStation/Model/GVL/WriteSmallMaterial.cs Dosyayı Görüntüle

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

namespace BPASmartClient.JXJFoodSmallStation.Model.GVL
{
public class WriteSmallMaterial
{
/// <summary>
/// PLC到上位机心跳
/// </summary>
public bool Heart { get; set; }
public bool Agv1 { get; set; }
public bool Agv2 { get; set; }
public bool Agv3 { get; set; }
public bool Agv4{ get; set; }
public bool Agv5 { get; set; }
public bool Agv6 { get; set; }
public bool Agv7 { get; set; }
public bool Agv8 { get; set; }
public bool Agv9 { get; set; }
public bool Agv10 { get; set; }
/// <summary>
/// 下发配方到托盘1
/// </summary>
public bool Tray1IssueRecipe { get; set; }
/// <summary>
/// 下发配方到托盘2
/// </summary>
public bool Tray2IssueRecipe { get; set; }
public int Reserve1 { get; set; }
public int Receive2 { get; set; }


public bool Tray1Barrel1IsDosing1;
public bool Tray1Barrel1IsDosing2;
public bool Tray1Barrel1IsDosing3;
public bool Tray1Barrel1IsDosing4;
public bool Tray1Barrel1IsDosing5;
public bool Tray1Barrel1IsDosing6;
public bool Tray1Barrel1IsDosing7;
public bool Tray1Barrel1IsDosing8;
public bool Tray1Barrel1IsDosing9;
public bool Tray1Barrel1IsDosing10;
public bool Tray1Barrel1IsDosing11;
public bool Tray1Barrel1IsDosing12;
public bool Tray1Barrel1IsDosing13;
public bool Tray1Barrel1IsDosing14;
public bool Tray1Barrel1IsDosing15;
public bool Receive3;
public bool Tray1Barrel2IsDosing1;
public bool Tray1Barrel2IsDosing2;
public bool Tray1Barrel2IsDosing3;
public bool Tray1Barrel2IsDosing4;
public bool Tray1Barrel2IsDosing5;
public bool Tray1Barrel2IsDosing6;
public bool Tray1Barrel2IsDosing7;
public bool Tray1Barrel2IsDosing8;
public bool Tray1Barrel2IsDosing9;
public bool Tray1Barrel2IsDosing10;
public bool Tray1Barrel2IsDosing11;
public bool Tray1Barrel2IsDosing12;
public bool Tray1Barrel2IsDosing13;
public bool Tray1Barrel2IsDosing14;
public bool Tray1Barrel2IsDosing15;
public bool Receive4;
public bool Tray1Barrel3IsDosing1;
public bool Tray1Barrel3IsDosing2;
public bool Tray1Barrel3IsDosing3;
public bool Tray1Barrel3IsDosing4;
public bool Tray1Barrel3IsDosing5;
public bool Tray1Barrel3IsDosing6;
public bool Tray1Barrel3IsDosing7;
public bool Tray1Barrel3IsDosing8;
public bool Tray1Barrel3IsDosing9;
public bool Tray1Barrel3IsDosing10;
public bool Tray1Barrel3IsDosing11;
public bool Tray1Barrel3IsDosing12;
public bool Tray1Barrel3IsDosing13;
public bool Tray1Barrel3IsDosing14;
public bool Tray1Barrel3IsDosing15;
public bool Receive5;
public bool Tray1Barrel4IsDosing1;
public bool Tray1Barrel4IsDosing2;
public bool Tray1Barrel4IsDosing3;
public bool Tray1Barrel4IsDosing4;
public bool Tray1Barrel4IsDosing5;
public bool Tray1Barrel4IsDosing6;
public bool Tray1Barrel4IsDosing7;
public bool Tray1Barrel4IsDosing8;
public bool Tray1Barrel4IsDosing9;
public bool Tray1Barrel4IsDosing10;
public bool Tray1Barrel4IsDosing11;
public bool Tray1Barrel4IsDosing12;
public bool Tray1Barrel4IsDosing13;
public bool Tray1Barrel4IsDosing14;
public bool Tray1Barrel4IsDosing15;
public bool Receive6;

public bool Tray2Barrel1IsDosing1;
public bool Tray2Barrel1IsDosing2;
public bool Tray2Barrel1IsDosing3;
public bool Tray2Barrel1IsDosing4;
public bool Tray2Barrel1IsDosing5;
public bool Tray2Barrel1IsDosing6;
public bool Tray2Barrel1IsDosing7;
public bool Tray2Barrel1IsDosing8;
public bool Tray2Barrel1IsDosing9;
public bool Tray2Barrel1IsDosing10;
public bool Tray2Barrel1IsDosing11;
public bool Tray2Barrel1IsDosing12;
public bool Tray2Barrel1IsDosing13;
public bool Tray2Barrel1IsDosing14;
public bool Tray2Barrel1IsDosing15;
public bool Receive7;
public bool Tray2Barrel2IsDosing1;
public bool Tray2Barrel2IsDosing2;
public bool Tray2Barrel2IsDosing3;
public bool Tray2Barrel2IsDosing4;
public bool Tray2Barrel2IsDosing5;
public bool Tray2Barrel2IsDosing6;
public bool Tray2Barrel2IsDosing7;
public bool Tray2Barrel2IsDosing8;
public bool Tray2Barrel2IsDosing9;
public bool Tray2Barrel2IsDosing10;
public bool Tray2Barrel2IsDosing11;
public bool Tray2Barrel2IsDosing12;
public bool Tray2Barrel2IsDosing13;
public bool Tray2Barrel2IsDosing14;
public bool Tray2Barrel2IsDosing15;
public bool Receive8;
public bool Tray2Barrel3IsDosing1;
public bool Tray2Barrel3IsDosing2;
public bool Tray2Barrel3IsDosing3;
public bool Tray2Barrel3IsDosing4;
public bool Tray2Barrel3IsDosing5;
public bool Tray2Barrel3IsDosing6;
public bool Tray2Barrel3IsDosing7;
public bool Tray2Barrel3IsDosing8;
public bool Tray2Barrel3IsDosing9;
public bool Tray2Barrel3IsDosing10;
public bool Tray2Barrel3IsDosing11;
public bool Tray2Barrel3IsDosing12;
public bool Tray2Barrel3IsDosing13;
public bool Tray2Barrel3IsDosing14;
public bool Tray2Barrel3IsDosing15;
public bool Receive9;
public bool Tray2Barrel4IsDosing1;
public bool Tray2Barrel4IsDosing2;
public bool Tray2Barrel4IsDosing3;
public bool Tray2Barrel4IsDosing4;
public bool Tray2Barrel4IsDosing5;
public bool Tray2Barrel4IsDosing6;
public bool Tray2Barrel4IsDosing7;
public bool Tray2Barrel4IsDosing8;
public bool Tray2Barrel4IsDosing9;
public bool Tray2Barrel4IsDosing10;
public bool Tray2Barrel4IsDosing11;
public bool Tray2Barrel4IsDosing12;
public bool Tray2Barrel4IsDosing13;
public bool Tray2Barrel4IsDosing14;
public bool Tray2Barrel4IsDosing15;
public bool Receive10;
public int Receive11;

public bool StockIn1DosingFinish;
public bool StockIn2DosingFinish;
public bool StockIn3DosingFinish;
public bool StockIn4DosingFinish;
public bool StockIn5DosingFinish;
public bool StockIn6DosingFinish;
public bool StockIn7DosingFinish;
public bool StockIn8DosingFinish;
public bool StockIn9DosingFinish;
public bool StockIn10DosingFinish;
public bool StockIn11DosingFinish;
public bool StockIn12DosingFinish;
public bool StockIn13DosingFinish;
public bool StockIn14DosingFinish;
public bool StockIn15DosingFinish;
public bool Receive12;
}
}

+ 10
- 11
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs Dosyayı Görüntüle

@@ -21,7 +21,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl());
private ProcessControl() { }

public ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
/// <summary>
/// 配方数据
/// </summary>
@@ -54,12 +53,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
RawMaterialsNamePos.Add(DeviceInquire.GetInstance.GetDevice(i).DeviceName, (short)DeviceInquire.GetInstance.GetDevice(i).deviceStatus.DeviceNum);
}
}
}
ActionManage.GetInstance.CancelRegister("SiemensRecipeRecive");
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials = new ObservableCollection<RemoteRecipeRawMaterial>();
if (SiemensDevice.IsConnected)
{
if (res != null && res is XL_Start_DB recipe)
@@ -96,7 +95,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"];
try
{
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP);
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP);
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
if (HKDevice.IsConnected)
{
@@ -627,10 +626,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
//int decimalNum = Convert.ToInt32(loc.ToString().Substring(loc.ToString().IndexOf(".") + 1));
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//根据料仓编号 启动并写入每个原料重量
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//根据料仓编号 启动并写入每个原料重量
SmallStation.StockInIsWork = (int)loc;
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.0", false);
}
@@ -645,10 +644,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量
SmallStation.StockInIsWork = (int)loc;
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.1", false);
}
@@ -663,10 +662,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量
SmallStation.StockInIsWork = (int)loc;
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.2", false);
}
@@ -681,10 +680,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量
SmallStation.StockInIsWork = (int)loc;
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.3", false);
}


BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeDataColl.cs → BPASmartClient.JXJFoodSmallStation/Model/Siemens/LocalRecipeDataColl.cs Dosyayı Görüntüle

@@ -5,9 +5,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
public class RemoteRecipeDataColl
internal class LocalRecipeDataColl
{
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>();
}

+ 4
- 4
BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs Dosyayı Görüntüle

@@ -23,8 +23,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// <summary>
/// 需要原料重量
/// </summary>
public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; } }
private double _mRawMaterialWeight;
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; } }
private float _mRawMaterialWeight;

/// <summary>
/// 实际的下料中重量
@@ -35,8 +35,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// <summary>
/// 料仓剩余重量
/// </summary>
public double StockBinRemainingWeight { get { return _mStockBinRemainingWeight; } set { _mStockBinRemainingWeight = value; } }
private double _mStockBinRemainingWeight;
public float StockBinRemainingWeight { get { return _mStockBinRemainingWeight; } set { _mStockBinRemainingWeight = value; } }
private float _mStockBinRemainingWeight;

/// <summary>
/// 原料对应料仓的位置


+ 6
- 6
BPASmartClient.JXJFoodSmallStation/Model/TestData.cs Dosyayı Görüntüle

@@ -21,15 +21,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
string recipeCode = "10001";
int Traycode = 1;

double RawmaterialWeight = 10;
float RawmaterialWeight = 10;
short RawMaterialbarrelNum = 1;
int RawMaterialLocation = 5;

double RawmaterialWeight1 = 20;
float RawmaterialWeight1 = 20;
short RawMaterialbarrelNum1 = 2;
int RawMaterialLocation1 = 7;

double RawmaterialWeight2 = 30;
float RawmaterialWeight2 = 30;
short RawMaterialbarrelNum2 = 3;
int RawMaterialLocation2 = 9;
RawMaterials.Add(new RemoteRecipeRawMaterial()
@@ -67,15 +67,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
string recipeCode_2 = "20001";
int Traycode_2 = 3;

double RawmaterialWeight_2 = 10;
float RawmaterialWeight_2 = 10;
short RawMaterialbarrelNum_2 = 1;
int RawMaterialLocation_2 = 5;

double RawmaterialWeight1_2 = 20;
float RawmaterialWeight1_2 = 20;
short RawMaterialbarrelNum1_2 = 2;
int RawMaterialLocation1_2 = 7;

double RawmaterialWeight2_2 = 30;
float RawmaterialWeight2_2 = 30;
short RawMaterialbarrelNum2_2 = 3;
int RawMaterialLocation2_2 = 9;
RawMaterials.Add(new RemoteRecipeRawMaterial()


+ 235
- 0
BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml Dosyayı Görüntüle

@@ -0,0 +1,235 @@
<Window
x:Class="BPASmartClient.JXJFoodSmallStation.View.NewLocalRecipeView"
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.JXJFoodSmallStation.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
Title="NewRemoteRecipeView"
Width="700"
Height="520"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

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

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />

<ResourceDictionary>
<!--#region ListBox样式-->
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="border" CornerRadius="8">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<Border
Name="br"
BorderBrush="#0CADF5"
BorderThickness="2">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" />
<!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗2.png" />-->
</Border.Background>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center" Grid.Column="0" Orientation="Horizontal">
<TextBlock
Width="100"
Margin="10,0,10,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="配方名称:" />
<TextBox
Width="120"
Height="30"
FontSize="16"
Text="{Binding RecipeName}" />
</StackPanel>
<WrapPanel VerticalAlignment="Center" Grid.Column="1">
<TextBlock
Width="100"
Margin="10,0,10,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="配方编码:" />
<TextBox
Width="120"
Height="30"
FontSize="16"
Text="{Binding RecipeCode}" />
</WrapPanel>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<WrapPanel VerticalAlignment="Center" Grid.Column="0">
<TextBlock
Width="100"
Margin="10,0,10,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="托盘编号:" />
<TextBox
Width="120"
Height="30"
FontSize="16"
Text="{Binding TrayNum}" />
</WrapPanel>
<WrapPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Column="1">
<Button
Width="100"
Height="40"
Margin="5,0,5,0"
Command="{Binding AddCommand}"
Content="添加原料"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="100"
Height="40"
Margin="5,0,10,0"
Command="{Binding SaveCommand}"
Content="保存配方"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Name ="Close"
Width="100"
Height="40"
Margin="5,0,5,0"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</WrapPanel>
</Grid>


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

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="原料位置" HorizontalAlignment="Center" />
<Grid Grid.Column="1">
<TextBlock Text="原料桶号" HorizontalAlignment="Center" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="2" Text="原料重量" HorizontalAlignment="Center" />
<Grid Grid.Column="3">
<TextBlock Text="功能操作" HorizontalAlignment="Center" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,0" />
</Grid>
<Grid Grid.Row="3">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding RawMaterial}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBox
Grid.Column="0"
Text="{Binding RawMaterialLocation }" />

<Grid Grid.Column="1">
<TextBox
Text="{Binding RawMaterialBarrelNum}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="2"
Text="{Binding RawMaterialWeight}" />

<Grid Grid.Column="3">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
FontSize="16" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>


</Grid>
</Border>
</Window>

BPASmartClient.JXJFoodSmallStation/View/NewRemoteRecipeView.xaml.cs → BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml.cs Dosyayı Görüntüle

@@ -19,12 +19,13 @@ namespace BPASmartClient.JXJFoodSmallStation.View
/// <summary>
/// DeviceMaterialParView.xaml 的交互逻辑
/// </summary>
public partial class NewRemoteRecipeView : Window
public partial class NewLocalRecipeView : Window
{
public NewRemoteRecipeView()
public NewLocalRecipeView()
{
InitializeComponent();
this.Close.Click += (o, e) => { this.Close(); };
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
ActionManage.GetInstance.CancelRegister("CloseNewRemoteRecipeView");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRemoteRecipeView");
}

+ 0
- 236
BPASmartClient.JXJFoodSmallStation/View/NewRemoteRecipeView.xaml Dosyayı Görüntüle

@@ -1,236 +0,0 @@
<Window
x:Class="BPASmartClient.JXJFoodSmallStation.View.NewRemoteRecipeView"
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.JXJFoodSmallStation.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
Title="NewRemoteRecipeView"
Width="700"
Height="450"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

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

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />

<ResourceDictionary>
<!--#region ListBox样式-->
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="border" CornerRadius="8">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>


<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center" Grid.Column="0" Orientation="Horizontal">
<TextBlock
Width="100"
Margin="10,0,10,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="配方名称:" />
<TextBox
Width="120"
Height="30"
FontSize="16"
Text="{Binding RecipeName}" />
<TextBlock
Width="100"
Margin="0,0,10,0"
HorizontalAlignment="Right"
Background="Transparent"
FontSize="16"
Foreground="Red"
Text="{Binding ErrorInfo}" />
</StackPanel>
<WrapPanel VerticalAlignment="Center" Grid.Column="1">
<TextBlock
Width="100"
Margin="10,0,10,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="配方编码:" />
<TextBox
Width="120"
Height="30"
FontSize="16"
Text="{Binding RecipeCode}" />
</WrapPanel>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<WrapPanel VerticalAlignment="Center" Grid.Column="0">
<TextBlock
Width="100"
Margin="10,0,10,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="托盘编号:" />
<TextBox
Width="120"
Height="30"
FontSize="16"
Text="{Binding TrayNum}" />
</WrapPanel>
<WrapPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Column="1">
<Button
Width="100"
Height="40"
Margin="5,0,5,0"
Command="{Binding AddCommand}"
Content="添加原料"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="100"
Height="40"
Margin="5,0,5,0"
Command="{Binding SaveCommand}"
Content="保存配方"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Name ="Close"
Width="100"
Height="40"
Margin="5,0,5,0"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</WrapPanel>
</Grid>

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

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="原料位置" HorizontalAlignment="Center" />
<Grid Grid.Column="1">
<TextBlock Text="原料桶号" HorizontalAlignment="Center" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="2" Text="原料重量" HorizontalAlignment="Center" />
<Grid Grid.Column="3">
<TextBlock Text="功能操作" HorizontalAlignment="Center" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,0" />
</Grid>
<Grid Grid.Row="3">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding RawMaterial}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBox
Grid.Column="0"
Text="{Binding RawMaterialLocation }" />

<Grid Grid.Column="1">
<TextBox
Text="{Binding RawMaterialBarrelNum}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="2"
Text="{Binding RawMaterialWeight}" />

<Grid Grid.Column="3">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
FontSize="16" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>


</Grid>
</Window>

+ 35
- 33
BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml Dosyayı Görüntüle

@@ -52,7 +52,9 @@
</ResourceDictionary>
</Window.Resources>

<Border Name="br" BorderThickness="1" >
<Border Name="br"
BorderBrush="#0CADF5"
BorderThickness="1" >
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" />
</Border.Background>
@@ -62,37 +64,40 @@
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="80" />
<RowDefinition />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<WrapPanel>
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="配方名称:" />
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RecipeName}" />
</WrapPanel>
<WrapPanel Grid.Row="1">
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="配方编号:" />
<TextBlock Grid.Row="1" Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RecipeCode}" />
</WrapPanel>
<WrapPanel Grid.Row="2">
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="托盘编号:" />
<TextBlock Grid.Row="1" Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding TrayCode}" />
</WrapPanel>
<Grid Grid.Row="3">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="9*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" HorizontalAlignment="Center">小料站</TextBlock>
<WrapPanel>
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="配方名称:" />
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RecipeName}" />
</WrapPanel>
<WrapPanel Grid.Column="1">
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="配方编号:" />
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RecipeCode}" />
</WrapPanel>

<WrapPanel Grid.Row="1">
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="托盘编号:" />
<TextBlock Grid.Row="1" Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding TrayCode}" />
</WrapPanel>
<Button Grid.Column="1" Grid.Row="1" Width="100" Command="{Binding ReturnPage}" HorizontalAlignment="Left" Margin="10,0,0,0">返回</Button>
</Grid>
<Grid Grid.Row="3">
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="9*"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0" >
<Grid.ColumnDefinitions>
@@ -100,12 +105,12 @@
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<TextBlock FontSize="16" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top">原料桶号</TextBlock>
<TextBlock FontSize="16" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top">原料位置</TextBlock>
<TextBlock FontSize="16" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top">原料位置</TextBlock>
<TextBlock FontSize="16" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top">原料桶号</TextBlock>
<TextBlock FontSize="16" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top">原料重量</TextBlock>
</Grid>
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" >
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}" >
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}" Width="548" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="grb" Height="25" >
@@ -114,8 +119,8 @@
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialBarrelNum}"></TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialLocation}"></TextBlock>
<TextBlock Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialLocation}"></TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialBarrelNum}"></TextBlock>
<TextBlock Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialWeight}"></TextBlock>
</Grid>
<DataTemplate.Triggers>
@@ -129,9 +134,6 @@
</ScrollViewer>
</Grid>
</Grid>
<Grid Grid.Row="4">
<Button Command="{Binding ReturnPage}" Width="200" >返回</Button>
</Grid>
</Grid>
</Grid>
</Border>


+ 1
- 0
BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml.cs Dosyayı Görüntüle

@@ -23,6 +23,7 @@ namespace BPASmartClient.JXJFoodSmallStation.View
public RecipeInfosView()
{
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
ActionManage.GetInstance.CancelRegister("CloseRecipeInfosView");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseRecipeInfosView");
}


+ 26
- 8
BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml Dosyayı Görüntüle

@@ -48,11 +48,17 @@
<RowDefinition Height="50"/>
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<!--<CheckBox
Content="本地配方模拟"
FontFamily="楷体"
VerticalAlignment="Center"
Foreground="Aqua"
IsChecked="{Binding IsUseLocalRecipe}"/>-->
<pry:IcoButton
Width="140"
Margin="10"
HorizontalAlignment="Left"
HorizontalAlignment="Right"
Command="{Binding NewRecipe}"
Content="自定义配方"
FontSize="16"
@@ -62,7 +68,7 @@
<pry:IcoButton
Width="140"
Margin="10"
HorizontalAlignment="Left"
HorizontalAlignment="Right"
Command="{Binding NewSimulateRecipe}"
Content="新建模拟配方"
FontSize="16"
@@ -74,7 +80,7 @@
Grid.Column="3"
Width="140"
Margin="10"
HorizontalAlignment="Left"
HorizontalAlignment="Right"
Command="{Binding ClearAllRecipe}"
Content="清除所有配方"
FontSize="16"
@@ -136,30 +142,42 @@
Foreground="#dd000000"
Text="{Binding TrayCode}" />
</WrapPanel>
<Grid
Name="gr"
Grid.Row="2"
Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<pry:IcoButton
Grid.Column="0"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeCode}"
Content="详情"
Content="编辑"
EnterBackground="#FF2AB2E7"
Foreground="#dd000000"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Grid.Column="1"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeCode}"
Content="下发"
EnterBackground="#FF2AB2E7"
Foreground="#dd000000"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />

</Grid>

</Grid>


+ 150
- 0
BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml Dosyayı Görüntüle

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

<UserControl.Resources>
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TextBlockForeground" Color="#9934F7F7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Background" Value="Transparent" />
<!--<Setter Property="Foreground" Value="{StaticResource FontColor}" />-->
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Foreground" Value="Aqua" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="BorderThickness" Value="0" />
</Style>

</UserControl.Resources>

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

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<pry:IcoButton
Grid.Column="3"
Width="140"
Margin="10"
HorizontalAlignment="Right"
Command="{Binding ClearAllRecipe}"
Content="清除所有配方"
FontSize="16"
Foreground="Aqua"
IcoText="&#xe635;"
IsEnabled="True"
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
<ScrollViewer Grid.Row="1">
<ListView
Margin="5"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding Recipes}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Border Margin="5" Background="LightSkyBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.25*" />
<RowDefinition Height="0.2*" />
</Grid.RowDefinitions>
<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" />
<WrapPanel Grid.Row="1">
<TextBlock
Margin="2,0,0,0"
Foreground="#dd000000"
Text="名称:" />
<TextBlock
Margin="2,0,0,0"
Foreground="#dd000000"
Text="{Binding RecipeName}" />
<TextBlock
Margin="5,0,0,0"
Foreground="#dd000000"
Text="编号:" />
<TextBlock
Margin="2,0,0,0"
Foreground="#dd000000"
Text="{Binding RecipeCode}" />
<TextBlock
Margin="5,0,0,0"
Foreground="#dd000000"
Text="托盘号:" />
<TextBlock
Margin="2,0,0,0"
Foreground="#dd000000"
Text="{Binding TrayCode}" />
</WrapPanel>
<Grid
Name="gr"
Grid.Row="2"
Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>

<pry:IcoButton
Grid.Column="0"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeCode}"
Content="详情"
EnterBackground="#FF2AB2E7"
Foreground="#dd000000"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />
</Grid>

</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollViewer>
</Grid>
</UserControl>

+ 29
- 0
BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml.cs Dosyayı Görüntüle

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
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.JXJFoodSmallStation.View
{
/// <summary>
/// RecipeSettingsView.xaml 的交互逻辑
/// </summary>
public partial class SiemensRecipeReceiveView : UserControl
{
public SiemensRecipeReceiveView()
{
InitializeComponent();
}
}
}

+ 370
- 0
BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml Dosyayı Görüntüle

@@ -0,0 +1,370 @@
<UserControl
x:Class="BPASmartClient.JXJFoodSmallStation.View.WindSendParView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.JXJFoodSmallStation.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.JXJFoodSmallStation.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:WindSendParViewModel />
</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="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 Height="40" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding AddCommand}"
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>

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

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</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="提前关阀重量" />

<Grid Grid.Column="3">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="快加速度" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource TitleTextblockStyle}"
Text="慢加速度" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="伺服手动速度" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="6"
Style="{StaticResource TitleTextblockStyle}"
Text="料仓上限重量" />

<Grid Grid.Column="7">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓下限重量" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="8"
Style="{StaticResource TitleTextblockStyle}"
Text="搅拌速度" />

<Grid Grid.Column="9">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

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

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

<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding deviceParModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBox
Grid.Column="0"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding MaterialName}" />

<Grid Grid.Column="1">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding SlowlyAddWeight}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="2"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding PreCloseValveWeight}" />

<Grid Grid.Column="3">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding RapidAcceleration}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="4"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding SlowAcceleration}" />

<Grid Grid.Column="5">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding ServoManualSpeed}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="6"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding SiloUpperLimitWeight}" />

<Grid Grid.Column="7">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding LowerLimitWeightOfSilo}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="8"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding StirringSpeed}" />

<Grid Grid.Column="9">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding MaterialName}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

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

</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>


</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml.cs Dosyayı Görüntüle

@@ -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.JXJFoodSmallStation.View
{
/// <summary>
/// DeviceMaterialParView.xaml 的交互逻辑
/// </summary>
public partial class WindSendParView : UserControl
{
public WindSendParView()
{
InitializeComponent();
}
}
}

BPASmartClient.JXJFoodSmallStation/ViewModel/NewRemoteRecipeViewModel.cs → BPASmartClient.JXJFoodSmallStation/ViewModel/NewLocalRecipeViewModel.cs Dosyayı Görüntüle

@@ -15,10 +15,24 @@ using BPASmartClient.JXJFoodSmallStation.Model.Siemens;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public class NewRemoteRecipeViewModel : ObservableObject
public class NewLocalRecipeViewModel : ObservableObject
{
public NewRemoteRecipeViewModel()
public NewLocalRecipeViewModel()
{
ActionManage.GetInstance.CancelRegister("LocalRecipeEdit");
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is RemoteRecipeData rm)
{
RecipeName = rm.RecipeName;
RecipeCode = rm.RecipeCode;
TrayNum = rm.TrayCode;
foreach (var item in rm.RawMaterial)
{
RawMaterial.Add(item);
}
}
}), "LocalRecipeEdit");
RemoveCommand = new RelayCommand<object>((o) =>
{
var res = RawMaterial.FirstOrDefault(p => p.RawMaterialLocation == (int)o);
@@ -35,6 +49,21 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
});
SaveCommand = new RelayCommand(() =>
{
if (RecipeName.Length < 0 || RecipeName == null)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"配方名称不能为空");
return;
}
int index = Array.FindIndex(Json<RemoteRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == RecipeCode);
if (index >= 0)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"已经存在配方{RecipeCode}");
return;
}
if (TrayNum != 1 || TrayNum!=2)
{
TrayNum = 1;
}
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials = new ObservableCollection<RemoteRecipeRawMaterial>();
if (RawMaterial == null || RawMaterial.Count <= 0)
{
@@ -59,7 +88,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
RawMaterialWeight = item.RawMaterialWeight,
});
}
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
Json<LocalRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
{
RecipeName = RecipeName,
RecipeCode = RecipeCode,
@@ -78,7 +107,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
private string _mRecipeName = string.Empty;

public int TrayNum { get { return _mTrayNum; } set { _mTrayNum = value; OnPropertyChanged(); } }
private int _mTrayNum = 0;
private int _mTrayNum = 1;

public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
private string _mErrorInfo;

+ 0
- 3
BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeInfosViewModel.cs Dosyayı Görüntüle

@@ -25,9 +25,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
RecipeName = rm.RecipeName;
RecipeCode = rm.RecipeCode;
TrayCode = rm.TrayCode;
//RawMaterialsInfo = rm.RawMaterial;
//var rest = RawMaterialsInfo.GetHashCode();

foreach (var item in rm.RawMaterial)
{
RawMaterialsInfo.Add(item);


+ 23
- 20
BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs Dosyayı Görüntüle

@@ -18,6 +18,7 @@ using System.Windows.Media;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.JXJFoodSmallStation.Model.Siemens;
using BPASmartClient.JXJFoodSmallStation.Model.GVL;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
@@ -27,32 +28,35 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RecipeReceiveViewModel()
{
//Json<LocaPar>.Read();
Recipes = Json<RemoteRecipeDataColl>.Data.Recipes;
Recipes = Json<LocalRecipeDataColl>.Data.Recipes;
NewRecipe = new RelayCommand(() =>
{
NewRemoteRecipeView NewRemoteRecipe = new NewRemoteRecipeView();
NewRemoteRecipe.ShowDialog();
NewLocalRecipeView NewLocalRecipe = new NewLocalRecipeView();
NewLocalRecipe.ShowDialog();
});
DetailsCommand = new RelayCommand<object>((o) =>
{
if (o != null && o is string num)
if (o != null && o is string cnt)
{
ActionManage.GetInstance.Send("CloseRecipeInfosView");
RecipeInfosView nrv = new RecipeInfosView();
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num);
ActionManage.GetInstance.Send("RecipeInfo", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
ActionManage.GetInstance.Send("CloseNewRemoteRecipeView");
NewLocalRecipeView nrv = new NewLocalRecipeView();
var res = Json<LocalRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == cnt);
if (res != null)
{
ActionManage.GetInstance.Send("LocalRecipeEdit", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
}
}
});
NewSimulateRecipe = new RelayCommand(() =>
{
//RawMaterials.Clear();
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials = new ObservableCollection<RemoteRecipeRawMaterial>();
string recipeName = "配方" + (Json<RemoteRecipeDataColl>.Data.Recipes.Count + 1) + "";
string recipeName = "配方" + (Json<LocalRecipeDataColl>.Data.Recipes.Count + 1) + "";
go:
string recipeCode = new Random().Next(1000, 9999).ToString();
foreach (var item in Json<RemoteRecipeDataColl>.Data.Recipes)
foreach (var item in Json<LocalRecipeDataColl>.Data.Recipes)
{
if (item.RecipeCode == recipeCode)
{
@@ -76,10 +80,10 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
});
}
}
var res = Array.FindIndex(Json<RemoteRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == recipeCode);
var res = Array.FindIndex(Json<LocalRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == recipeCode);
if (res < 0)
{
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
Json<LocalRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
{
RecipeName = recipeName,
RecipeCode = recipeCode,
@@ -91,14 +95,13 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
});
ClearAllRecipe = new RelayCommand(() =>
{
Json<RemoteRecipeDataColl>.Data.Recipes.Clear();
Json<LocalRecipeDataColl>.Data.Recipes.Clear();
});
}
}
public RelayCommand<object> DetailsCommand { get; set; }

public RelayCommand NewSimulateRecipe { get; set; }
public RelayCommand NewSimulateRecipe { get;set; }
public RelayCommand ClearAllRecipe { get; set; }
public RelayCommand NewRecipe { get; set; }
public ObservableCollection<RemoteRecipeData> Recipes { get; set; }
public ObservableCollection<RemoteRecipeData> Recipes { get; set; }=new ObservableCollection<RemoteRecipeData>() { new RemoteRecipeData() { } };
}
}

+ 53
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/SiemensRecipeReceiveViewModel.cs Dosyayı Görüntüle

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.JXJFoodSmallStation.Model;
using BPASmartClient.JXJFoodSmallStation.View;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.Model;
using BPASmartClient.CustomResource.UserControls.Enum;
using System.Windows.Media;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.JXJFoodSmallStation.Model.Siemens;
using BPASmartClient.JXJFoodSmallStation.Model.GVL;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public class SiemensRecipeReceiveViewModel : ObservableObject
{
//ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
public SiemensRecipeReceiveViewModel()
{
Recipes = Json<RemoteRecipeDataColl>.Data.Recipes;
DetailsCommand = new RelayCommand<object>((o) =>
{
if (o != null && o is string cnt)
{
ActionManage.GetInstance.Send("CloseRecipeInfosView");
RecipeInfosView nrv = new RecipeInfosView();
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == cnt);
if (res != null)
{
ActionManage.GetInstance.Send("RecipeInfo", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
}
}
});
}
public RelayCommand<object> DetailsCommand { get; set; }
public RelayCommand ClearAllRecipe { get; set; }
public ObservableCollection<RemoteRecipeData> Recipes { get; set; }
}
}

+ 69
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/WindSendParViewModel.cs Dosyayı Görüntüle

@@ -0,0 +1,69 @@
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;
using BPASmartClient.JXJFoodSmallStation.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;
using System.Diagnostics;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public class WindSendParViewModel : ObservableObject
{
public WindSendParViewModel()
{
deviceParModels = Json<DevicePar>.Data.deviceParModels;
RemoveCommand = new RelayCommand<object>((o) =>
{
var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString());
if (res != null) deviceParModels.Remove(res);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!");
});

AddCommand = new RelayCommand(() => { deviceParModels.Add(new DeviceParModel()); });
SaveCommand = new RelayCommand(() =>
{
if (deviceParModels == null || deviceParModels.Count <= 0)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"没有可保存的参数!");
return;
}

for (int i = 0; i < deviceParModels.Count; i++)
{
if (deviceParModels.Where(p => p.MaterialName == deviceParModels.ElementAt(i).MaterialName)?.ToList()?.Count >= 2)
deviceParModels.ElementAt(i).IsRedundant = true;
else
deviceParModels.ElementAt(i).IsRedundant = false;
}

if (deviceParModels.FirstOrDefault(p => p.IsRedundant == true) != null)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料名称冲突,请检查后重试!");
return;
}

deviceParModels.Where(P => P.MaterialName.Length <= 0)?.ToList()?.ForEach(item =>
{
Json<DevicePar>.Data.deviceParModels.Remove(item);
});
Json<DevicePar>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"原料参数保存成功!");
});
}

public ObservableCollection<DeviceParModel> deviceParModels { get; set; }

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

public RelayCommand AddCommand { get; set; }
public RelayCommand SaveCommand { get; set; }

}
}

Yükleniyor…
İptal
Kaydet