Ver código fonte

海科调试。

JXJAgvReake
ZhaoGang 1 ano atrás
pai
commit
96480deff6
20 arquivos alterados com 137 adições e 86 exclusões
  1. +1
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. +1
    -1
      BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
  3. +1
    -1
      BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj
  4. +1
    -1
      BPASmartClient.Modbus/BPASmartClient.Modbus.csproj
  5. +1
    -1
      BPASmartClient.Model/BPASmartClient.Model.csproj
  6. +43
    -19
      BPASmartClient.MorkCL/Control_MorkCL.cs
  7. +6
    -6
      BPASmartClient.MorkCL/GVL_MorkCL.cs
  8. +5
    -5
      BPASmartClient.MorkCL/Model/Control/FryingPanSet.cs
  9. +1
    -1
      BPASmartClient.MorkCL/Model/Json/ConnectPar.cs
  10. +12
    -3
      BPASmartClient.MorkCL/Server/OtherServer.cs
  11. +1
    -1
      BPASmartClient.MorkCL/View/ItemStorageView.xaml
  12. +15
    -15
      BPASmartClient.MorkCL/ViewModel/EditRawMaterialViewModel.cs
  13. +41
    -23
      BPASmartClient.MorkCL/ViewModel/ItemStorageViewModel.cs
  14. +2
    -2
      BPASmartClient.MorkCL/ViewModel/RecipeManageViewModel.cs
  15. +1
    -1
      BPASmartClient.Nfc/BPASmartClient.Nfc.csproj
  16. +1
    -1
      BPASmartClient.S7Net/BPASmartClient.S7Net.csproj
  17. +1
    -1
      BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj
  18. +1
    -1
      BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj
  19. +1
    -1
      BPASmartClient.Update/BPASmartClient.Update.csproj
  20. +1
    -1
      WpfTest/WpfTest.csproj

+ 1
- 1
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Ver arquivo

@@ -463,7 +463,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />
</ItemGroup>


+ 1
- 1
BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj Ver arquivo

@@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.116" />
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj Ver arquivo

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
</ItemGroup>

</Project>

+ 1
- 1
BPASmartClient.Modbus/BPASmartClient.Modbus.csproj Ver arquivo

@@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
<PackageReference Include="NModbus" Version="3.0.72" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />


+ 1
- 1
BPASmartClient.Model/BPASmartClient.Model.csproj Ver arquivo

@@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="log4net" Version="2.0.15" />
</ItemGroup>


+ 43
- 19
BPASmartClient.MorkCL/Control_MorkCL.cs Ver arquivo

@@ -82,7 +82,7 @@ namespace BPASmartClient.MorkCL
//devices[EDeviceType.炒锅2].Init(Json<ConnectPar>.Data.FryingPanIP2);
devices[EDeviceType.机器人].Init(Json<ConnectPar>.Data.RobotIP);
//devices[EDeviceType.压力锅].Init(Json<ConnectPar>.Data.PressureCookerIP);
//devices[EDeviceType.外部设备].Init(Json<ConnectPar>.Data.PPortName);
//devices[EDeviceType.外部设备].Init(PortName:Json<ConnectPar>.Data.ESPortName);

