diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs index 54ca50f..1f92c82 100644 --- a/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs +++ b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs @@ -1,4 +1,5 @@ -using System; +using BPA.SAAS.KitChenManage.Application.Device.Dtos; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,6 +7,21 @@ using System.Threading.Tasks; namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dtos { + public class ResultGoodsAndDeviceResultDto + { + public int statusCode { get; set; } + + public GoodsAndDeviceResultDto data { get; set; } + + public string succeeded { get; set; } + + public string errors { get; set; } + + public string extras { get; set; } + + public int timestamp { get; set; } + } + public class ResultGoodsResultDto { public int statusCode { get; set; } @@ -21,6 +37,27 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dt public int timestamp { get; set; } } + public class ResultDeviceResultDto + { + public int statusCode { get; set; } + + public DeviceInfoQueryDto data { get; set; } + + public string succeeded { get; set; } + + public string errors { get; set; } + + public string extras { get; set; } + + public int timestamp { get; set; } + } + + public class GoodsAndDeviceResultDto + { + public List GoodsInfoList { get; set; } + public DeviceInfoQueryDto DeviceInfo { get;set; } + } + public class GoodsTypeResultDto { public string GoodsTypeId { get; set; } @@ -31,6 +68,7 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dt public List GoodsAttributeList { get; set; } public List GoodsInfoList { get; set; } + } diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs index 39d7cd6..8e37c61 100644 --- a/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs +++ b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs @@ -1,6 +1,7 @@ using BPA.Models.SqlEntity.BPA_Kitchen; using BPA.SAAS.KitChenManage.Application.AExternalPlatform.BaseDto; using BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dtos; +using BPA.SAAS.KitChenManage.Application.Device.Dtos; using BPA.SAAS.KitChenManage.Comm.Tool; using BPA.SAAS.KitChenManage.Core.Model; using Newtonsoft.Json; @@ -27,13 +28,13 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Se /// /// [HttpPost("/api/goods/Getdevicegoods")] - public async Task GetDeviceGoods(string deviceId) + public async Task GetDeviceGoods(string deviceId) { var goodsId = await _db.Queryable() .Where(x => x.AutoKey.ToString()==deviceId) .Select(x => x.GoodsId) .ToListAsync(); - var data = await GetDeviceGoodspost(goodsId); + var data = await GetDeviceGoodspost(goodsId, deviceId); return data; } @@ -41,28 +42,31 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Se /// /// 获取商品信息 /// - /// + /// + /// /// - public async Task GetDeviceGoodspost(List goodsList) + public async Task GetDeviceGoodspost(List goodsList, string autoKey) { try { - - + var result = new ResultGoodsAndDeviceResultDto { statusCode = 200, data = new GoodsAndDeviceResultDto(), succeeded = "true" }; Dictionary dic = new Dictionary(); - var url = App.Configuration["baseurl"] + "api/goods/GetGoodsListByIds"; - var inputData = JsonConvert.SerializeObject(goodsList); - var jsonData = HttpHelper.PostData(url, inputData, Encoding.UTF8, "application/json", dic); - var data = JsonConvert.DeserializeObject(jsonData); - return data; + var goodsUrl = App.Configuration["baseurl"] + "api/goods/GetGoodsListByIds"; + var goodsInputData = JsonConvert.SerializeObject(goodsList); + var goodsJsonData = HttpHelper.PostData(goodsUrl, goodsInputData, Encoding.UTF8, "application/json", dic); + var goodsData = JsonConvert.DeserializeObject(goodsJsonData); + result.data.GoodsInfoList = goodsData?.data; + var deviceUrl = App.Configuration["baseurl"] + "api/device/getDeviceInfoByDeviceId"; + var deviceInputData = JsonConvert.SerializeObject(autoKey); + var deviceJsonData = HttpHelper.HttpGet(deviceUrl, $"?autoKey={autoKey}", dic, "application/json"); + var deviceData = JsonConvert.DeserializeObject(deviceJsonData); + result.data.DeviceInfo = deviceData?.data; + return result; } catch (Exception ex) { - - throw Oops.Oh("获取商品失败"); + throw Oops.Oh("商品信息或设备信息获取失败"); } - - } } } diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/IGoodsServices.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/IGoodsServices.cs index 883d133..a773437 100644 --- a/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/IGoodsServices.cs +++ b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/IGoodsServices.cs @@ -13,6 +13,6 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Se /// 获取设备物料信息 /// /// - Task GetDeviceGoods(string deviceId); + Task GetDeviceGoods(string deviceId); } } diff --git a/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml b/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml index 4878d80..18e21c9 100644 --- a/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml +++ b/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml @@ -206,11 +206,12 @@ - + 获取商品信息 - + + @@ -405,6 +406,51 @@ AutoKey + + + 设备名称 + + + + + 设备标签 + + + + + 归属场景(店铺) + + + + + 所属产品 + + + + + 所属产品名称 + + + + + 所属产品标签 + + + + + 设备AutoKey 唯一用于mqtt消息推送标识 + + + + + 设备版本 + + + + + 地址 + + Topics类 diff --git a/BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs b/BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs index b28c40d..4d95c56 100644 --- a/BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs +++ b/BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs @@ -24,4 +24,53 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Dtos public string GoodsName { get; set; } } + + public class DeviceInfoQueryDto + { + public string Id { get; set; } + /// + /// 设备名称 + /// + public string DeviceName { get; set; } + + /// + /// 设备标签 + /// + public string DeviceTypeId { get; set; } + /// + ///归属场景(店铺) + /// + public string OrgId { get; set; } + /// + /// 所属产品 + /// + public string ProductId { get; set; } + /// + /// 所属产品名称 + /// + public string ProductName { get; set; } + /// + /// 所属产品标签 + /// + public string ProductCode { get; set; } + /// + /// 设备AutoKey 唯一用于mqtt消息推送标识 + /// + [SugarColumn(IsOnlyIgnoreInsert = true, IsOnlyIgnoreUpdate = true, IsIdentity = true)] + public int AutoKey { get; set; } + /// + /// 设备版本 + /// + public string ProductVersionId { get; set; } + public string OrgKey { get; set; } + public string ProductVersionName { get; set; } + public int TechnologyOrBom { get; set; } + public string GroupId { get; set; } + public string StopId { get; set; } + public string StopName { get; set; } + /// + /// 地址 + /// + public string Address { get; set; } + } } diff --git a/BPA.SAAS.KitChenManage.Web.Entry/Properties/launchSettings.json b/BPA.SAAS.KitChenManage.Web.Entry/Properties/launchSettings.json index 3f770f4..8f67248 100644 --- a/BPA.SAAS.KitChenManage.Web.Entry/Properties/launchSettings.json +++ b/BPA.SAAS.KitChenManage.Web.Entry/Properties/launchSettings.json @@ -22,7 +22,7 @@ "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "", - "applicationUrl": "http://192.168.1.50:5007", + "applicationUrl": "http://localhost:5007", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/BPA.SAAS.KitChenManage.Web.Entry/appsettings.json b/BPA.SAAS.KitChenManage.Web.Entry/appsettings.json index 9737ce0..89e109c 100644 --- a/BPA.SAAS.KitChenManage.Web.Entry/appsettings.json +++ b/BPA.SAAS.KitChenManage.Web.Entry/appsettings.json @@ -8,7 +8,7 @@ } }, "AllowedHosts": "*", - "baseurl": "http://192.168.1.50:5006/", + "baseurl": "http://localhost:5006/", "ConnectionConfigs": [ { "ConnectionString": "server=10.2.1.21;Database=bpa_kitchen_kitchenmanage;Uid=root;Pwd=cygadmin;Allow Zero Datetime=True;Convert Zero Datetime=True;",