diff --git a/.vs/ProjectEvaluation/bpa.saas.manage.metadata.v7.bin b/.vs/ProjectEvaluation/bpa.saas.manage.metadata.v7.bin index f98f959..01451d9 100644 Binary files a/.vs/ProjectEvaluation/bpa.saas.manage.metadata.v7.bin and b/.vs/ProjectEvaluation/bpa.saas.manage.metadata.v7.bin differ diff --git a/.vs/ProjectEvaluation/bpa.saas.manage.projects.v7.bin b/.vs/ProjectEvaluation/bpa.saas.manage.projects.v7.bin index b1b20f0..3b6c463 100644 Binary files a/.vs/ProjectEvaluation/bpa.saas.manage.projects.v7.bin and b/.vs/ProjectEvaluation/bpa.saas.manage.projects.v7.bin differ diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResultSAASManageDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResultSAASManageDto.cs index 45b78a2..c20ee6b 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResultSAASManageDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResultSAASManageDto.cs @@ -10,7 +10,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto { public int statusCode { get; set; } - public ResultSAASManageDataDto data { get; set; } + public T data { get; set; } public string succeeded { get; set; } @@ -19,6 +19,8 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto public string extras { get; set; } public int timestamp { get; set; } + + } public class ResultSAASManageDataDto diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs index a060d82..a4b540d 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs @@ -106,7 +106,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Enum /// /// 下发错误 /// - [ErrorCodeItemMetadata("下发错误")] + [ErrorCodeItemMetadata("操作成功,下发错误")] Code10016, } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs index 5ca4eef..cfe05cf 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs @@ -134,16 +134,21 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service if (inputDto.StoreIdList != null && inputDto.StoreIdList.Count > 0) { - input = await SqlSugarDb.Db.Queryable((a, b) => new JoinQueryInfos( - JoinType.Left, a.ProductId == b.Id)) - .Where(x => inputDto.StoreIdList.Contains(x.StopId)) - .Select((a, b) => new PushDeviceDto + input = await SqlSugarDb.Db.Queryable((a, b,c) => new JoinQueryInfos( + JoinType.Left, a.ProductId == b.Id, + JoinType.Left,a.ProductVersionId==c.Id + )) + .Where((a, b, c) => inputDto.StoreIdList.Contains(a.StopId)) + .Select((a, b,c) => new PushDeviceDto { deviceAutoKey = a.AutoKey, deviceId = a.Id, deviceName = a.DeviceName, - messageId = "", - productName = "" + messageId = CurrentUser.MessageId, + productKey = b.Key, + productName = b.Name, + productVersion = c.Vesion, + type = 2 }) .ToListAsync(); @@ -152,19 +157,20 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service if (inputDto.DeviceIdList != null && inputDto.DeviceIdList.Count > 0) { - input = await SqlSugarDb.Db.Queryable((a, b) => new JoinQueryInfos( - JoinType.Left, a.ProductId == b.Id)) - .Where(x => inputDto.StoreIdList.Contains(x.StopId)) - .Select((a, b) => new PushDeviceDto + input = await SqlSugarDb.Db.Queryable((a, b,c) => new JoinQueryInfos( + JoinType.Left, a.ProductId == b.Id, + JoinType.Left,a.ProductVersionId==c.Id)) + .Where((a, b,c) => inputDto.DeviceIdList.Contains(a.Id)) + .Select((a, b,c) => new PushDeviceDto { deviceAutoKey = a.AutoKey, deviceId = a.Id, deviceName = a.DeviceName, - messageId = "", - productKey = "", + messageId = CurrentUser.MessageId, + productKey = b.Key, productName = b.Name, - productVersion = a.ProductVersionId, - type = 2 + productVersion =c.Vesion, + type = 2, }) .ToListAsync(); } @@ -180,15 +186,35 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service IsPush = false, MessageId = CurrentUser.MessageId, PushDevice =item.deviceId, - PushData = JsonConvert.SerializeObject(item), + PushData = materialData.Id, + Status=1, + Type = 2, + }); + item.data = JsonConvert.SerializeObject(new List() + { + new() + { + Aittribute= materialData.Aittribute, + AutoKey= materialData.AutoKey, + Code=materialData.Code, + ForeignKeyRe= materialData.ForeignKeyRe, + Id=materialData.Id, + Name= materialData.Batching_Name, + netrecovery= materialData.netrecovery, + outstockUint= materialData.outstockUint, + Price= materialData.Price, + proportion= materialData.proportion, + Specs= materialData.Specs, + StockUint= materialData.StockUint, + StockUintName= materialData.StockUint, + TypeID= materialData.TypeID, + + } }); } + SqlSugarDb.Db.Ado.CommitTran(); //5.发送mq await _thirdpartyPushService.PushDevice(input); - - - - SqlSugarDb.Db.Ado.CommitTran(); return true; } catch (Exception e) diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Dtos/PushDataDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Dtos/PushDataDto.cs new file mode 100644 index 0000000..8c24f00 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Dtos/PushDataDto.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.Dtos +{ + public class PushDataBatchingDto + { + public string Id { get; set; } + /// + /// 原料编码 + /// + public string Code { get; set; } + /// + /// 商品属性 (0成品,1半成品,2,易耗品) + /// + public int Aittribute { get; set; } = 0; + /// + /// 原料名称 + /// + public string Name { get; set; } + /// + /// 配料类型 + /// + public string TypeName { get; set; } + /// + /// 原料类型 + /// + public string TypeID { get; set; } + + /// + /// 库存单位 + /// + public string StockUintName { get; set; } + public string StockUint { get; set; } + /// + /// 规格属性 + /// + public string Specs { get; set; } + + + /// + /// 成本价 + /// + public decimal Price { get; set; } + + + /// + /// 净料率 + /// + public decimal netrecovery { get; set; } + + /// + /// 出库单位 + /// + public string outstockUint { get; set; } + + + /// + /// 换算比例 + /// + public decimal proportion { get; set; } + + + public int AutoKey { get; set; } + public string ForeignKeyRe { get; set; } + public string CreateAt { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Dtos/PushDeviceDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Dtos/PushDeviceDto.cs index 60e1f98..74ba03f 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Dtos/PushDeviceDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Dtos/PushDeviceDto.cs @@ -49,4 +49,5 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.D public string isDefault { get; set; } } + } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Services/ThirdpartyPushService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Services/ThirdpartyPushService.cs index 571e80a..3f6bbe1 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Services/ThirdpartyPushService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Services/ThirdpartyPushService.cs @@ -44,12 +44,13 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.S { Dictionary dic = new Dictionary(); + dic.Add("groupId", CurrentUser.GroupId); var url = App.Configuration["baseurl"] + "api/devicepushrecode/add_alm"; var inputData = JsonConvert.SerializeObject(inputDto); var jsonData = HttpHelper.PostData(url, inputData, Encoding.UTF8, "application/json", dic); - var data = JsonConvert.DeserializeObject>(jsonData); + var data = JsonConvert.DeserializeObject>(jsonData); if (data.statusCode != 200) throw Oops.Oh(ErrorCodeEnum.Code10016); - if (data.data.data.Count <= 0) throw Oops.Oh(ErrorCodeEnum.Code10016); + if (!data.data) throw Oops.Oh(ErrorCodeEnum.Code10016); return true; } @@ -70,7 +71,22 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.S } data.IsPush = inputDto.IsPush; data.CreateAt = DateTime.Now; + data.Status = 0; var res = await SqlSugarDb.Db.Updateable(data).ExecuteCommandAsync(); + + //回调 + + var urlstr = ""; + + if (data.Type==2) + { + urlstr = $@"?materialId={data.PushData}&Device={inputDto.DeviceId}"; + Dictionary dic = new Dictionary(); + var inputData =""; + HttpHelper.PostData(urlstr, inputData, Encoding.UTF8, "application/json", dic); + } + + return res > 0; } diff --git a/BPA.SAAS.Manage.Core/System/BPA_ThirdpartyPushRecord.cs b/BPA.SAAS.Manage.Core/System/BPA_ThirdpartyPushRecord.cs index cf94666..74d6826 100644 --- a/BPA.SAAS.Manage.Core/System/BPA_ThirdpartyPushRecord.cs +++ b/BPA.SAAS.Manage.Core/System/BPA_ThirdpartyPushRecord.cs @@ -44,5 +44,9 @@ namespace BPA.SAAS.Manage.Core.System /// public string PushData { get; set; } + public int Status { get; set; } + + public int Type { get; set; } + } } diff --git a/BPA.SAAS.Manage.Web.Entry/Properties/launchSettings.json b/BPA.SAAS.Manage.Web.Entry/Properties/launchSettings.json index 9571557..86506d1 100644 --- a/BPA.SAAS.Manage.Web.Entry/Properties/launchSettings.json +++ b/BPA.SAAS.Manage.Web.Entry/Properties/launchSettings.json @@ -14,7 +14,7 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "dotnetRunMessages": true, - "applicationUrl": "http://localhost:5006" + "applicationUrl": "http://192.168.1.17:5006" }, "Docker": { "commandName": "Docker", diff --git a/BPA.SAAS.Manage.Web.Entry/appsettings.json b/BPA.SAAS.Manage.Web.Entry/appsettings.json index 029e773..d838cc6 100644 --- a/BPA.SAAS.Manage.Web.Entry/appsettings.json +++ b/BPA.SAAS.Manage.Web.Entry/appsettings.json @@ -8,7 +8,7 @@ } }, "AllowedHosts": "*", - "baseurl": "http://localhost:5008/", + "baseurl": "http://192.168.1.19:5007/", "ConnectionConfigs": [ { "ConnectionString": "server=10.2.1.21;Database=bpa_kitchen_kitchenbasemanage;Uid=root;Pwd=cygadmin;Allow Zero Datetime=True;Convert Zero Datetime=True;",