ManualActionRegiester();
@@ -121,14 +121,14 @@ namespace BPASmartClient.MorkCL
{
devieceType = EDeviceType.压力锅;
}
//这里判定主要是针对压力锅。
if (!TaskList.ContainsKey(devieceType))
{
if (morkCL.cds.TryDequeue(out ControlData cd))
{
cd.DeviceType = devieceType;
//cd.DeviceType = devieceType;
cd.DeviceType = EDeviceType.炒锅1;
TaskList.TryAdd(cd.DeviceType, new TaskServer());
TaskList[cd.DeviceType].TaskName = $"{cd.DeviceType.ToString()}-{cd.Name}";
TaskList[cd.DeviceType].RunTask = new Task(new Action(() => { FryingPanControl(cd.DeviceType, cd); }));
@@ -150,6 +150,7 @@ namespace BPASmartClient.MorkCL
{
var device = (FryingPanServer)devices[et];
var robot = (RobotServer)devices[EDeviceType.机器人];
var otherDevice = (OtherServer)devices[EDeviceType.外部设备];
int index = (ushort)et - 1;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}。");
switch (fm.eFunc)
@@ -191,6 +192,19 @@ namespace BPASmartClient.MorkCL
var Seasoning = SqliteHelper.GetInstance.GetSeasoning().FirstOrDefault(p => p.Id == fm.funcPars.ElementAt(0).Id);
if (Seasoning != null)
{
device.FryingPanToSeasoningLoc = false;

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅到调料投料位置。");
device.FryingPanToSeasoningLoc = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅到调料投料位置完成。");

//回到投料位置就复位。

Thread.Sleep(50);
device.FeedingSeasoningLocFB.Wait(Cts: TaskList[et].Cts);
device.FryingPanToSeasoningLoc = false;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-炒锅已到达调料投料位置。");

device.CuttingControl(Seasoning.Loc.ToString(), fm.funcPars.ElementAt(1).ParValue.ToString());
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-执行下料,下料位置:{Seasoning.Loc.ToString()},下料重量:【{fm.funcPars.ElementAt(1).ParValue.ToString()}】。");
}
@@ -208,27 +222,27 @@ namespace BPASmartClient.MorkCL
{
//查找主料库位符合条件的物料库位,主要根据物料ID和物料重量查找。
var ingre_index = Array.FindIndex(Json<ItemStorageInfo>.Data.IngredientsStorage,
item => item.MaterialID == fm.funcPars.ElementAt(0).Id && item.Weight == weight);
item => item.MaterialID == fm.funcPars.ElementAt(0).Id/* && item.Weight == weight*/);
if (ingre_index >= 0)
{
//device.CuttingControl(Seasoning.Loc.ToString(), fm.funcPars.ElementAt(1).ParValue.ToString());
var ingredientes = Json<ItemStorageInfo>.Data.IngredientsStorage[ingre_index];
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-执行下料,控制取{ingre_index+1}库物料,下料名称:{ingredientes.Name.ToString()},下料重量:【{fm.funcPars.ElementAt(1).ParValue.ToString()}】。");
device.FryingPanFeedingLoc = false;
device.FryingPanHome = false;

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{ingre_index+1.ToString()}】,子任务【{et}】。");
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(ingre_index+1).ToString()}】,子任务【{et}】。");

robot.RobotTaskControl(ingre_index+1.ToString(), et);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{ingre_index+1.ToString()}】,子任务【{et}】完成。");
robot.RobotTaskControl((ingre_index+1).ToString(), et);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(ingre_index+1).ToString()}】,子任务【{et}】完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回投料位置。");
device.FryingPanFeedingLoc = true;
device.FryingPanHome = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回投料位置完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-等待炒锅到投料位置。");
device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);//等待炒锅到投料位置
device.FryingPanFeedingLoc = false;
device.FryingPanHome = false;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-等待炒锅到投料位置完成。");

@@ -262,19 +276,19 @@ namespace BPASmartClient.MorkCL
if (mb != null)
{
//先复位变量。防止上一次是异常结束,设为True时,不会响应。
device.FryingPanFeedingLoc = false;
device.FryingPanHome = false;

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(mb.Loc + 12).ToString()}】,子任务【{et}】。");
robot.RobotTaskControl((mb.Loc + 12).ToString(), et);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(mb.Loc + 12).ToString()}】,子任务【{et}】完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回投料位置。");
device.FryingPanFeedingLoc = true;
device.FryingPanHome = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回投料位置完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-等待炒锅到投料位置。");
device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);//等待炒锅到投料位置
device.FryingPanFeedingLoc = false;
device.FryingPanHome = false;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-等待炒锅到投料位置完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-等待机器人到投料位置。");
@@ -297,7 +311,7 @@ namespace BPASmartClient.MorkCL
}
break;
case EFunc.炒锅回原点位:
device.FryingPanFeedingLoc = false;
device.FryingPanHome = false;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回原点。");
device.FryingPanHome = true;
@@ -312,7 +326,16 @@ namespace BPASmartClient.MorkCL

