@@ -62,6 +62,191 @@ | |||||
设备AutoKey | 设备AutoKey | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.Code"> | |||||
<summary> | |||||
原料编码 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.Aittribute"> | |||||
<summary> | |||||
商品属性 (0成品,1半成品,2,易耗品) | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.Name"> | |||||
<summary> | |||||
原料名称 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.TypeName"> | |||||
<summary> | |||||
配料类型 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.TypeID"> | |||||
<summary> | |||||
原料类型 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.StockUintName"> | |||||
<summary> | |||||
库存单位 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.Specs"> | |||||
<summary> | |||||
规格属性 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.Price"> | |||||
<summary> | |||||
成本价 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.netrecovery"> | |||||
<summary> | |||||
净料率 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.outstockUint"> | |||||
<summary> | |||||
出库单位 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingDto.proportion"> | |||||
<summary> | |||||
换算比例 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingTypeDto.Name"> | |||||
<summary> | |||||
单位名称 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingTypeDto.Remark"> | |||||
<summary> | |||||
备注 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingUintDto.Name"> | |||||
<summary> | |||||
单位名称 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching.BatchingUintDto.Remark"> | |||||
<summary> | |||||
备注 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.GoodsTechnology.TechnologyAction.TechnologyType"> | |||||
<summary> | |||||
工艺模型类型(标识是否物料 1标识物料 0标识其他) | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Goods.GoodsAttributeDto.AttributeName"> | |||||
<summary> | |||||
属性名称 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Goods.GoodsAttributeDto.GoodsTypeId"> | |||||
<summary> | |||||
商品小类id | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Goods.GoodsAttributeValue.GoodsAttributeId"> | |||||
<summary> | |||||
商品属性id | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.Goods.GoodsAttributeValue.AttributeValue"> | |||||
<summary> | |||||
属性值 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.Name"> | |||||
<summary> | |||||
功能名称 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.Type"> | |||||
<summary> | |||||
功能类型 0属性1服务2事件 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.DataType"> | |||||
<summary> | |||||
数据类型 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.DataRange"> | |||||
<summary> | |||||
取值范围 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.Unit"> | |||||
<summary> | |||||
单位 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.StepSize"> | |||||
<summary> | |||||
步长 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.EnumValue"> | |||||
<summary> | |||||
枚举值 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.DataLength"> | |||||
<summary> | |||||
数据长度 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.BoolLabel"> | |||||
<summary> | |||||
数据类型bool的描述 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.ReadWrite"> | |||||
<summary> | |||||
读写类型0读写 1只读 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionDto.Description"> | |||||
<summary> | |||||
描述 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionAction.ProductFunctionId"> | |||||
<summary> | |||||
功能id | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionAction.ActionName"> | |||||
<summary> | |||||
动作名称 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionAction.ActionType"> | |||||
<summary> | |||||
类型 (1 输入框 2下拉框) | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionAction.ActionValue"> | |||||
<summary> | |||||
类型值(jsong格式) | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionAction.Unit"> | |||||
<summary> | |||||
单位 | |||||
</summary> | |||||
</member> | |||||
<member name="P:BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction.ProductFunctionAction.Sort"> | |||||
<summary> | |||||
排序 | |||||
</summary> | |||||
</member> | |||||
<member name="M:BPA.SAAS.KitChenManage.Application.Device.Services.DevicePushRecodeService.Page(BPA.SAAS.KitChenManage.Application.Device.Dtos.DevicePushRecodeDtoPageInput)"> | <member name="M:BPA.SAAS.KitChenManage.Application.Device.Services.DevicePushRecodeService.Page(BPA.SAAS.KitChenManage.Application.Device.Dtos.DevicePushRecodeDtoPageInput)"> | ||||
<summary> | <summary> | ||||
分页 | 分页 | ||||
@@ -247,6 +432,22 @@ | |||||
<param name="foodMenuId"></param> | <param name="foodMenuId"></param> | ||||
<returns></returns> | <returns></returns> | ||||
</member> | </member> | ||||
<member name="M:BPA.SAAS.KitChenManage.Application.RequestParmsHeadlen.GetDynamic(System.Object,System.Object)"> | |||||
<summary> | |||||
映射数据 | |||||
</summary> | |||||
<param name="data1"></param> | |||||
<param name="data2"></param> | |||||
<returns></returns> | |||||
</member> | |||||
<member name="M:BPA.SAAS.KitChenManage.Application.RequestParmsHeadlen.IsPropertyExist(System.Object,System.String)"> | |||||
<summary> | |||||
验证属性是否存在 | |||||
</summary> | |||||
<param name="data"></param> | |||||
<param name="propertyname"></param> | |||||
<returns></returns> | |||||
</member> | |||||
<member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.IStoreService.Page(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoPageInput)"> | <member name="M:BPA.SAAS.KitChenManage.Application.Store.Services.IStoreService.Page(BPA.SAAS.KitChenManage.Application.Store.Dtos.StoreDtoPageInput)"> | ||||
<summary> | <summary> | ||||
分页 | 分页 | ||||
@@ -0,0 +1,71 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching | |||||
{ | |||||
public class BatchingDto | |||||
{ | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 原料编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 商品属性 (0成品,1半成品,2,易耗品) | |||||
/// </summary> | |||||
public int Aittribute { get; set; } = 0; | |||||
/// <summary> | |||||
/// 原料名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 配料类型 | |||||
/// </summary> | |||||
public string TypeName { get; set; } | |||||
/// <summary> | |||||
/// 原料类型 | |||||
/// </summary> | |||||
public string TypeID { get; set; } | |||||
/// <summary> | |||||
/// 库存单位 | |||||
/// </summary> | |||||
public string StockUintName { get; set; } | |||||
public string StockUint { get; set; } | |||||
/// <summary> | |||||
/// 规格属性 | |||||
/// </summary> | |||||
public string Specs { get; set; } | |||||
/// <summary> | |||||
/// 成本价 | |||||
/// </summary> | |||||
public decimal Price { get; set; } | |||||
/// <summary> | |||||
/// 净料率 | |||||
/// </summary> | |||||
public decimal netrecovery { get; set; } | |||||
/// <summary> | |||||
/// 出库单位 | |||||
/// </summary> | |||||
public string outstockUint { get; set; } | |||||
/// <summary> | |||||
/// 换算比例 | |||||
/// </summary> | |||||
public decimal proportion { get; set; } | |||||
public int AutoKey { get; set; } | |||||
public string ForeignKeyRe { get; set; } | |||||
public string CreateAt { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,19 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching | |||||
{ | |||||
public class BatchingInfoDto | |||||
{ | |||||
public string id { get; set; } | |||||
public string name { get; set; } | |||||
public string typeId { get; set; } | |||||
public string typeName { get; set; } | |||||
public string stockUintName { get; set; } | |||||
public string stockUint { get; set; } | |||||
public string createAt { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,22 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching | |||||
{ | |||||
public class BatchingTypeDto | |||||
{ | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 单位名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 备注 | |||||
/// </summary> | |||||
public string Remark { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,22 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching | |||||
{ | |||||
public class BatchingUintDto | |||||
{ | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 单位名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 备注 | |||||
/// </summary> | |||||
public string Remark { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,35 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.Goods | |||||
{ | |||||
public class GoodsAttributeDto | |||||
{ | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 属性名称 | |||||
/// </summary> | |||||
public string AttributeName { get; set; } | |||||
/// <summary> | |||||
/// 商品小类id | |||||
/// </summary> | |||||
public string GoodsTypeId { get; set; } | |||||
public List<GoodsAttributeValue> AttributeValueList { get; set; } | |||||
public int Sort { get; set; } | |||||
} | |||||
public class GoodsAttributeValue | |||||
{ | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
///商品属性id | |||||
/// </summary> | |||||
public string GoodsAttributeId { get; set; } | |||||
/// <summary> | |||||
/// 属性值 | |||||
/// </summary> | |||||
public string AttributeValue { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
using Newtonsoft.Json; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.Goods | |||||
{ | |||||
public class GoodsInfoDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string Name { get; set; } | |||||
public string Descritption { get; set; } | |||||
public string ImgUrl { get; set; } | |||||
public int Sort { get; set; } | |||||
public decimal Price { get; set; } | |||||
public string GoodsUintId { get; set; } | |||||
public string GoodsUintName { get; set; } | |||||
public bool IsWeigh { get; set; } | |||||
public string Design { get; set; } | |||||
public string DefaultMate { get; set; } | |||||
public bool IsAttrubute { get; set; } | |||||
public string GoodsTypeId { get; set; } | |||||
public string GoodsTypeName { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,15 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.Goods | |||||
{ | |||||
public class GoodsTypeDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string Pid { get; set; } | |||||
public string Name { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,14 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.Goods | |||||
{ | |||||
public class GoodsUintDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string Name { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,23 @@ | |||||
using Newtonsoft.Json; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.GoodsTechnology | |||||
{ | |||||
public class GoodsTechnologysDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string StepName { get; set; } | |||||
//[JsonIgnore] | |||||
public string ActionJson { get; set; } | |||||
public string GoodsAttributeId { get; set; } | |||||
public string GoodsId { get; set; } | |||||
public string DeviceId { get; set; } | |||||
public string ChnologyId { get; set; } | |||||
public string Sort { get; set; } | |||||
public string CreateBy { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.GoodsTechnology | |||||
{ | |||||
public class TechnologyDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string Name { get; set; } | |||||
public string DeviceVersionId { get; set; } | |||||
public string ForeignKeyRe { get; set; } | |||||
public DateTime CreateAt { get; set; } | |||||
public List<TechnologyAction> TechnologyActionInfo { get; set; } | |||||
} | |||||
public class TechnologyAction | |||||
{ | |||||
public string Id { get; set; } | |||||
public string TechnologyId { get; set; } | |||||
public string ActionName { get; set; } | |||||
public string ActionValue { get; set; } | |||||
public string ActionType { get; set; } | |||||
public string Unit { get; set; } | |||||
/// <summary> | |||||
/// 工艺模型类型(标识是否物料 1标识物料 0标识其他) | |||||
/// </summary> | |||||
public int TechnologyType { get; set; } | |||||
public DateTime CreateAt { get; set; } | |||||
public int Sort { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,91 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction | |||||
{ | |||||
public class ProductFunctionDto | |||||
{ | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 功能名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
public string DeviceVersionKey { get; set; } | |||||
/// <summary> | |||||
/// 功能类型 0属性1服务2事件 | |||||
/// </summary> | |||||
public string Type { get; set; } | |||||
/// <summary> | |||||
/// 数据类型 | |||||
/// </summary> | |||||
public string DataType { get; set; } | |||||
/// <summary> | |||||
/// 取值范围 | |||||
/// </summary> | |||||
public string DataRange { get; set; } | |||||
/// <summary> | |||||
/// 单位 | |||||
/// </summary> | |||||
public string Unit { get; set; } | |||||
/// <summary> | |||||
/// 步长 | |||||
/// </summary> | |||||
public decimal StepSize { get; set; } | |||||
/// <summary> | |||||
/// 枚举值 | |||||
/// </summary> | |||||
public string EnumValue { get; set; } | |||||
/// <summary> | |||||
/// 数据长度 | |||||
/// </summary> | |||||
public string DataLength { get; set; } | |||||
/// <summary> | |||||
/// 数据类型bool的描述 | |||||
/// </summary> | |||||
public string BoolLabel { get; set; } | |||||
/// <summary> | |||||
/// 读写类型0读写 1只读 | |||||
/// </summary> | |||||
public int ReadWrite { get; set; } | |||||
/// <summary> | |||||
/// 描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
public string ProductId { get; set; } | |||||
public string DataJson { get; set; } | |||||
public bool IsDefault { get; set; } | |||||
public List<ProductFunctionAction> ProductFunctionValue { get; set; } | |||||
} | |||||
public class ProductFunctionAction | |||||
{ | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 功能id | |||||
/// </summary> | |||||
public string ProductFunctionId { get; set; } | |||||
/// <summary> | |||||
/// 动作名称 | |||||
/// </summary> | |||||
public string ActionName { get; set; } | |||||
/// <summary> | |||||
/// 类型 (1 输入框 2下拉框) | |||||
/// </summary> | |||||
public string ActionType { get; set; } | |||||
/// <summary> | |||||
/// 类型值(jsong格式) | |||||
/// </summary> | |||||
public string ActionValue { get; set; } | |||||
/// <summary> | |||||
/// 单位 | |||||
/// </summary> | |||||
public string Unit { get; set; } | |||||
/// <summary> | |||||
/// 排序 | |||||
/// </summary> | |||||
public int Sort { get; set; } | |||||
public bool IsDefault { get; set; } | |||||
} | |||||
} |
@@ -2,9 +2,11 @@ | |||||
using BPA.Message.IOT; | using BPA.Message.IOT; | ||||
using BPA.SAAS.KitChenManage.Application.Device.Dtos; | using BPA.SAAS.KitChenManage.Application.Device.Dtos; | ||||
using BPA.SAAS.KitChenManage.Application.Store.Dtos; | using BPA.SAAS.KitChenManage.Application.Store.Dtos; | ||||
using BPA.SAAS.KitChenManage.Comm.Const; | |||||
using BPA.SAAS.KitChenManage.Core.Base; | using BPA.SAAS.KitChenManage.Core.Base; | ||||
using BPA.SAAS.KitChenManage.Core.Model; | using BPA.SAAS.KitChenManage.Core.Model; | ||||
using Furion.LinqBuilder; | using Furion.LinqBuilder; | ||||
using Furion.RemoteRequest.Extensions; | |||||
using Microsoft.CodeAnalysis.Operations; | using Microsoft.CodeAnalysis.Operations; | ||||
using Microsoft.Extensions.Hosting; | using Microsoft.Extensions.Hosting; | ||||
using MQTTnet; | using MQTTnet; | ||||
@@ -23,6 +25,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services | |||||
{ | { | ||||
private readonly ISqlSugarClient _db; | private readonly ISqlSugarClient _db; | ||||
private readonly IMqttClient _mqttClient; | private readonly IMqttClient _mqttClient; | ||||
RequestParmsHeadlen requestParmsHeadlen = new(); | |||||
public DevicePushRecodeService(ISqlSugarClient db, IMqttClient mqttClient) | public DevicePushRecodeService(ISqlSugarClient db, IMqttClient mqttClient) | ||||
{ | { | ||||
_db = db; | _db = db; | ||||
@@ -67,6 +70,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services | |||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> Add(DevicePushRecodeDtoInput input) | public async Task<bool> Add(DevicePushRecodeDtoInput input) | ||||
{ | { | ||||
var DataResore =await requestParmsHeadlen.GetParm(input.Type, input.Data.ToString(), input.DeviceId); | |||||
var data = input.Adapt<BPA_DevicePushRecode>(); | var data = input.Adapt<BPA_DevicePushRecode>(); | ||||
string topstr = ""; | string topstr = ""; | ||||
string Topic = GetTopic(input.Type, input.DeviceAutoKey.ToString(), input.ProductVersion, input.ProductKey, out topstr); | string Topic = GetTopic(input.Type, input.DeviceAutoKey.ToString(), input.ProductVersion, input.ProductKey, out topstr); | ||||
@@ -74,7 +78,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services | |||||
data.Topic= Topic; | data.Topic= Topic; | ||||
data.Status = 1; | data.Status = 1; | ||||
data.DataResore = JsonConvert.SerializeObject(JsonConvert.DeserializeObject<dynamic>(input.Data.ToString())); | |||||
data.DataResore = JsonConvert.SerializeObject(DataResore); | |||||
data.DeviceAutoKey= input.DeviceAutoKey; | data.DeviceAutoKey= input.DeviceAutoKey; | ||||
data.Description = "成功"; | data.Description = "成功"; | ||||
if (input.TopicsData.Count > 0) | if (input.TopicsData.Count > 0) | ||||
@@ -100,6 +104,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services | |||||
data.Status =2; | data.Status =2; | ||||
} | } | ||||
} | } | ||||
// return true; | |||||
var res = await _db.Insertable(data).CallEntityMethod(t => t.Create()).ExecuteCommandAsync(); | var res = await _db.Insertable(data).CallEntityMethod(t => t.Create()).ExecuteCommandAsync(); | ||||
return res>0; | return res>0; | ||||
} | } | ||||
@@ -0,0 +1,271 @@ | |||||
using BPA.Message; | |||||
using BPA.SAAS.KitChenManage.Application.Device.PushDto.Batching; | |||||
using BPA.SAAS.KitChenManage.Application.Device.PushDto.Goods; | |||||
using BPA.SAAS.KitChenManage.Application.Device.PushDto.GoodsTechnology; | |||||
using BPA.SAAS.KitChenManage.Application.Device.PushDto.ProductFunction; | |||||
using BPA.SAAS.KitChenManage.Comm.Const; | |||||
using BPA.SAAS.KitChenManage.Core.Base; | |||||
using Furion.JsonSerialization; | |||||
using Furion.RemoteRequest.Extensions; | |||||
using Newtonsoft.Json; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Dynamic; | |||||
using System.Linq; | |||||
using System.Reflection; | |||||
using System.Text; | |||||
using System.Text.Json.Serialization; | |||||
using System.Threading.Tasks; | |||||
using System.Xml.Linq; | |||||
namespace BPA.SAAS.KitChenManage.Application | |||||
{ | |||||
public class RequestParmsHeadlen | |||||
{ | |||||
private string BaseServerUrl = App.GetConfig<string>("baseurl"); | |||||
public async Task<dynamic> GetParm(int type,string data,string deviceId) | |||||
{ | |||||
var getProductFunctionurl = BaseServerUrl + "api/productfunction/getproductfunction_alm?deviceId="+ deviceId;//获取商品属性 | |||||
var responseProductFunction = await getProductFunctionurl.SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); | |||||
var resProductFunction = JsonConvert.DeserializeObject<ResponDataBase>(responseProductFunction); | |||||
if (resProductFunction.statusCode != "200") throw Oops.Oh("获取该设备的物模型数据失败"); | |||||
if(resProductFunction.data==null) throw Oops.Oh("找不到设备的物模型配置,请配置相关参数后再试"); | |||||
var dataProductFunction = JsonConvert.DeserializeObject<List<ProductFunctionDto>>(resProductFunction.data.ToString()); | |||||
dynamic obj = null; | |||||
switch (type) | |||||
{ | |||||
case 1: //商品下发 | |||||
var GoodsFunction=dataProductFunction.Where(x => x.Name == "商品数据下发" && x.Type == "1").First(); | |||||
if(GoodsFunction == null) throw Oops.Oh("该设备的物模型还没配置对应功能,请配置相关参数后再试"); | |||||
var GoodsFunctionValue = GoodsFunction.ProductFunctionValue.Where(x => x.IsDefault == true && x.ActionName == "DataSoure").First(); | |||||
if(string.IsNullOrEmpty(GoodsFunctionValue.ActionValue)) throw Oops.Oh("该设备的物模型配置对应功能参数没有配置,请配置相关参数后再试"); | |||||
obj = await GetGoods(data, GoodsFunctionValue.ActionValue); | |||||
break; | |||||
case 2://物料下发 | |||||
var BatchingFunction = dataProductFunction.Where(x => x.Name == "物料数据下发" && x.Type == "1").First(); | |||||
if (BatchingFunction == null) throw Oops.Oh("该设备的物模型还没配置对应功能,请配置相关参数后再试"); | |||||
var BatchingFunctionValue = BatchingFunction.ProductFunctionValue.Where(x => x.IsDefault==true && x.ActionName == "DataSoure").First(); | |||||
if (string.IsNullOrEmpty(BatchingFunctionValue.ActionValue)) throw Oops.Oh("该设备的物模型配置对应功能参数没有配置,请配置相关参数后再试"); | |||||
obj =await GetBatching(data, BatchingFunctionValue.ActionValue); | |||||
break; | |||||
case 4: | |||||
var TechnologyFunction = dataProductFunction.Where(x => x.Name == "工艺数据下发" && x.Type == "1").First(); | |||||
if (TechnologyFunction == null) throw Oops.Oh("该设备的物模型还没配置对应功能,请配置相关参数后再试"); | |||||
var TechnologyFunctionValue = TechnologyFunction.ProductFunctionValue.Where(x => x.IsDefault == true && x.ActionName == "DataSoure").First(); | |||||
if (string.IsNullOrEmpty(TechnologyFunctionValue.ActionValue)) throw Oops.Oh("该设备的物模型配置对应功能参数没有配置,请配置相关参数后再试"); | |||||
obj = await GetGoodsTechnology(data, deviceId,TechnologyFunctionValue.ActionValue); | |||||
break; | |||||
} | |||||
return obj; | |||||
} | |||||
private async Task<dynamic> GetGoods(string data, string productFunctionData) | |||||
{ | |||||
try | |||||
{ | |||||
//商品信息 | |||||
var goodsData = JsonConvert.DeserializeObject<List<GoodsInfoDto>>(data); | |||||
var cpjson = productFunctionData.Replace("\r", "").Replace("\n", "").Replace("\t", ""); | |||||
var DynamicObject = JsonConvert.DeserializeObject<dynamic>(cpjson); | |||||
//商品信息 | |||||
if (IsPropertyExist(DynamicObject, ProductParametersConst_Goods.goodsinfo)) | |||||
{ | |||||
var goodsinfo = GetDynamic(goodsData, DynamicObject.goodsinfo[0]); | |||||
DynamicObject.goodsinfo = JsonConvert.DeserializeObject<dynamic>(JsonConvert.SerializeObject(goodsinfo)); | |||||
} | |||||
//商品属性 | |||||
if (IsPropertyExist(DynamicObject, ProductParametersConst_Goods.goodsAttribute)) | |||||
{ | |||||
//获取商品属性 | |||||
var getGoodsAttributeurl = BaseServerUrl + "api/goodsattribute/getgoodsattributelist_alm";//获取商品属性 | |||||
var responseGoodsAttribute = await getGoodsAttributeurl.SetHeaders(new | |||||
{ | |||||
groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value | |||||
}).SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); | |||||
var resGoodsAttribute = JsonConvert.DeserializeObject<ResponDataBase>(responseGoodsAttribute); | |||||
if (resGoodsAttribute.statusCode != "200") throw Oops.Oh("获取商品属性数据失败"); | |||||
var dataGoodsAttribute = JsonConvert.DeserializeObject<List<GoodsAttributeDto>>(resGoodsAttribute.data.ToString()); | |||||
var goodsAttribute = GetDynamic(dataGoodsAttribute, DynamicObject.goodsAttribute[0]); | |||||
DynamicObject.goodsAttribute = JsonConvert.DeserializeObject<dynamic>(JsonConvert.SerializeObject(goodsAttribute)); | |||||
} | |||||
//商品单位 | |||||
if (IsPropertyExist(DynamicObject, ProductParametersConst_Goods.goodsUnitInfo)) | |||||
{ | |||||
//获商品单位 | |||||
var getGoodsUinturl = BaseServerUrl + "api/goods/getgoodsuintlist_alm";//获商品单位 | |||||
var responseGoodsUint = await getGoodsUinturl.SetHeaders(new | |||||
{ | |||||
groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value | |||||
}).SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); | |||||
var resGoodsUint = JsonConvert.DeserializeObject<ResponDataBase>(responseGoodsUint); | |||||
if (resGoodsUint.statusCode != "200") throw Oops.Oh("获取商品单位数据失败"); | |||||
var dataGoodsUint = JsonConvert.DeserializeObject<List<GoodsUintDto>>(resGoodsUint.data.ToString()); | |||||
var goodsUnitInfo = GetDynamic(dataGoodsUint, DynamicObject.goodsUnitInfo[0]); | |||||
DynamicObject.goodsUnitInfo = JsonConvert.DeserializeObject<dynamic>(JsonConvert.SerializeObject(goodsUnitInfo)); | |||||
} | |||||
//商品分类 | |||||
if (IsPropertyExist(DynamicObject, ProductParametersConst_Goods.goodsTypeInfo)) | |||||
{ | |||||
//获取商品分类 | |||||
var getGoodsTypeturl = BaseServerUrl + "api/goodstype/getgoodstypelist_alm";//获取商品分类 | |||||
var responseGoodsType = await getGoodsTypeturl.SetHeaders(new | |||||
{ | |||||
groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value | |||||
}).SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); | |||||
var resGoodsType = JsonConvert.DeserializeObject<ResponDataBase>(responseGoodsType); | |||||
if (resGoodsType.statusCode != "200") throw Oops.Oh("获取商品分类数据失败"); | |||||
var dataGoodsType = JsonConvert.DeserializeObject<List<GoodsTypeDto>>(resGoodsType.data.ToString()); | |||||
var goodsTypeInfo = GetDynamic(dataGoodsType, DynamicObject.goodsTypeInfo[0]); | |||||
DynamicObject.goodsTypeInfo = JsonConvert.DeserializeObject<dynamic>(JsonConvert.SerializeObject(goodsTypeInfo)); | |||||
} | |||||
return DynamicObject; | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
throw Oops.Oh("解析数据失败"); | |||||
} | |||||
} | |||||
private async Task<dynamic> GetBatching(string data,string productFunctionData) | |||||
{ | |||||
try | |||||
{ | |||||
var cpjson = productFunctionData.Replace("\r", "").Replace("\n", "").Replace("\t", ""); | |||||
var DynamicObject = JsonConvert.DeserializeObject<dynamic>(cpjson); | |||||
if (IsPropertyExist(DynamicObject, ProductParametersConst_Batching.batchinginfo)) | |||||
{ | |||||
//物料信息 | |||||
var batchingData = JsonConvert.DeserializeObject<List<BatchingDto>>(data); | |||||
var batchinginfo = GetDynamic(batchingData, DynamicObject.batchinginfo[0]); | |||||
DynamicObject.batchinginfo = JsonConvert.DeserializeObject<dynamic>(JsonConvert.SerializeObject(batchinginfo)); | |||||
} | |||||
if (IsPropertyExist(DynamicObject, ProductParametersConst_Batching.batchingTypeinfo)) | |||||
{ | |||||
//获取物料分类 | |||||
var getTypeurl = BaseServerUrl + "api/batching/getbatchingtypelist_alm";//获取物料分类 | |||||
var responseType = await getTypeurl.SetHeaders(new | |||||
{ | |||||
groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value | |||||
}).SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); | |||||
var resType = JsonConvert.DeserializeObject<ResponDataBase>(responseType); | |||||
if (resType.statusCode != "200") throw Oops.Oh("获取物料分类数据失败"); | |||||
var dataType = JsonConvert.DeserializeObject<List<BatchingTypeDto>>(resType.data.ToString()); | |||||
var batchingTypeinfo = GetDynamic(dataType, DynamicObject.batchingTypeinfo[0]); | |||||
DynamicObject.batchingTypeinfo = JsonConvert.DeserializeObject<dynamic>(JsonConvert.SerializeObject(batchingTypeinfo)); | |||||
} | |||||
if (IsPropertyExist(DynamicObject, ProductParametersConst_Batching.batchingUnitinfo)) | |||||
{ | |||||
//获取物料单位 | |||||
var getuinurl = BaseServerUrl + "api/batching/getbatchinguintList_alm";//获取物料单位 | |||||
var responseUnit = await getuinurl.SetHeaders(new | |||||
{ | |||||
groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value | |||||
}).SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); | |||||
var resUnit = JsonConvert.DeserializeObject<ResponDataBase>(responseUnit); | |||||
if (resUnit.statusCode != "200") throw Oops.Oh("获取物料单位数据失败"); | |||||
var dataUnit = JsonConvert.DeserializeObject<List<BatchingUintDto>>(resUnit.data.ToString()); | |||||
var batchingUnitinfo = GetDynamic(dataUnit, DynamicObject.batchingUnitinfo[0]); | |||||
DynamicObject.batchingUnitinfo = JsonConvert.DeserializeObject<dynamic>(JsonConvert.SerializeObject(batchingUnitinfo)); | |||||
} | |||||
return DynamicObject; | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
throw Oops.Oh("解析数据失败"); | |||||
} | |||||
} | |||||
private async Task<dynamic> GetGoodsTechnology(string data,string deviceId, string productFunctionData) | |||||
{ | |||||
try | |||||
{ | |||||
//商品工艺信息 | |||||
var goodsTechnologData = JsonConvert.DeserializeObject<List<GoodsTechnologysDto>>(data); | |||||
var cpjson = productFunctionData.Replace("\r", "").Replace("\n", "").Replace("\t", ""); | |||||
var DynamicObject = JsonConvert.DeserializeObject<dynamic>(cpjson); | |||||
if (IsPropertyExist(DynamicObject, ProductParametersConst_Technology.technologysInfo)) | |||||
{ | |||||
//获取工艺基础信息 | |||||
var gettechnologurl = BaseServerUrl + "api/technology/gettechnologylist_alm?deviceId=" + deviceId;//获取工艺基础信息 | |||||
var responsegetTechnologurl = await gettechnologurl.SetHeaders(new | |||||
{ | |||||
groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value | |||||
}).SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); | |||||
var resTechnolog = JsonConvert.DeserializeObject<ResponDataBase>(responsegetTechnologurl); | |||||
if (resTechnolog.statusCode != "200") throw Oops.Oh("获取工艺基础信息数据失败"); | |||||
var dataTechnolog = JsonConvert.DeserializeObject<List<TechnologyDto>>(resTechnolog.data.ToString()); | |||||
var technologysInfo = GetDynamic(dataTechnolog, DynamicObject.technologysInfo[0]); | |||||
DynamicObject.technologysInfo = JsonConvert.DeserializeObject<dynamic>(JsonConvert.SerializeObject(technologysInfo)); | |||||
} | |||||
if (IsPropertyExist(DynamicObject, ProductParametersConst_Technology.goodsTechnologysInfo)) | |||||
{ | |||||
var goodsTechnologysInfo = GetDynamic(goodsTechnologData, DynamicObject.goodsTechnologysInfo[0]); | |||||
DynamicObject.goodsTechnologysInfo = JsonConvert.DeserializeObject<dynamic>(JsonConvert.SerializeObject(goodsTechnologysInfo)); | |||||
} | |||||
return DynamicObject; | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
throw Oops.Oh("解析数据失败"); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 映射数据 | |||||
/// </summary> | |||||
/// <param name="data1"></param> | |||||
/// <param name="data2"></param> | |||||
/// <returns></returns> | |||||
private List<Dictionary<string, object>> GetDynamic(dynamic data1, dynamic data2) | |||||
{ | |||||
List<Dictionary<string, object>> objws = new(); | |||||
foreach (var item in data1) | |||||
{ | |||||
PropertyInfo[] properties = item.GetType().GetProperties(); // 获取所有公共属性 | |||||
Dictionary<string, object> objw = new(); | |||||
foreach (var property in properties) | |||||
{ | |||||
object value = property.GetValue(item); | |||||
foreach (var property1 in data2) | |||||
{ | |||||
if (property.Name.ToLower() == property1?.Name?.ToLower()) | |||||
{ | |||||
Type dataType = property.PropertyType; | |||||
if (dataType.IsGenericType) | |||||
{ | |||||
var sd = data2[property1.Name][0]; | |||||
objw.Add(property1.Name, GetDynamic(value, sd)); | |||||
} | |||||
else | |||||
{ | |||||
objw.Add(property1.Name, value); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
objws.Add(objw); | |||||
} | |||||
return objws; | |||||
} | |||||
/// <summary> | |||||
/// 验证属性是否存在 | |||||
/// </summary> | |||||
/// <param name="data"></param> | |||||
/// <param name="propertyname"></param> | |||||
/// <returns></returns> | |||||
private bool IsPropertyExist(dynamic data, string propertyname) | |||||
{ | |||||
var check = false; | |||||
var sd = data.GetType().GetProperty(propertyname); | |||||
foreach (var property1 in data) | |||||
{ | |||||
if (property1.Name == propertyname) check= true; | |||||
} | |||||
return check; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,18 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Comm.Const | |||||
{ | |||||
/// <summary> | |||||
/// 产品物模型对应的服务参数常量 | |||||
/// </summary> | |||||
public class ProductParametersConst_Batching | |||||
{ | |||||
public const string batchinginfo = "batchinginfo"; | |||||
public const string batchingTypeinfo = "batchingTypeinfo"; | |||||
public const string batchingUnitinfo = "batchingUnitinfo"; | |||||
} | |||||
} |
@@ -0,0 +1,19 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Comm.Const | |||||
{ | |||||
/// <summary> | |||||
/// 产品物模型对应的服务参数常量 | |||||
/// </summary> | |||||
public class ProductParametersConst_Goods | |||||
{ | |||||
public const string goodsinfo = "goodsinfo"; | |||||
public const string goodsAttribute = "goodsAttribute"; | |||||
public const string goodsUnitInfo = "goodsUnitInfo"; | |||||
public const string goodsTypeInfo = "goodsTypeInfo"; | |||||
} | |||||
} |
@@ -0,0 +1,17 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Comm.Const | |||||
{ | |||||
/// <summary> | |||||
/// 产品物模型对应的服务参数常量 | |||||
/// </summary> | |||||
public class ProductParametersConst_Technology | |||||
{ | |||||
public const string technologysInfo = "technologysInfo"; | |||||
public const string goodsTechnologysInfo = "goodsTechnologysInfo"; | |||||
} | |||||
} |
@@ -0,0 +1,16 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.SAAS.KitChenManage.Core.Base | |||||
{ | |||||
public class ResponDataBase | |||||
{ | |||||
public string statusCode { get; set; } | |||||
public object data { get; set; } | |||||
public string succeeded { get; set; } | |||||
public string errors { get; set; } | |||||
} | |||||
} |
@@ -51,6 +51,7 @@ namespace BPA.SAAS.KitChenManage.Web.Core | |||||
}); | }); | ||||
// services.GetService<IMqttClientOptions>(); | // services.GetService<IMqttClientOptions>(); | ||||
services.AddCorsAccessor(); | services.AddCorsAccessor(); | ||||
services.AddRemoteRequest(); | |||||
services.AddSqlsugarSetup(App.Configuration); | services.AddSqlsugarSetup(App.Configuration); | ||||
services.AddControllers() | services.AddControllers() | ||||
.AddInjectWithUnifyResult(); | .AddInjectWithUnifyResult(); | ||||
@@ -8,6 +8,7 @@ | |||||
} | } | ||||
}, | }, | ||||
"AllowedHosts": "*", | "AllowedHosts": "*", | ||||
"baseurl": "http://localhost:5006/", | |||||
"ConnectionConfigs": [ | "ConnectionConfigs": [ | ||||
{ | { | ||||
"ConnectionString": "server=10.2.1.21;Database=bpa_kitchen_kitchenmanage;Uid=root;Pwd=cygadmin;Allow Zero Datetime=True;Convert Zero Datetime=True;", | "ConnectionString": "server=10.2.1.21;Database=bpa_kitchen_kitchenmanage;Uid=root;Pwd=cygadmin;Allow Zero Datetime=True;Convert Zero Datetime=True;", | ||||