From 36bc5c8153e4202add4ba8a000bf948f9d95e132 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Wed, 6 Mar 2024 09:47:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bpa.saas.manage.metadata.v7.bin | Bin 371624 -> 375341 bytes .../bpa.saas.manage.projects.v7.bin | Bin 2784016 -> 3292592 bytes .../BaseDto/ResultSAASManageDto.cs | 4 +- .../AExternalPlatform/Enum/ErrorCodeEnum.cs | 2 +- .../Material/Services/MaterialService.cs | 64 +++++++++++----- .../ThirdpartyPush/Dtos/PushDataDto.cs | 71 ++++++++++++++++++ .../ThirdpartyPush/Dtos/PushDeviceDto.cs | 1 + .../Services/ThirdpartyPushService.cs | 20 ++++- .../System/BPA_ThirdpartyPushRecord.cs | 4 + .../Properties/launchSettings.json | 2 +- BPA.SAAS.Manage.Web.Entry/appsettings.json | 2 +- 11 files changed, 145 insertions(+), 25 deletions(-) create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/ThirdpartyPush/Dtos/PushDataDto.cs diff --git a/.vs/ProjectEvaluation/bpa.saas.manage.metadata.v7.bin b/.vs/ProjectEvaluation/bpa.saas.manage.metadata.v7.bin index f98f959bd892da6b1e8d030af5d51d7781c58e2a..01451d97be52d45aeccda6f5c742bcdd1bb6dc71 100644 GIT binary patch delta 1725 zcmZ`(ZA?>V6z2B6hpv1%E~^FR2xdknooKZcOf+U)F{le-74}0ScJvl*g0$(q&iN4q z4RbOa9~&ISDxjM~)Wt0^_s=r*FF&0A+7Gk1|4TG(OUCBMcJ6yyxwlG_zU_OS=bZDL z^W5C2Ulv~bYoRmenmdO+II&gSfDd*#DsW7L;vThE6?#=iuPXMc?1lf+~JM55rzl<0vWiUoMA z(n!mU)Uugw=?hITOstLA!=MrmiI9i=BciKVu?YK;2A1JEUtYmm2yo#~nw|90Z$!H>y)D9RXm^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}W0T(-&7^ToSZ$pRsF1-E>lO$~0p z7PrK?66=X9PN&mhDXpK)_R_Ix;Sud@;j>s=l**2B8G81+OuWqH{0C*Hy61AEf4k z+8(Dn?Vi8)NKRNpnr!o=Yb8rtMV}T|ZI>l24s_WI=*y9!Mw)2%*q5`+QY|ObNQ?$* z#P#F`;-(7rW2gLykXxARMchVdzD{m1lRnzFTj{!k=vTpNf~l^%m>WP0qO@gSs_P!* z_bXjPh+!2hR-fv+kGT=VC`z>l#0@TGR@0OxsLWE)&+40Hzd;$J9tRMEDp*IWd@N7f zy5*Z|2dnLsXN=m$RgI2HE3*xWCk0|%@!HDx!c|{eBLTtBzu{s$6X9}fTk 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;",