device.DiningOutStart = false;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人取空盆。");
//TODO:正常应该是哪个有空盆取哪个。
//TODO:暂时修改,后期优化。
//while (true)
//{
// var emptyPanIndex = Array.FindIndex(otherDevice.BoxDetection, i => i == true);
// if (emptyPanIndex >= 0)
// {
// robot.RobotTaskControl((21 + emptyPanIndex).ToString(), et);//取空盆
// break;
// }
//}
robot.RobotTaskControl("21", et);//取空盆
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人取空盆完成,等待机器人到出菜位置。");
@@ -393,7 +416,7 @@ namespace BPASmartClient.MorkCL
var pressureCooker = (PressureCookerServer)devices[EDeviceType.压力锅];
var otherDevice = (OtherServer)devices[EDeviceType.外部设备];

//这两个是字段。直接赋值
//这是字段。直接赋值
morkCL.FeedingLocFB1 = fryingPan1.FeedingLocFB;
morkCL.FeedingLocFB2=fryingPan2.FeedingLocFB;
morkCL.CleanFinish1 = fryingPan1.CleanFinish;
@@ -402,7 +425,7 @@ namespace BPASmartClient.MorkCL
morkCL.OutDinningFinsh2 = fryingPan2.OutDinningFinsh;
morkCL.OutDinningSlowDownFlag1 = fryingPan1.OutDinningSlowDownFlag;
morkCL.OutDinningSlowDownFlag2 = fryingPan2.OutDinningSlowDownFlag;
morkCL.BoxDetection=otherDevice.BoxDetection;
morkCL.IsIdle=robot.IsIdle;

#if !FORMAL
@@ -506,9 +529,10 @@ namespace BPASmartClient.MorkCL
if (!String.IsNullOrEmpty(loc) && loc.Length>=0)
{
var robot = (RobotServer)devices[EDeviceType.机器人];
//Thread.Sleep(5000);
robot.WarehousingControl(loc);
//会卡死。
//robot.WarehousingComplete[(Convert.ToInt32(loc)-1)].Wait();
robot.WarehousingComplete[(Convert.ToInt32(loc)-1)].Wait();
}
},"ItemStorage",true);



+ 6
- 6
BPASmartClient.MorkCL/GVL_MorkCL.cs Ver arquivo

@@ -32,7 +32,7 @@ namespace BPASmartClient.MorkCL
/// <summary>
/// 炒锅在调料投料位置反馈。
/// </summary>
[VariableMonitor("1号炒锅-在料投料位置反馈", "LB103")]
[VariableMonitor("1号炒锅-在料投料位置反馈", "LB103")]
public bool FeedingSeasoningLocFB1 { get; set; }

/// <summary>
@@ -50,7 +50,7 @@ namespace BPASmartClient.MorkCL
/// <summary>
/// 炒锅在投料位置反馈
/// </summary>
[VariableMonitor("1号炒锅-炒锅在投料位置反馈", "LB108")]
[VariableMonitor("1号炒锅-炒锅在主料投料位置反馈", "LB108")]
public bool FeedingLocFB1 { get; set; }

/// <summary>
@@ -123,7 +123,7 @@ namespace BPASmartClient.MorkCL
/// <summary>
/// 炒锅在调料投料位置反馈。
/// </summary>
[VariableMonitor("2号炒锅-在料投料位置反馈", "LB103")]
[VariableMonitor("2号炒锅-在料投料位置反馈", "LB103")]
public bool FeedingSeasoningLocFB2 { get; set; }

/// <summary>
@@ -141,7 +141,7 @@ namespace BPASmartClient.MorkCL
/// <summary>
/// 炒锅在投料位置反馈
/// </summary>
[VariableMonitor("2号炒锅-炒锅在投料位置反馈", "LB108")]
[VariableMonitor("2号炒锅-炒锅在主料投料位置反馈", "LB108")]
public bool FeedingLocFB2 { get; set; }

