From 8439926f6d7db9c38db7108c7f9896f888c14b6a Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Tue, 27 Feb 2024 16:47:39 +0800 Subject: [PATCH] z --- .../Device/Dtos/Device/DeviceInfoBaseDto.cs | 2 +- .../Device/Dtos/Device/DeviceInfoQueryDto.cs | 2 ++ .../Device/Dtos/Device/StoreDto.cs | 21 +++++++++++++++++++ .../Device/Services/DeviceService.cs | 20 +++++++++++++++--- BPA.SAAS.Manage.Core/Base/ResponDataBase.cs | 16 ++++++++++++++ BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs | 2 +- BPA.SAAS.Manage.Web.Entry/appsettings.json | 1 + 7 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 BPA.SAAS.Manage.Application/Device/Dtos/Device/StoreDto.cs create mode 100644 BPA.SAAS.Manage.Core/Base/ResponDataBase.cs diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs index 689b58f..2717cb1 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs @@ -22,7 +22,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device /// ///归属场景(店铺) /// - public string OrgId { get; set; } + public string StopId { get; set; } /// /// 所属产品 /// diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoQueryDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoQueryDto.cs index aaea1cf..fae9dce 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoQueryDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoQueryDto.cs @@ -48,5 +48,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device public string OrgKey { get; set; } public string ProductVersionName { get; set; } public int TechnologyOrBom { get; set; } + public string StopId { get; set; } + public string StopName { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/StoreDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/StoreDto.cs new file mode 100644 index 0000000..058b85d --- /dev/null +++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/StoreDto.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.Device.Dtos.Device +{ + public class StoreDto + { + public string Id { get; set; } + public string Name { get; set; } + public string OrgId { get; set; } + public string OrgName { get; set; } + public string Phone { get; set; } + public int Sort { get; set; } + public string Description { get; set; } + public string GroupId { get; set; } + public DateTime CreateAt { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs b/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs index d661468..9cc7eeb 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs @@ -1,4 +1,5 @@ -using BPA.SAAS.Manage.Application.Device.Dtos.Device; +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute; +using BPA.SAAS.Manage.Application.Device.Dtos.Device; using BPA.SAAS.Manage.Application.Device.Interface; using BPA.SAAS.Manage.Comm.Const; using BPA.SAAS.Manage.Comm.Enum; @@ -10,6 +11,8 @@ using BPA.SAAS.Manage.Core.Org; using BPA.SAAS.Manage.Core.Product; using BPA.SAAS.Manage.Core.system; using Dm; +using Furion.RemoteRequest.Extensions; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -20,6 +23,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services { public class DeviceService: IDeviceService, ITransient { + private string BaseServerUrl=App.GetConfig("baseurl"); ISqlSugarClient _db; public DeviceService(ISqlSugarClient db) { @@ -32,10 +36,18 @@ namespace BPA.SAAS.Manage.Application.Device.Services /// public async Task GetDeviceInfoPage(DeviceQueryInputDto inputDto) { + var getStoreurl = BaseServerUrl + "api/goodsattribute/getstorelist_alm";//获取商品属性 + var responseGoodsAttribute = await getStoreurl.SetHeaders(new + { + groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value + }).SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); + var resStore = JsonConvert.DeserializeObject(responseGoodsAttribute); + if (resStore.statusCode != "200") throw Oops.Oh("获取场景数据失败"); + var dataStore = JsonConvert.DeserializeObject>(resStore.data.ToString()); RefAsync total =0; var data = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.ProductId == b.Id)) - .WhereIF(!string.IsNullOrWhiteSpace(inputDto.StoreId), (a, b) => a.OrgId == inputDto.StoreId) + .WhereIF(!string.IsNullOrWhiteSpace(inputDto.StoreId), (a, b) => a.StopId == inputDto.StoreId) .WhereIF(!string.IsNullOrWhiteSpace(inputDto.DeviceName), (a, b) => a.DeviceName.Contains(inputDto.DeviceName)) .WhereIF(!string.IsNullOrWhiteSpace(inputDto.DeviceTypeId), (a, b) => a.DeviceTypeId == inputDto.DeviceTypeId) .OrderBy((a, b) => a.CreateAt, OrderByType.Desc) @@ -44,12 +56,14 @@ namespace BPA.SAAS.Manage.Application.Device.Services Id = a.Id.SelectAll(), ProductName=b.Name, ProductCode=b.Code, + StopId=a.StopId, ProductVersionName = "" }) .Mapper(x => { var Vesion = _db.Queryable().Where(c => c.Id == x.ProductVersionId).First(); x.ProductVersionName = Vesion?.Vesion; + x.StopName= dataStore?.Where(f=>f.Id==x.StopId).First()?.Name; }) .ToPageListAsync(inputDto.Current, inputDto.PageSize, total); return new PageUtil() @@ -123,7 +137,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services { x.DeviceName, x.DeviceTypeId, - x.OrgId, + x.StopId, x.ProductId, x.ProductCode, x.Status, diff --git a/BPA.SAAS.Manage.Core/Base/ResponDataBase.cs b/BPA.SAAS.Manage.Core/Base/ResponDataBase.cs new file mode 100644 index 0000000..4c39606 --- /dev/null +++ b/BPA.SAAS.Manage.Core/Base/ResponDataBase.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.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; } + } +} diff --git a/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs b/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs index da38115..4adb298 100644 --- a/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs +++ b/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs @@ -26,7 +26,7 @@ namespace BPA.SAAS.Manage.Core.Device /// ///归属场景(店铺) /// - public string OrgId { get; set; } + public string StopId { get; set; } /// /// 所属产品 /// diff --git a/BPA.SAAS.Manage.Web.Entry/appsettings.json b/BPA.SAAS.Manage.Web.Entry/appsettings.json index 3be042f..38a40c9 100644 --- a/BPA.SAAS.Manage.Web.Entry/appsettings.json +++ b/BPA.SAAS.Manage.Web.Entry/appsettings.json @@ -8,6 +8,7 @@ } }, "AllowedHosts": "*", + "baseurl": "http://192.168.1.19:5008/", "ConnectionConfigs": [ { "ConnectionString": "server=10.2.1.21;Database=bpa_kitchen_kitchenbasemanage;Uid=root;Pwd=cygadmin;Allow Zero Datetime=True;Convert Zero Datetime=True;",