From 0d737951ab8444b8c1f8886a95321022775d3246 Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Wed, 17 Apr 2024 17:11:54 +0800 Subject: [PATCH 1/3] z --- .../Device/DevicePushRecodeServices.cs | 4 ++-- .../Device/Services/DevicePushRecodeService.cs | 15 ++++----------- .../Device/Services/IDevicePushRecodeService.cs | 2 +- .../Properties/launchSettings.json | 2 +- BPA.SAAS.KitChenManage.Web.Entry/appsettings.json | 2 +- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/BPA.SAAS.KitChenManage.Application/Device/DevicePushRecodeServices.cs b/BPA.SAAS.KitChenManage.Application/Device/DevicePushRecodeServices.cs index 4c34bf7..d855a6f 100644 --- a/BPA.SAAS.KitChenManage.Application/Device/DevicePushRecodeServices.cs +++ b/BPA.SAAS.KitChenManage.Application/Device/DevicePushRecodeServices.cs @@ -17,9 +17,9 @@ namespace BPA.SAAS.KitChenManage.Application.Device { _devicePushRecodeService= devicePushRecodeService; } - public async Task Test() + public async Task Test() { - return await _devicePushRecodeService.Test(); + await _devicePushRecodeService.Test(); } /// /// 分页 diff --git a/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs b/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs index 888aa61..c31c431 100644 --- a/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs +++ b/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs @@ -42,18 +42,11 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services _mqttClient=mqttClient; mqttServer = new(mqttClient); } - public async Task Test() + public async Task Test() { - var getGoodsAttributeurl = "http://localhost:5009/api/ExternalPlatform/Goods/GetGoodsPageList";//获取商品属性 - var key = "47e5c071-6283-4d9d-8dcb-36ba95aa8db9"; - var str = "current=1&pageSize=10&"+ key; - var sign = MD5Encryption.Encrypt(str.ToUpper()); - var respon = await getGoodsAttributeurl.SetHeaders(new - { - sign= sign, - key = key - }).SetHttpMethod(HttpMethod.Get).SetBody("{\"current\":1,\"pageSize\":10}", "application/json").PostAsStringAsync(); - return respon; + string Topic = "2222"; + var sd=await mqttServer.Publish(Topic, new PushData() { Data = "123456"}, "1"); + //return respon; } /// /// 分页 diff --git a/BPA.SAAS.KitChenManage.Application/Device/Services/IDevicePushRecodeService.cs b/BPA.SAAS.KitChenManage.Application/Device/Services/IDevicePushRecodeService.cs index 2ed832a..6c6d85d 100644 --- a/BPA.SAAS.KitChenManage.Application/Device/Services/IDevicePushRecodeService.cs +++ b/BPA.SAAS.KitChenManage.Application/Device/Services/IDevicePushRecodeService.cs @@ -10,7 +10,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services { public interface IDevicePushRecodeService { - Task Test(); + Task Test(); /// /// 分页 /// diff --git a/BPA.SAAS.KitChenManage.Web.Entry/Properties/launchSettings.json b/BPA.SAAS.KitChenManage.Web.Entry/Properties/launchSettings.json index 470db2e..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.19: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 2b2e5b1..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.19: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;", From 1cf4fd64d3934a9a0168440c36ca8466d446495c Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Sat, 20 Apr 2024 15:57:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Device/Dtos/DeviceGoodsInputDto.cs | 22 ++++ .../Services/DevicePushRecodeService.cs | 120 ++++++++++++++---- .../Model/BPA_DeviceGoods.cs | 22 ++++ 3 files changed, 138 insertions(+), 26 deletions(-) create mode 100644 BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs create mode 100644 BPA.SAAS.KitChenManage.Core/Model/BPA_DeviceGoods.cs diff --git a/BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs b/BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs new file mode 100644 index 0000000..800a2a8 --- /dev/null +++ b/BPA.SAAS.KitChenManage.Application/Device/Dtos/DeviceGoodsInputDto.cs @@ -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.Dtos +{ + public class DeviceGoodsInputDto + { + public string DeviceId { get; set; } + + public List GoodsList { get; set; } + } + + public class Goods + { + public string GoodsId { get; set; } + + public string GoodsName { get; set; } + } +} diff --git a/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs b/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs index 8772889..fbf0a75 100644 --- a/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs +++ b/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs @@ -29,7 +29,7 @@ using uPLibrary.Networking.M2Mqtt; namespace BPA.SAAS.KitChenManage.Application.Device.Services { - public class DevicePushRecodeService: IDevicePushRecodeService, ITransient + public class DevicePushRecodeService : IDevicePushRecodeService, ITransient { private readonly ISqlSugarClient _db; private readonly IMqttClient _mqttClient; @@ -39,18 +39,18 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services public DevicePushRecodeService(ISqlSugarClient db, IMqttClient mqttClient) { _db = db; - _mqttClient=mqttClient; + _mqttClient = mqttClient; mqttServer = new(mqttClient); } public async Task Test() { var getGoodsAttributeurl = "http://localhost:5009/api/ExternalPlatform/Goods/GetGoodsPageList";//获取商品属性 var key = "47e5c071-6283-4d9d-8dcb-36ba95aa8db9"; - var str = "current=1&pageSize=10&"+ key; + var str = "current=1&pageSize=10&" + key; var sign = MD5Encryption.Encrypt(str.ToUpper()); var respon = await getGoodsAttributeurl.SetHeaders(new { - sign= sign, + sign = sign, key = key }).SetHttpMethod(HttpMethod.Get).SetBody("{\"current\":1,\"pageSize\":10}", "application/json").PostAsStringAsync(); return respon; @@ -63,25 +63,25 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services public async Task Page(DevicePushRecodeDtoPageInput input) { RefAsync total = 0; - var res = await _db.Queryable().Where(x=>x.Type== input.Type) - .WhereIF(!string.IsNullOrWhiteSpace(input.DeviceName),x=>x.DeviceName.Contains(input.DeviceName)) - .WhereIF(!string.IsNullOrWhiteSpace(input.Status), x => x.Status==Convert.ToInt32(input.Status)) - .Select(t => new + var res = await _db.Queryable().Where(x => x.Type == input.Type) + .WhereIF(!string.IsNullOrWhiteSpace(input.DeviceName), x => x.DeviceName.Contains(input.DeviceName)) + .WhereIF(!string.IsNullOrWhiteSpace(input.Status), x => x.Status == Convert.ToInt32(input.Status)) + .Select(t => new { CreateAt = t.CreateAt, CreateBy = t.CreateBy, Id = t.Id, DeviceId = t.DeviceId, - DeviceName= t.DeviceName, - Type =t.Type, - Topic=t.Topic, - DataResore=t.DataResore, - Status=t.Status, - Description=t.Description, - MessageId=t.MessageId, - TopicRely=t.TopicRely, - DataResoreRely=t.DataResoreRely, - DescriptionRely=t.DescriptionRely, + DeviceName = t.DeviceName, + Type = t.Type, + Topic = t.Topic, + DataResore = t.DataResore, + Status = t.Status, + Description = t.Description, + MessageId = t.MessageId, + TopicRely = t.TopicRely, + DataResoreRely = t.DataResoreRely, + DescriptionRely = t.DescriptionRely, }).OrderBy(x => x.CreateAt, OrderByType.Desc).ToPageListAsync(input.Current, input.PageSize, total); PageUtil util = new PageUtil() { @@ -122,7 +122,8 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services var res = await _db.Insertable(data).CallEntityMethod(t => t.Create()).ExecuteCommandAsync(); //周期性任务 (10 秒后执行1次任务) var trigger = TriggerBuilder.Default.WithInterval(TimeSpan.FromSeconds(10)).WithRepeatCount(1).Build(); - TaskServicesManager.GetOrAdd(input[i].MessageId.ToString(), async (provider, token) => { + TaskServicesManager.GetOrAdd(input[i].MessageId.ToString(), async (provider, token) => + { await CallBackDevicePushRecode(input[i].MessageId.ToString(), groupId); }, trigger); //订阅回复数据下发topics @@ -148,7 +149,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services if (string.IsNullOrEmpty(Topic)) throw Oops.Oh("请配置相关topic"); //var maxmessageId=_db.Queryable().Max(x => x.MessageId); if (string.IsNullOrWhiteSpace(input[i].MessageId)) input[i].MessageId = Guid.NewGuid().ToString(); - // var messageId = Guid.NewGuid().ToString(); + // var messageId = Guid.NewGuid().ToString(); data[i].Topic = Topic; data[i].Status = 0; data[i].DataResore = JsonConvert.SerializeObject(DataResore.Data); @@ -166,7 +167,8 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services var res = await _db.Insertable(data).CallEntityMethod(t => t.Create()).ExecuteCommandAsync(); //周期性任务 (10 秒后执行1次任务) var trigger = TriggerBuilder.Default.WithInterval(TimeSpan.FromSeconds(10)).WithRepeatCount(1).Build(); - TaskServicesManager.GetOrAdd(input[i].MessageId.ToString(), async (provider, token) => { + TaskServicesManager.GetOrAdd(input[i].MessageId.ToString(), async (provider, token) => + { await CallBackDevicePushRecode(input[i].MessageId.ToString(), groupId); }, trigger); //订阅回复数据下发topics @@ -181,7 +183,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services /// /// /// - public async Task CallBackDevicePushRecode(string messageId,string groupId) + public async Task CallBackDevicePushRecode(string messageId, string groupId) { var model = await _db.Queryable().Where(x => x.MessageId.ToString() == messageId.ToString() && x.GroupId == groupId).FirstAsync(); if (model.Status == 0) @@ -205,14 +207,15 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services data.DataResoreRely = ""; // data.MessageId= messageId; var respush = await mqttServer.Publish(data.Topic, new PushData() { Data = data.DataResore, DeviceId = data.DeviceAutoKey }, data.MessageId); - if (respush!= "success") + if (respush != "success") { data.Description = respush; data.Status = 2; } var res = await _db.Updateable(data).ExecuteCommandAsync(); var trigger = TriggerBuilder.Default.WithInterval(TimeSpan.FromSeconds(10)).WithRepeatCount(1).Build(); - TaskServicesManager.GetOrAdd(data.MessageId.ToString(), async (provider, token) => { + TaskServicesManager.GetOrAdd(data.MessageId.ToString(), async (provider, token) => + { await CallBackDevicePushRecode(data.MessageId.ToString(), groupId); }, trigger); await BindMqReceived(data.MessageId.ToString(), groupId); @@ -244,7 +247,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services /// /// /// - private async Task BindMqReceived(string messageId,string groupId) + private async Task BindMqReceived(string messageId, string groupId) { var status = true; _mqttClient.UseApplicationMessageReceivedHandler(async e => @@ -287,10 +290,75 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services } var getGoodsAttributeurl = BaseServerUrl + "api/device/updatethirdpartypushrecord";//修改第三方订单的回调 - await getGoodsAttributeurl.SetHttpMethod(HttpMethod.Post).SetBody("{\"messageId\":"+ messageId + ",\"isPush\":"+ status + ",\"pushTime\":"+DateTime.Now+"}").PostAsStringAsync(); + await getGoodsAttributeurl.SetHttpMethod(HttpMethod.Post).SetBody("{\"messageId\":" + messageId + ",\"isPush\":" + status + ",\"pushTime\":" + DateTime.Now + "}").PostAsStringAsync(); _db.Updateable(model).ExecuteCommand(); } }); } + + + + + + #region 设备商品 + + /// + /// 获取设备商品 + /// + /// + /// + public async Task> GetDeviceGoods(string deviceId) + { + var result = new List(); + + result = await _db.Queryable().Where(x => x.DeviceId == deviceId) + .Select(x => new Goods() + { + GoodsId = x.GoodsId, + GoodsName = x.GoodsName + }).ToListAsync(); + + return result; + } + + /// + /// 编辑设备商品 + /// + /// + /// + public async Task EditDeviceGoods(DeviceGoodsInputDto inputDto) + { + try + { + _db.Ado.BeginTran(); + + //删除店铺商品 + await _db.Deleteable().Where(it => it.DeviceId == inputDto.DeviceId).ExecuteCommandAsync(); + + var list = new List(); + foreach (var item in inputDto.GoodsList) + { + list.Add(new BPA_DeviceGoods() + { + DeviceId = inputDto.DeviceId, + GoodsId = item.GoodsId, + GoodsName = item.GoodsName, + }); + } + var res = await _db.Insertable(list).ExecuteCommandAsync(); + + return res > 0; + + _db.Ado.CommitTran(); + } + catch (Exception e) + { + _db.Ado.RollbackTran(); + return false; + } + } + + #endregion + } } diff --git a/BPA.SAAS.KitChenManage.Core/Model/BPA_DeviceGoods.cs b/BPA.SAAS.KitChenManage.Core/Model/BPA_DeviceGoods.cs new file mode 100644 index 0000000..bf1b3e3 --- /dev/null +++ b/BPA.SAAS.KitChenManage.Core/Model/BPA_DeviceGoods.cs @@ -0,0 +1,22 @@ +using BPA.SAAS.KitChenManage.Core.Base; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.KitChenManage.Core.Model +{ + + [SugarTable("bpa_devicegoods")] + public class BPA_DeviceGoods:IBaseEntity, IGroupId + { + public string DeviceId { get; set; } + + public string GoodsId { get; set; } + + public string GoodsName { get; set;} + public string GroupId { get; set; } + } +} From 732df4df327706984baef5febfc1fdd9636feb39 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Mon, 22 Apr 2024 10:10:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseDto/BaseEPDto.cs | 0 .../BaseDto/DtoValidator.cs | 0 .../BaseDto/ResultSAASManageDto.cs | 0 .../BaseDto/UserAnalysis.cs | 0 .../Enum/ErrorCodeEnum.cs | 0 .../Service/Authorization/AuthServices.cs | 0 .../Authorization/Dtos/StoreAuthDto.cs | 0 .../Authorization/Services/AuthService.cs | 0 .../Authorization/Services/IAuthService.cs | 0 .../Service/CheckService/CheckServices.cs | 0 .../CheckService/Services/CheckServices.cs | 0 .../CheckService/Services/ICheckServices.cs | 0 .../Goods/Dtos/ResultGoodsResultDto.cs | 99 ++++++ .../Service/Goods/Services/GoodsServices.cs | 71 ++++ .../Service/Goods/Services/IGoodsServices.cs | 18 + .../Platform/Material/MaterialServices.cs | 0 .../Material/Services/IMaterialServices.cs | 0 .../Material/Services/MaterialService.cs | 0 .../BPA.SAAS.KitChenManage.Application.csproj | 3 + .../BPA.SAAS.KitChenManage.Application.xml | 317 ++++++++++++++++++ .../Device/DevicePushRecodeServices.cs | 28 ++ .../Services/DevicePushRecodeService.cs | 6 +- .../Services/IDevicePushRecodeService.cs | 18 + .../Food/Dtos/ResultSAASManageDto.cs | 99 ++++++ .../Food/FoodMenuServices.cs | 11 + .../Food/Services/FoodMenuService.cs | 49 +++ .../Food/Services/IFoodMenuService.cs | 6 + 27 files changed, 723 insertions(+), 2 deletions(-) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/BaseDto/BaseEPDto.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/BaseDto/DtoValidator.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/BaseDto/ResultSAASManageDto.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/BaseDto/UserAnalysis.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Enum/ErrorCodeEnum.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/Authorization/AuthServices.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/Authorization/Dtos/StoreAuthDto.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/Authorization/Services/AuthService.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/Authorization/Services/IAuthService.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/CheckService/CheckServices.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/CheckService/Services/CheckServices.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/CheckService/Services/ICheckServices.cs (100%) create mode 100644 BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs create mode 100644 BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs create mode 100644 BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/IGoodsServices.cs rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/Platform/Material/MaterialServices.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/Platform/Material/Services/IMaterialServices.cs (100%) rename BPA.SAAS.KitChenManage.Application/{AExternalPlatform => AExternalPlatform1}/Service/Platform/Material/Services/MaterialService.cs (100%) create mode 100644 BPA.SAAS.KitChenManage.Application/Food/Dtos/ResultSAASManageDto.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/BaseDto/BaseEPDto.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/BaseDto/BaseEPDto.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/BaseDto/BaseEPDto.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/BaseDto/BaseEPDto.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/BaseDto/DtoValidator.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/BaseDto/DtoValidator.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/BaseDto/DtoValidator.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/BaseDto/DtoValidator.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/BaseDto/ResultSAASManageDto.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/BaseDto/ResultSAASManageDto.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/BaseDto/ResultSAASManageDto.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/BaseDto/ResultSAASManageDto.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/BaseDto/UserAnalysis.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/BaseDto/UserAnalysis.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/BaseDto/UserAnalysis.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/BaseDto/UserAnalysis.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Enum/ErrorCodeEnum.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Enum/ErrorCodeEnum.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Authorization/AuthServices.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Authorization/AuthServices.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Authorization/AuthServices.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Authorization/AuthServices.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Authorization/Dtos/StoreAuthDto.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Authorization/Dtos/StoreAuthDto.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Authorization/Dtos/StoreAuthDto.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Authorization/Dtos/StoreAuthDto.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Authorization/Services/AuthService.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Authorization/Services/AuthService.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Authorization/Services/AuthService.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Authorization/Services/AuthService.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Authorization/Services/IAuthService.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Authorization/Services/IAuthService.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Authorization/Services/IAuthService.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Authorization/Services/IAuthService.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/CheckService/CheckServices.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/CheckService/CheckServices.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/CheckService/Services/CheckServices.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/CheckService/Services/CheckServices.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/CheckService/Services/ICheckServices.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/CheckService/Services/ICheckServices.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs new file mode 100644 index 0000000..e17e556 --- /dev/null +++ b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dtos +{ + public class ResultGoodsResultDto + { + public int statusCode { get; set; } + + public List 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 GoodsTypeResultDto + { + public string GoodsTypeId { get; set; } + + public string GoodsTypeName { get; set; } + + public List GoodsAttributeList { get; set; } + + public List GoodsInfoList { get; set; } + } + + + public class GoodsAttributeResultDto + { + public string GoodsAttributeId { get; set; } + + public string GoodsAttributeName { get; set; } + + public List GoodsAttributeValueList { get; set; } + } + + public class GoodsAttributeValueResultDto + { + public string GoodsAttributeId { get; set; } + public string GoodsAttributeValueId { get; set; } + public string AttributeValue { get; set; } + } + + public class GoodsResultDto + { + public string TypeId { get; set; } + + public string TypeName { get; set; } + } + + public class GoodsInfoResultDto + { + public string GoodsId { get; set; } + + public string GoodsName { get; set; } + + public List GoodsTechnologyActionList { get; set; } + } + + public class GoodsTechnologyActionResultDto + { + /// + /// 步骤名称 + /// + public string StepName { get; set; } + /// + /// 动作json + /// + public string ActionJson { get; set; } + /// + /// 商品属性id集合 + /// + public string GoodsAttributeId { get; set; } + /// + /// 是否物料 + /// + public bool IsBatch { get; set; } + /// + /// 动作value + /// + public string ChnologyId { get; set; } + public string GroupId { get; set; } + public int Sort { get; set; } + public string GoodsId { get; set; } + public string DeviceId { get; set; } + /// + /// 仓位模板 + /// + public string WarehousrTemplateId { 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 new file mode 100644 index 0000000..ff22b70 --- /dev/null +++ b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs @@ -0,0 +1,71 @@ +using BPA.SAAS.KitChenManage.Application.AExternalPlatform.BaseDto; +using BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dtos; +using BPA.SAAS.KitChenManage.Comm.Tool; +using BPA.SAAS.KitChenManage.Core.Model; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Services +{ + + [ApiDescriptionSettings("开放平台", Tag = "商品信息"), AllowAnonymous, NonUnify] + public class Goods: IGoodsServices, ITransient,IDynamicApiController + { + + private readonly ISqlSugarClient _db; + public Goods(ISqlSugarClient db) + { + _db = db; + } + /// + /// 获取设备物料信息 + /// + /// + [HttpPost("/api/goods/Getdevicegoods")] + public async Task GetDeviceGoods(string deviceId) + { + + + var goodsId = await _db.Queryable() + .Where(x => x.DeviceId == deviceId) + .Select(x => x.GoodsId) + .ToListAsync(); + + var data = await GetDeviceGoodspost(goodsId); + + return data; + } + + + /// + /// 获取商品信息 + /// + /// + /// + public async Task GetDeviceGoodspost(List goodsList) + { + try + { + + + 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; + } + catch (Exception ex) + { + + 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 new file mode 100644 index 0000000..883d133 --- /dev/null +++ b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/IGoodsServices.cs @@ -0,0 +1,18 @@ +using BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dtos; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Services +{ + public interface IGoodsServices + { + /// + /// 获取设备物料信息 + /// + /// + Task GetDeviceGoods(string deviceId); + } +} diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Platform/Material/MaterialServices.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Platform/Material/MaterialServices.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Platform/Material/MaterialServices.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Platform/Material/MaterialServices.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Platform/Material/Services/IMaterialServices.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Platform/Material/Services/IMaterialServices.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Platform/Material/Services/IMaterialServices.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Platform/Material/Services/IMaterialServices.cs diff --git a/BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Platform/Material/Services/MaterialService.cs b/BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Platform/Material/Services/MaterialService.cs similarity index 100% rename from BPA.SAAS.KitChenManage.Application/AExternalPlatform/Service/Platform/Material/Services/MaterialService.cs rename to BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Platform/Material/Services/MaterialService.cs diff --git a/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.csproj b/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.csproj index b8d288e..ecbd2d9 100644 --- a/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.csproj +++ b/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.csproj @@ -10,8 +10,11 @@ + + + diff --git a/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml b/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml index 7593f6c..c9c828a 100644 --- a/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml +++ b/BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml @@ -4,6 +4,221 @@ BPA.SAAS.KitChenManage.Application + + + Dto参数验证 + + + + + 获取签名 + + + + 0-不排序 1-按名称ASCII排序 + + + + + 系统错误码 + + + + + 用户没有注册 + + + + + 操作错误 + + + + + 重复添加 + + + + + 操作数据不存在 + + + + + key不正确 + + + + + 签名错误 + + + + + 签名错误 + + + + + 获取店铺授权码列表 + + + + + + + 获取店铺授权码 + + + + + + + 添加店铺授权码 + + + + + + 修改店铺授权码 + + + + + + + 获取店铺授权码列表 + + + + + + + 获取店铺授权码 + + + + + + + 添加店铺授权码 + + + + + + 修改店铺授权码 + + + + + + + 获取店铺授权码列表 + + + + + + + 获取店铺授权码 + + + + + + + 添加店铺授权码 + + + + + + 修改店铺授权码 + + + + + + + 检查Sign + + + + + 获取模型值 + + + + + + + + 检查店铺key验证 + + + + + + 检查租户 + + + + + + + 检查Sign + + + + + 步骤名称 + + + + + 动作json + + + + + 商品属性id集合 + + + + + 是否物料 + + + + + 动作value + + + + + 仓位模板 + + + + + 获取设备物料信息 + + + + + + 获取商品信息 + + + + + + + 获取设备物料信息 + + + 分页店铺授权码 @@ -171,6 +386,20 @@ + + + 获取设备商品 + + + + + + + 编辑设备商品 + + + + Topics类 @@ -339,6 +568,20 @@ + + + 获取设备商品 + + + + + + + 编辑设备商品 + + + + 分页 @@ -367,6 +610,20 @@ + + + 获取设备商品 + + + + + + + 编辑设备商品 + + + + 商品菜品id @@ -377,6 +634,36 @@ 菜谱信息表 + + + 步骤名称 + + + + + 动作json + + + + + 商品属性id集合 + + + + + 是否物料 + + + + + 动作value + + + + + 仓位模板 + + 分页查询 @@ -419,6 +706,12 @@ + + + 获取设备物料信息 + + + 分页 @@ -461,6 +754,19 @@ + + + 获取设备物料信息 + + + + + + 获取商品信息 + + + + 分页 @@ -503,6 +809,12 @@ + + + 获取设备物料信息 + + + 映射数据 @@ -803,5 +1115,10 @@ + + + 检查Sign + + diff --git a/BPA.SAAS.KitChenManage.Application/Device/DevicePushRecodeServices.cs b/BPA.SAAS.KitChenManage.Application/Device/DevicePushRecodeServices.cs index d855a6f..b510cee 100644 --- a/BPA.SAAS.KitChenManage.Application/Device/DevicePushRecodeServices.cs +++ b/BPA.SAAS.KitChenManage.Application/Device/DevicePushRecodeServices.cs @@ -72,5 +72,33 @@ namespace BPA.SAAS.KitChenManage.Application.Device { return await _devicePushRecodeService.Delete(input); } + + + + #region 设备商品 + + /// + /// 获取设备商品 + /// + /// + /// + [HttpPost("/api/devicepushrecode/getdevicegoods")] + public async Task> GetDeviceGoods(string deviceId) + { + return await _devicePushRecodeService.GetDeviceGoods(deviceId); + } + + /// + /// 编辑设备商品 + /// + /// + /// + [HttpPost("/api/devicepushrecode/editdevicegoods")] + public async Task EditDeviceGoods(DeviceGoodsInputDto inputDto) + { + return await _devicePushRecodeService.EditDeviceGoods(inputDto); + } + + #endregion } } diff --git a/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs b/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs index 2b87789..2da2456 100644 --- a/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs +++ b/BPA.SAAS.KitChenManage.Application/Device/Services/DevicePushRecodeService.cs @@ -343,7 +343,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services { var result = new List(); - result = await _db.Queryable().Where(x => x.DeviceId == deviceId) + result = await _db.Queryable() .Select(x => new Goods() { GoodsId = x.GoodsId, @@ -372,6 +372,7 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services { list.Add(new BPA_DeviceGoods() { + Id=Guid.NewGuid().ToString(), DeviceId = inputDto.DeviceId, GoodsId = item.GoodsId, GoodsName = item.GoodsName, @@ -379,9 +380,10 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services } var res = await _db.Insertable(list).ExecuteCommandAsync(); - return res > 0; _db.Ado.CommitTran(); + + return res > 0; } catch (Exception e) { diff --git a/BPA.SAAS.KitChenManage.Application/Device/Services/IDevicePushRecodeService.cs b/BPA.SAAS.KitChenManage.Application/Device/Services/IDevicePushRecodeService.cs index 6c6d85d..ebd8b56 100644 --- a/BPA.SAAS.KitChenManage.Application/Device/Services/IDevicePushRecodeService.cs +++ b/BPA.SAAS.KitChenManage.Application/Device/Services/IDevicePushRecodeService.cs @@ -36,5 +36,23 @@ namespace BPA.SAAS.KitChenManage.Application.Device.Services /// /// Task Delete(List input); + + #region 设备商品 + + /// + /// 获取设备商品 + /// + /// + /// + Task> GetDeviceGoods(string deviceId); + + /// + /// 编辑设备商品 + /// + /// + /// + Task EditDeviceGoods(DeviceGoodsInputDto inputDto); + + #endregion } } diff --git a/BPA.SAAS.KitChenManage.Application/Food/Dtos/ResultSAASManageDto.cs b/BPA.SAAS.KitChenManage.Application/Food/Dtos/ResultSAASManageDto.cs new file mode 100644 index 0000000..faf6857 --- /dev/null +++ b/BPA.SAAS.KitChenManage.Application/Food/Dtos/ResultSAASManageDto.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.KitChenManage.Application.Food.Dtos +{ + public class ResultSAASManageDto + { + public int statusCode { get; set; } + + public List 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 GoodsTypeResultDto + { + public string GoodsTypeId { get; set; } + + public string GoodsTypeName { get; set; } + + public List GoodsAttributeList { get; set; } + + public List GoodsInfoList { get; set; } + } + + + public class GoodsAttributeResultDto + { + public string GoodsAttributeId { get; set; } + + public string GoodsAttributeName { get; set; } + + public List GoodsAttributeValueList { get; set; } + } + + public class GoodsAttributeValueResultDto + { + public string GoodsAttributeId { get; set; } + public string GoodsAttributeValueId { get; set; } + public string AttributeValue { get; set; } + } + + public class GoodsResultDto + { + public string TypeId { get; set; } + + public string TypeName { get; set; } + } + + public class GoodsInfoResultDto + { + public string GoodsId { get; set; } + + public string GoodsName { get; set; } + + public List GoodsTechnologyActionList { get; set; } + } + + public class GoodsTechnologyActionResultDto + { + /// + /// 步骤名称 + /// + public string StepName { get; set; } + /// + /// 动作json + /// + public string ActionJson { get; set; } + /// + /// 商品属性id集合 + /// + public string GoodsAttributeId { get; set; } + /// + /// 是否物料 + /// + public bool IsBatch { get; set; } + /// + /// 动作value + /// + public string ChnologyId { get; set; } + public string GroupId { get; set; } + public int Sort { get; set; } + public string GoodsId { get; set; } + public string DeviceId { get; set; } + /// + /// 仓位模板 + /// + public string WarehousrTemplateId { get; set; } + } +} diff --git a/BPA.SAAS.KitChenManage.Application/Food/FoodMenuServices.cs b/BPA.SAAS.KitChenManage.Application/Food/FoodMenuServices.cs index 24ee7ed..fa1a9ae 100644 --- a/BPA.SAAS.KitChenManage.Application/Food/FoodMenuServices.cs +++ b/BPA.SAAS.KitChenManage.Application/Food/FoodMenuServices.cs @@ -81,5 +81,16 @@ namespace BPA.SAAS.KitChenManage.Application.Food { return await _foodmenuService.GetFoodMenuGoods(foodMenuId); } + + /// + /// 获取设备物料信息 + /// + /// + [HttpGet("/api/foodmenu/getdevicegoods")] + public async Task GetDeviceGoods(string deviceId) + { + return await _foodmenuService.GetDeviceGoods(deviceId); + + } } } diff --git a/BPA.SAAS.KitChenManage.Application/Food/Services/FoodMenuService.cs b/BPA.SAAS.KitChenManage.Application/Food/Services/FoodMenuService.cs index 085ed3a..530031b 100644 --- a/BPA.SAAS.KitChenManage.Application/Food/Services/FoodMenuService.cs +++ b/BPA.SAAS.KitChenManage.Application/Food/Services/FoodMenuService.cs @@ -1,9 +1,11 @@ using BPA.SAAS.KitChenManage.Application.Food.Dtos; using BPA.SAAS.KitChenManage.Application.Store.Dtos; using BPA.SAAS.KitChenManage.Application.Store.Services; +using BPA.SAAS.KitChenManage.Comm.Tool; using BPA.SAAS.KitChenManage.Core.Base; using BPA.SAAS.KitChenManage.Core.Model; using Furion.LinqBuilder; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -127,5 +129,52 @@ namespace BPA.SAAS.KitChenManage.Application.Food.Services { return await _db.Queryable().Where(x => x.FoodMenuId == foodMenuId).ToListAsync(); } + + + /// + /// 获取设备物料信息 + /// + /// + public async Task GetDeviceGoods(string deviceId) + { + + + var goodsId =await _db.Queryable() + .Where(x => x.DeviceId == deviceId) + .Select(x => x.GoodsId) + .ToListAsync(); + + var data = await GetDeviceGoodspost(goodsId); + + return data; + } + + + /// + /// 获取商品信息 + /// + /// + /// + public async Task GetDeviceGoodspost(List goodsList) + { + try + { + + + 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; + } + catch (Exception ex) + { + + throw Oops.Oh("获取商品失败"); + } + + + } } } diff --git a/BPA.SAAS.KitChenManage.Application/Food/Services/IFoodMenuService.cs b/BPA.SAAS.KitChenManage.Application/Food/Services/IFoodMenuService.cs index b04c7b7..9b5a5b8 100644 --- a/BPA.SAAS.KitChenManage.Application/Food/Services/IFoodMenuService.cs +++ b/BPA.SAAS.KitChenManage.Application/Food/Services/IFoodMenuService.cs @@ -48,5 +48,11 @@ namespace BPA.SAAS.KitChenManage.Application.Food.Services /// /// Task> GetFoodMenuGoods(string foodMenuId); + + /// + /// 获取设备物料信息 + /// + /// + Task GetDeviceGoods(string deviceId); } }