/// <summary>
@@ -270,8 +270,8 @@ namespace BPASmartClient.MorkCL
/// <summary>
/// 空箱子检测
/// </summary>
//[VariableMonitor("出餐箱子在位检测", "0")]
//public bool[] BoxDetection { get; set; } = new bool[4];
[VariableMonitor("出餐箱子在位检测", "LW630")]
public bool[] BoxDetection { get; set; } = new bool[4];
#endif
#endregion
}


+ 5
- 5
BPASmartClient.MorkCL/Model/Control/FryingPanSet.cs Ver arquivo

@@ -36,7 +36,7 @@ namespace BPASmartClient.MorkCL.Model.Control
MyModbus.Write($"LW{VWOffset[ChannelNum - 1]}".ToModbusAdd(), value);
MyModbus.Write($"LB{LBOffset[ChannelNum - 1]}".ToModbusAdd(), true);
//扫描周期较短,不等下料完成读为0,就已经过了,添加一个延时。
Task.Delay(50).Wait();
Thread.Sleep(500);
ChannelDisCom[ChannelNum - 1].Wait();
MyModbus.Write($"LB{LBOffset[ChannelNum - 1]}".ToModbusAdd(), false);
}
@@ -54,7 +54,7 @@ namespace BPASmartClient.MorkCL.Model.Control
MyModbus.Write($"LB9".ToModbusAdd(), false);
MyModbus.Write($"LW0".ToModbusAdd(), Gear);
MyModbus.Write($"LB9".ToModbusAdd(), true);
//MyModbus.Write($"LB9".ToModbusAdd(), false);
MyModbus.Write($"LB9".ToModbusAdd(), false);
}
}

@@ -70,7 +70,7 @@ namespace BPASmartClient.MorkCL.Model.Control
MyModbus.Write($"LB10".ToModbusAdd(), false);
MyModbus.Write($"LW1".ToModbusAdd(), Frequency*100);
MyModbus.Write($"LB10".ToModbusAdd(), true);
//MyModbus.Write($"LB10".ToModbusAdd(), false);
MyModbus.Write($"LB10".ToModbusAdd(), false);
}
}

@@ -86,7 +86,7 @@ namespace BPASmartClient.MorkCL.Model.Control
MyModbus.Write($"LB11".ToModbusAdd(), false);
MyModbus.Write($"LW2".ToModbusAdd(), Frequency);
MyModbus.Write($"LB11".ToModbusAdd(), true);
//MyModbus.Write($"LB11".ToModbusAdd(), false);
MyModbus.Write($"LB11".ToModbusAdd(), false);
}
}

@@ -126,7 +126,7 @@ namespace BPASmartClient.MorkCL.Model.Control
{
MyModbus.Write($"LB{loc + 16}".ToModbusAdd(), false);
MyModbus.Write($"LB{loc + 16}".ToModbusAdd(), true);
Task.Delay(50).Wait();
Thread.Sleep(500);
StirFryingLocFB[loc - 1].Wait();
MyModbus.Write($"LB{loc + 16}".ToModbusAdd(), false);
}


+ 1
- 1
BPASmartClient.MorkCL/Model/Json/ConnectPar.cs Ver arquivo

@@ -35,7 +35,7 @@ namespace BPASmartClient.MorkCL.Model.Json
/// <summary>
/// 电子秤端口号
/// </summary>
public string ESPortName { get; set; } = "COM1";
public string ESPortName { get; set; } = "COM3";

/// <summary>
/// 外设端口号


+ 12
- 3
BPASmartClient.MorkCL/Server/OtherServer.cs Ver arquivo

@@ -23,12 +23,21 @@ namespace BPASmartClient.MorkCL.Server
//设置站号
myDevice.SlaveAddress = 1;

