Browse Source

业务组件修改

master
pry 1 year ago
parent
commit
c21ba1340f
6 changed files with 8 additions and 28 deletions
  1. +4
    -2
      BPA.SingleDevice/Business/DeviceAbs.cs
  2. +1
    -0
      BPA.SingleDevice/Business/MainControl.cs
  3. +0
    -17
      BPA.SingleDevice/Helper/SqlHelper.cs
  4. +2
    -1
      BPA.SingleDevice/Interface/IDeviceAbs.cs
  5. +0
    -7
      BPA.SingleDevice/Interface/ISqlHelper.cs
  6. +1
    -1
      BPA.SingleDevice/View/MainView.xaml

+ 4
- 2
BPA.SingleDevice/Business/DeviceAbs.cs View File

@@ -16,21 +16,23 @@ namespace BPA.SingleDevice.Business
{
string IpAddress { get; set; }
EDeviceType DeviceType { get; set; }
int Port { get; set; }
public Action<EDeviceType> Complete { get; set; }
ModbusTcp mt { get; set; } = new ModbusTcp();
public Action<int> ArrivalFingerPos { get; set; }
public bool AllowBatching { get; set; }
public bool[] DeviceStationDetection { get; set; } = new bool[4];

public void SetPar(string ip, EDeviceType deviceType)
public void SetPar(string ip, EDeviceType deviceType, int port = 502)
{
IpAddress = ip;
DeviceType = deviceType;
Port = port;
}

public void Start()
{
mt.WithModbusTcp(IpAddress).UseConnected(() =>
mt.WithModbusTcp(IpAddress, Port).UseConnected(() =>
{
TaskManage.GetInstance.StartLong(new Action(() =>
{


+ 1
- 0
BPA.SingleDevice/Business/MainControl.cs View File

@@ -49,6 +49,7 @@ namespace BPA.SingleDevice.Business
{
if (GlobalData.GoodsModels.TryDequeue(out GoodsModel gm))
{
//对设备进行分组,筛选出对应设备所需要的料仓中的原料信息
var res = gm.RawMaters.GroupBy(p => p.DeviceNum).ToDictionary(p => p.Key, p => p.ToList());
res.ToList().ForEach(item =>
{


+ 0
- 17
BPA.SingleDevice/Helper/SqlHelper.cs View File

@@ -151,23 +151,6 @@ namespace BPA.SingleDevice.Helper
return result;
}

public async Task<OperateResult<List<RawMaterTB>>> GetRecipeDetailInfoAsync(string recipeName)
{
OperateResult<List<RawMaterTB>> result = new OperateResult<List<RawMaterTB>>();
try
{
if (Db == null) return new OperateResult<List<RawMaterTB>>("DB 实例为空");
result.Content = await Db.Queryable<RawMaterTB>().Where(p => p.Name == recipeName).ToListAsync();
result.IsSuccess = true;
}
catch (Exception ex)
{
MessageLog.GetInstance.Show(ex.ToString());
result.SetMsg(ex.ToString());
}
return result;
}

public async Task<OperateResult<List<RecipeRawMaterTB>>> GetRawMaterIds(string RecipeId)
{
OperateResult<List<RecipeRawMaterTB>> result = new OperateResult<List<RecipeRawMaterTB>>();


+ 2
- 1
BPA.SingleDevice/Interface/IDeviceAbs.cs View File

@@ -34,7 +34,8 @@ namespace BPA.SingleDevice.Interface
/// </summary>
/// <param name="ip"></param>
/// <param name="deviceType"></param>
void SetPar(string ip, EDeviceType deviceType);
/// <param name="port">端口号</param>
void SetPar(string ip, EDeviceType deviceType, int port = 502);

/// <summary>
/// 定位完成通知


+ 0
- 7
BPA.SingleDevice/Interface/ISqlHelper.cs View File

@@ -69,13 +69,6 @@ namespace BPA.SingleDevice.Interface
/// <returns></returns>
Task<OperateResult<List<T>>> GetListAsync<T>();

/// <summary>
/// 根据配方名称获取配方物料详细信息
/// </summary>
/// <param name="recipeName"></param>
/// <returns></returns>
Task<OperateResult<List<RawMaterTB>>> GetRecipeDetailInfoAsync(string recipeName);

/// <summary>
/// 通过配方ID获取物料ID集合
/// </summary>


+ 1
- 1
BPA.SingleDevice/View/MainView.xaml View File

@@ -2,10 +2,10 @@
x:Class="BPA.SingleDevice.View.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:bpa="http://BPAUIControl.io/winfx/xaml/toolkit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPA.SingleDevice.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:bpa="http://BPAUIControl.io/winfx/xaml/toolkit"
xmlns:vm="clr-namespace:BPA.SingleDevice.ViewModel"
Title="味魔方自动配料系统"
Width="1200"


Loading…
Cancel
Save