Ver código fonte

给app端获取商品信息接口添加设备信息20240628

master
gwbvipvip 4 meses atrás
pai
commit
6c97990131
7 arquivos alterados com 158 adições e 21 exclusões
  1. +39
    -1
      BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs
  2. +19
    -15
      BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs
  3. +1
    -1
      BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/IGoodsServices.cs
  4. +48
    -2
      BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml
  5. +49
    -0
      BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs
  6. +1
    -1
      BPA.SAAS.KitChenManage.Web.Entry/Properties/launchSettings.json
  7. +1
    -1
      BPA.SAAS.KitChenManage.Web.Entry/appsettings.json

+ 39
- 1
BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs Ver arquivo

@@ -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<GoodsTypeResultDto> 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<GoodsAttributeResultDto> GoodsAttributeList { get; set; }

public List<GoodsInfoResultDto> GoodsInfoList { get; set; }

}




+ 19
- 15
BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs Ver arquivo

@@ -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
/// </summary>
/// <returns></returns>
[HttpPost("/api/goods/Getdevicegoods")]
public async Task<ResultGoodsResultDto> GetDeviceGoods(string deviceId)
public async Task<ResultGoodsAndDeviceResultDto> GetDeviceGoods(string deviceId)
{
var goodsId = await _db.Queryable<BPA_DeviceGoods>()
.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
/// <summary>
/// 获取商品信息
/// </summary>
/// <param name="id"></param>
/// <param name="goodsList"></param>
/// <param name="autoKey"></param>
/// <returns></returns>
public async Task<ResultGoodsResultDto> GetDeviceGoodspost(List<string> goodsList)
public async Task<ResultGoodsAndDeviceResultDto> GetDeviceGoodspost(List<string> goodsList, string autoKey)
{
try
{


var result = new ResultGoodsAndDeviceResultDto { statusCode = 200, data = new GoodsAndDeviceResultDto(), succeeded = "true" };
Dictionary<string, string> dic = new Dictionary<string, string>();
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<ResultGoodsResultDto>(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<ResultGoodsResultDto>(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<ResultDeviceResultDto>(deviceJsonData);
result.data.DeviceInfo = deviceData?.data;
return result;
}
catch (Exception ex)
{

throw Oops.Oh("获取商品失败");
throw Oops.Oh("商品信息或设备信息获取失败");
}


}
}
}

+ 1
- 1
BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/IGoodsServices.cs Ver arquivo

@@ -13,6 +13,6 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Se
/// 获取设备物料信息
/// </summary>
/// <returns></returns>
Task<ResultGoodsResultDto> GetDeviceGoods(string deviceId);
Task<ResultGoodsAndDeviceResultDto> GetDeviceGoods(string deviceId);
}
}

+ 48
- 2
BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml Ver arquivo

@@ -206,11 +206,12 @@
</summary>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Services.Goods.GetDeviceGoodspost(System.Collections.Generic.List{System.String})">
<member name="M:BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Services.Goods.GetDeviceGoodspost(System.Collections.Generic.List{System.String},System.String)">
<summary>
获取商品信息
</summary>
<param name="id"></param>
<param name="goodsList"></param>
<param name="autoKey"></param>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Services.IGoodsServices.GetDeviceGoods(System.String)">
@@ -405,6 +406,51 @@
AutoKey
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.DeviceInfoQueryDto.DeviceName">
<summary>
设备名称
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.DeviceInfoQueryDto.DeviceTypeId">
<summary>
设备标签
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.DeviceInfoQueryDto.OrgId">
<summary>
归属场景(店铺)
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.DeviceInfoQueryDto.ProductId">
<summary>
所属产品
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.DeviceInfoQueryDto.ProductName">
<summary>
所属产品名称
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.DeviceInfoQueryDto.ProductCode">
<summary>
所属产品标签
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.DeviceInfoQueryDto.AutoKey">
<summary>
设备AutoKey 唯一用于mqtt消息推送标识
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.DeviceInfoQueryDto.ProductVersionId">
<summary>
设备版本
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.DeviceInfoQueryDto.Address">
<summary>
地址
</summary>
</member>
<member name="P:BPA.SAAS.KitChenManage.Application.Device.Dtos.ProductTopics.Topics">
<summary>
Topics类


+ 49
- 0
BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs Ver arquivo

@@ -24,4 +24,53 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Dtos

public string GoodsName { get; set; }
}

public class DeviceInfoQueryDto
{
public string Id { get; set; }
/// <summary>
/// 设备名称
/// </summary>
public string DeviceName { get; set; }

/// <summary>
/// 设备标签
/// </summary>
public string DeviceTypeId { get; set; }
/// <summary>
///归属场景(店铺)
/// </summary>
public string OrgId { get; set; }
/// <summary>
/// 所属产品
/// </summary>
public string ProductId { get; set; }
/// <summary>
/// 所属产品名称
/// </summary>
public string ProductName { get; set; }
/// <summary>
/// 所属产品标签
/// </summary>
public string ProductCode { get; set; }
/// <summary>
/// 设备AutoKey 唯一用于mqtt消息推送标识
/// </summary>
[SugarColumn(IsOnlyIgnoreInsert = true, IsOnlyIgnoreUpdate = true, IsIdentity = true)]
public int AutoKey { get; set; }
/// <summary>
/// 设备版本
/// </summary>
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; }
/// <summary>
/// 地址
/// </summary>
public string Address { get; set; }
}
}

+ 1
- 1
BPA.SAAS.KitChenManage.Web.Entry/Properties/launchSettings.json Ver arquivo

@@ -22,7 +22,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "",
"applicationUrl": "http://192.168.1.50:5007",
"applicationUrl": "http://localhost:5007",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}


+ 1
- 1
BPA.SAAS.KitChenManage.Web.Entry/appsettings.json Ver arquivo

@@ -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;",


Carregando…
Cancelar
Salvar