myDevice.Read<bool[]>("LB100".ToModbusAdd(), 4).OnSuccess(s =>
//myDevice.Read<bool[]>("LB100".ToModbusAdd(), 4).OnSuccess(s =>
//{
// for (byte i = 0; i < s.Length; i++) BoxDetection[i] = s[i];
//});

myDevice.Read<ushort>("LW630".ToModbusAdd()).OnSuccess(s =>
{
for (byte i = 0; i < s.Length; i++) BoxDetection[i] = s[i];
for (byte i = 0; i < 4; i++)
{
BoxDetection[i] = s.GetBitValue((byte)(i+1));
}
});
myDevice.SlaveAddress = 2;

myDevice.Read<float>("LW20".ToModbusAdd()).OnSuccess(s => { CurrentWeight = s; });
myDevice.Read<float>("LW8".ToModbusAdd()).OnSuccess(s => { CurrentWeight = s; });

Thread.Sleep(10);
}), $"其它外部设备-{PortName}", true);


+ 1
- 1
BPASmartClient.MorkCL/View/ItemStorageView.xaml Ver arquivo

@@ -34,7 +34,7 @@
<!--#region 入库电子称状态-->
<pry:ImageBorder Margin="5,15" />
<StackPanel Margin="15,20">
<TextBlock Width="200" Text="{Binding ScaleCurrentWeight, StringFormat=当前重量:{0} g}" />
<TextBlock Width="200" Text="{Binding ScaleCurrentWeight, StringFormat=当前重量:{0:F2} g}" />
</StackPanel>
<!--#endregion-->



+ 15
- 15
BPASmartClient.MorkCL/ViewModel/EditRawMaterialViewModel.cs Ver arquivo

@@ -124,31 +124,31 @@ namespace BPASmartClient.MorkCL.ViewModel
switch (CurrentMaterialType)
{
case "主料":
if (SqliteHelper.GetInstance.GetIngredientsInfoByLoc(MaterialLoc))
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"修改失败,该位置已有物料!");
return;
}
//if (SqliteHelper.GetInstance.GetIngredientsInfoByLoc(MaterialLoc))
//{
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"修改失败,该位置已有物料!");
// return;
//}
IngredientsTB ingredients = new IngredientsTB() { Name = MaterialName, Loc = MaterialLoc, Id = _materialID, Description = MaterialDescription };
SqliteHelper.GetInstance.EditIngredients(ingredients);
break;

case "辅料":
if (SqliteHelper.GetInstance.GetAccessoriesInfoByLoc(MaterialLoc))
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"修改失败,该位置已有物料!");
return;
}
//if (SqliteHelper.GetInstance.GetAccessoriesInfoByLoc(MaterialLoc))
//{
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"修改失败,该位置已有物料!");
// return;
//}
AccessoriesTB accessories = new AccessoriesTB() { Name = MaterialName, Loc = MaterialLoc, Id = _materialID, Description = MaterialDescription };
SqliteHelper.GetInstance.EditAccessories(accessories);
break;

case "调料":
if (SqliteHelper.GetInstance.GetSeasoningInfoByLoc(MaterialLoc))
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"修改失败,该位置已有物料!");
return;
}
//if (SqliteHelper.GetInstance.GetSeasoningInfoByLoc(MaterialLoc))
//{
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"修改失败,该位置已有物料!");
// return;
//}
SeasoningTB seasoning = new SeasoningTB() { Name = MaterialName, Loc = MaterialLoc, Id = _materialID, Description = MaterialDescription };
SqliteHelper.GetInstance.EditSeasoning(seasoning);
break;


+ 41
- 23
BPASmartClient.MorkCL/ViewModel/ItemStorageViewModel.cs Ver arquivo

@@ -1,7 +1,9 @@
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPA.Helper;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.MorkCL.Model.DB;
using BPASmartClient.MorkCL.Model.Json;
using BPASmartClient.MorkCL.Server;
using S7.Net.Protocol;

namespace BPASmartClient.MorkCL.ViewModel
{
@@ -10,7 +12,7 @@ namespace BPASmartClient.MorkCL.ViewModel
public ItemStorageViewModel()
{
//加载读取数据。
AddTestData();
//AddTestData();

ActionManage.GetInstance.Register(() =>
{
@@ -31,7 +33,7 @@ namespace BPASmartClient.MorkCL.ViewModel
if (o!=null)
{
#if !FORMAL
// ScaleCurrentWeight = (float)o;
ScaleCurrentWeight = (float)o;
#else
ScaleCurrentWeight = 1.23f;
#endif
@@ -44,31 +46,47 @@ namespace BPASmartClient.MorkCL.ViewModel

InStorageCommand = new BPARelayCommand<object>((o) =>
{
if (o != null && o is IngredientsTB ingredients)
TaskManage.GetInstance.Start(() =>
{
foreach (ItemStorage item in IngredientsItorage)
if (o != null && o is IngredientsTB ingredients)
{
if (item.IsEmploy == false)

foreach (ItemStorage item in Json<ItemStorageInfo>.Data.IngredientsStorage)
{
item.MaterialID = ingredients.Id;
item.Name = ingredients.Name;
item.IsEmploy = true;
item.Weight = ScaleCurrentWeight;
ActionManage.GetInstance.Send("ItemStorage", IngredientsItorage.IndexOf(item)+1);
Json<ItemStorageInfo>.Data.IngredientsStorage = IngredientsItorage.ToArray();
Json<ItemStorageInfo>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "入库成功", $"物料{ingredients.Name}入库成功。");
return;
if (item.IsEmploy == false)
{
item.MaterialID = ingredients.Id;
item.Name = ingredients.Name;
item.IsEmploy = true;
item.Weight = ScaleCurrentWeight;

ActionManage.GetInstance.Send("ItemStorage", IngredientsItorage.IndexOf(item) + 1);
Json<ItemStorageInfo>.Save();

IngredientsItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.IngredientsStorage);

Application.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "入库成功", $"物料{ingredients.Name}入库成功。");

});
return;
}
}
Application.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "入库失败", $"物料库已满。");
});
}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "入库失败", $"物料库已满。");
}
else
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "入库失败", $"物料入库失败。");
}
else
{
Application.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "入库失败", $"物料入库失败。");
});
}
}, "ItemStorageTask");
});
}



+ 2
- 2
BPASmartClient.MorkCL/ViewModel/RecipeManageViewModel.cs Ver arquivo

@@ -76,8 +76,8 @@ namespace BPASmartClient.MorkCL.ViewModel
break;
case EFunc.添加主料:
var Id = item.funcPars[0].Id;
var weight = (float)(item.funcPars[1].ParValue);
if (!Json<ItemStorageInfo>.Data.IngredientsStorage.Any(i => i.MaterialID == Id && i.Weight ==weight))
var weight = Convert.ToSingle(item.funcPars[1].ParValue);
if (!Json<ItemStorageInfo>.Data.IngredientsStorage.Any(i => i.MaterialID == Id/* && i.Weight ==weight*/))
{
MessageNotify.GetInstance.ShowDialog($"未在主料库查找到配方所需的主料【{Id}】,下发失败。",DialogType.Error);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"下发订单{data.Name}失败!");


+ 1
- 1
BPASmartClient.Nfc/BPASmartClient.Nfc.csproj Ver arquivo

@@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
</ItemGroup>

</Project>

+ 1
- 1
BPASmartClient.S7Net/BPASmartClient.S7Net.csproj Ver arquivo

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="S7netplus" Version="0.14.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />


+ 1
- 1
BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj Ver arquivo

@@ -24,7 +24,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BPA.CustomResource" Version="1.0.23" />
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1418.22" />
</ItemGroup>
<ItemGroup>


+ 1
- 1
BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj Ver arquivo

@@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>



+ 1
- 1
BPASmartClient.Update/BPASmartClient.Update.csproj Ver arquivo

@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
</ItemGroup>

</Project>

+ 1
- 1
WpfTest/WpfTest.csproj Ver arquivo

@@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="BPA.CustomResource" Version="1.0.16" />
<PackageReference Include="BPA.Helper" Version="1.0.76" />
<PackageReference Include="BPA.Helper" Version="1.0.77" />
</ItemGroup>

</Project>

Carregando…
Cancelar
Salvar