From 8fcd7a67e4391a5f1fbdb590c2a3f913aeb2a0a0 Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期二, 31 三月 2026 14:11:23 +0800
Subject: [PATCH] PP平库功能上线,PDA优化,部分问题点优化
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs | 375 +++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 319 insertions(+), 56 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
index 458e1d3..e169788 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
@@ -11,6 +11,7 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.StockEnum;
+using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
@@ -290,14 +291,99 @@
residueQuantity = needQuantity;
return outStocks;
}
+ //PP澶у嵎鍑哄簱锛堟柊锛�
+ public List<Dt_StockInfo> GetOutboundPPStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity,string targetAddressCode = "")
+ {
+ List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>();
+ stockInfos = stockInfos.OrderBy(x =>
+ x.WarehouseId == WarehouseEnum.HA581.ObjToInt()? 0 :
+ x.WarehouseId == WarehouseEnum.HA58.ObjToInt()? 1 :
+ 2
+ ).ToList();
- public List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo, int warehoseId)
+ // 璁$畻鎬诲彲鐢ㄥ簱瀛橈紙浠呯粺璁℃寚瀹氱墿鏂欑紪鐮侊級
+ float stockTotalQuantity = stockInfos
+ .Select(x => x.Details
+ .Where(d => d.MaterielCode == materielCode)
+ .Sum(v => v.StockQuantity - v.OutboundQuantity)
+ ).Sum(x => x);
+
+ if (stockTotalQuantity >= needQuantity)//搴撳瓨澶�
+ {
+ int index = 0;
+ while (needQuantity > 0 && index < stockInfos.Count)
+ {
+ Dt_StockInfo stockInfo = stockInfos[index];
+ decimal useableStockQuantity = stockInfo.Details
+ .Where(x => x.MaterielCode == materielCode)
+ .Sum(x => (decimal)x.StockQuantity - (decimal)x.OutboundQuantity);
+
+ if (useableStockQuantity < (decimal)needQuantity && useableStockQuantity > 0)
+ {
+ // 鍙敤閲忎笉瓒筹紝鍏ㄩ儴鍑哄簱
+ stockInfo.Details.ForEach(x =>
+ {
+ if (x.MaterielCode == materielCode)
+ x.OutboundQuantity = x.StockQuantity;
+ });
+ needQuantity = (float)((decimal)needQuantity - useableStockQuantity);
+ }
+ else if (useableStockQuantity > 0)
+ {
+ stockInfo.Details.ForEach(x =>
+ {
+ if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == materielCode)
+ {
+ decimal currentStock = (decimal)x.StockQuantity;
+ decimal currentOutbound = (decimal)x.OutboundQuantity;
+ decimal currentNeed = (decimal)needQuantity;
+ decimal available = currentStock - currentOutbound;
+
+ if (available >= currentNeed)
+ {
+ x.OutboundQuantity = (float)(currentOutbound + currentNeed);
+ needQuantity = 0;
+ }
+ else
+ {
+ needQuantity = (float)(currentNeed - available);
+ x.OutboundQuantity = x.StockQuantity;
+ }
+ }
+ });
+ }
+ // 浠呭皢鏈夊疄闄呭嚭搴撶殑搴撳瓨鍔犲叆缁撴灉闆�
+ if (useableStockQuantity > 0)
+ {
+ stockInfo.Remark = targetAddressCode;
+ outStocks.Add(stockInfo);
+ }
+
+ index++;
+ }
+ }
+ else
+ {
+ throw new Exception("搴撳瓨涓嶈冻");
+ }
+ residueQuantity = needQuantity;
+ return outStocks;
+ }
+
+ public List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo, int warehoseId)
{
if ((materielCode.Equals("405000585")|| materielCode.Equals("405000831") || materielCode.Equals("405005565") || materielCode.Equals("405405097") || materielCode.Equals("405005461")) && warehoseId == 5)
{
warehoseId = 3;
}
List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehoseId);
+
+ return BaseDal.GetStockInfos(materielCode, batchNo, locationCodes);
+ }
+ //PP澶у嵎鍑哄簱(鏂�)
+ public List<Dt_StockInfo> GetUseablePPStocks(string materielCode, string batchNo, int warehoseId)
+ {
+ List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutPPLocationCodes(warehoseId);
return BaseDal.GetStockInfos(materielCode, batchNo, locationCodes);
}
@@ -421,37 +507,57 @@
{
if (webhookUrl == null || secret == null)
{
- webhookUrl = "https://oapi.dingtalk.com/robot/send?access_token=fbc3aaf4133ea650d8116fb86b3ebfd0c5e0d46775966ce87893a41886bdf9dc";
- secret = "SECf221842b26356f22ccac84c4e60714e5287408ee8332a8f63503791382c3f5fb";
+ webhookUrl = "https://oapi.dingtalk.com/robot/send?access_token=c3e05f2c6bcd595383ee02e713446174b9201bad91db216590620fe0acd4e75e";
+ secret = "SEC617f06140fc7cbd8b91d3e203f270826320637af41e7423d756e62df40f62282";
}
- var warehouseIdToName = new Dictionary<int, string>
- {
- { 2, "娌瑰ⅷ浠�" },
- { 3, "鏉挎潗浠�" },
- { 4, "PP浠�" },
- { 6, "娴嬭瘯鏋朵粨" },
- { 11, "骞茶啘浠�" },
- { 12, "闃荤剨浠�" }
- };
+ // 1. 瀹氫箟浠撳簱ID涓庝粨搴撳悕绉扮殑鏄犲皠鍏崇郴锛堝鍔犳垚鍝佷粨锛�
+ var warehouseIdToName = new Dictionary<int, string>
+ {
+ { 2, "娌瑰ⅷ浠�" },
+ { 3, "鏉挎潗浠�" },
+ { 4, "PP浠�" },
+ { 6, "娴嬭瘯鏋朵粨" },
+ { 7, "鎴愬搧浠�" }, // 鏂板鎴愬搧浠�
+ { 11, "骞茶啘浠�" },
+ { 12, "闃荤剨浠�" }
+ };
+
+ // 2. 鏃堕棿鐩稿叧閰嶇疆锛岀敤浜庣瓫閫夎秴杩�90澶╃殑鏁版嵁
var currentTime = DateTime.Now;
var ninetyDaysAgo = currentTime.AddDays(-90);
+ // 3. 澶勭悊鍘熸潗鏂欎粨锛堜粨搴揑D 鈮� 7锛�
+ // 3.1 鏌ヨ鏍囪瘑鐮佷负3锛堣繃鏈燂級鐨勪富琛ㄦ暟鎹紙鎺掗櫎浠撳簱ID=5鍜�7锛�
var expirationLabel3Stocks = BaseDal.Db.Queryable<Dt_StockInfo>()
- .Where(s => s.Expirationlabel == 3 && s.WarehouseId != 5)
+ .Where(s => s.Expirationlabel == 3 && s.WarehouseId != 5 && s.WarehouseId != 7 && s.LocationCode != "" && s.LocationCode != null)
.ToList();
+ // 3.2 鏌ヨ瓒呰繃90澶╂湭淇敼锛堟湭浣跨敤锛夌殑涓昏〃鏁版嵁锛堟帓闄や粨搴揑D=5鍜�7锛�
var over90DaysStocks = BaseDal.Db.Queryable<Dt_StockInfo>()
- .Where(s => s.ModifyDate <= ninetyDaysAgo && s.Expirationlabel != 3 && s.WarehouseId != 5)
+ .Where(s => s.ModifyDate <= ninetyDaysAgo && s.Expirationlabel != 3 && s.WarehouseId != 5 && s.WarehouseId != 7 && s.LocationCode != "" && s.LocationCode != null)
.ToList();
- if (!expirationLabel3Stocks.Any() && !over90DaysStocks.Any())
+ // 4. 澶勭悊鎴愬搧浠擄紙浠撳簱ID = 7锛�
+ var proOver90DaysStocks = new List<Dt_ProStockInfo>();
+ if (warehouseIdToName.ContainsKey(7))
+ {
+ proOver90DaysStocks = BaseDal.Db.Queryable<Dt_ProStockInfo>()
+ .Where(s => s.WarehouseId == 7 && s.ModifyDate <= ninetyDaysAgo && s.LocationCode != "" && s.LocationCode != null)
+ .ToList();
+ }
+
+ // 鏃犵鍚堟潯浠舵暟鎹椂鐩存帴杩斿洖
+ if (!expirationLabel3Stocks.Any() && !over90DaysStocks.Any() && !proOver90DaysStocks.Any())
{
return;
}
+ // 5. 鎻愬彇鍘熸潗鏂欎富琛ㄦ暟鎹殑ID
var expirationLabel3StockIds = expirationLabel3Stocks.Select(s => s.Id).ToList();
var over90DaysStockIds = over90DaysStocks.Select(s => s.Id).ToList();
+
+ // 6. 鍏宠仈鏌ヨ鍘熸潗鏂欐槑缁嗚〃鏁版嵁
var expirationLabel3Details = expirationLabel3StockIds.Any()
? BaseDal.Db.Queryable<Dt_StockInfoDetail>()
.Where(d => expirationLabel3StockIds.Contains(d.StockId))
@@ -464,107 +570,264 @@
.ToList()
: new List<Dt_StockInfoDetail>();
- var stockIdToWarehouseId = expirationLabel3Stocks
- .Concat(over90DaysStocks)
- .ToDictionary(s => s.Id, s => s.WarehouseId);
+ // 7. 澶勭悊鎴愬搧浠撴槑缁嗘暟鎹�
+ var proOver90DaysDetails = new List<Dt_ProStockInfoDetail>();
+ if (proOver90DaysStocks.Any())
+ {
+ var proStockIds = proOver90DaysStocks.Select(s => s.Id).ToList();
+ proOver90DaysDetails = BaseDal.Db.Queryable<Dt_ProStockInfoDetail>()
+ .Where(d => proStockIds.Contains(d.ProStockId))
+ .ToList();
+ }
+ // 8. 寤虹珛涓昏〃ID鍒颁粨搴揑D鐨勬槧灏勶紙鍖呮嫭鎴愬搧浠擄級
+ var stockIdToWarehouseId = new Dictionary<int, int>();
+
+ // 鍘熸潗鏂欎粨鏄犲皠
+ foreach (var stock in expirationLabel3Stocks.Concat(over90DaysStocks))
+ {
+ if (!stockIdToWarehouseId.ContainsKey(stock.Id))
+ {
+ stockIdToWarehouseId[stock.Id] = stock.WarehouseId;
+ }
+ }
+
+ // 鎴愬搧浠撴槧灏�
+ foreach (var proStock in proOver90DaysStocks)
+ {
+ if (!stockIdToWarehouseId.ContainsKey(proStock.Id))
+ {
+ stockIdToWarehouseId[proStock.Id] = proStock.WarehouseId;
+ }
+ }
+
+ // 9. 鎸変粨搴撳垎缁勫鐞嗙墿鏂欐暟鎹�
+ // 9.1 鍘熸潗鏂欒繃鏈熺墿鏂�
var expirationLabel3Groups = expirationLabel3Details
.GroupBy(d => stockIdToWarehouseId[d.StockId])
.ToDictionary(g => g.Key, g => g.Select(d => new
{
- d.MaterielCode,
- d.BatchNo
- }).ToList());
+ MaterielCode = d.MaterielCode,
+ BatchNo = d.BatchNo,
+ IsProStock = false // 鏍囪涓洪潪鎴愬搧浠�
+ }).Distinct().ToList());
+ // 9.2 鍘熸潗鏂欒秴杩�90澶╂湭浣跨敤鐗╂枡
var over90DaysGroups = over90DaysDetails
.GroupBy(d => stockIdToWarehouseId[d.StockId])
.ToDictionary(g => g.Key, g => g.Select(d => new
{
- d.MaterielCode,
- d.BatchNo
- }).ToList());
+ MaterielCode = d.MaterielCode,
+ BatchNo = d.BatchNo,
+ IsProStock = false // 鏍囪涓洪潪鎴愬搧浠�
+ }).Distinct().ToList());
+ // 9.3 鎴愬搧浠撹秴杩�90澶╂湭浣跨敤鐗╂枡
+ if (proOver90DaysDetails.Any())
+ {
+ var proWarehouseId = 7;
+ var proGroup = proOver90DaysDetails
+ .GroupBy(d => stockIdToWarehouseId[d.ProStockId])
+ .Select(g => new
+ {
+ WarehouseId = g.Key,
+ Materials = g.Select(d => new
+ {
+ MaterielCode = d.ProductCode, // 鎴愬搧浠撲娇鐢≒roductCode瀛楁
+ BatchNo = d.LotNumber, // 鎴愬搧浠撲娇鐢↙otNumber瀛楁
+ IsProStock = true // 鏍囪涓烘垚鍝佷粨
+ }).Distinct().ToList()
+ })
+ .FirstOrDefault();
+
+ if (proGroup != null)
+ {
+ // 娣诲姞鍒皁ver90DaysGroups涓�
+ if (over90DaysGroups.ContainsKey(proWarehouseId))
+ {
+ over90DaysGroups[proWarehouseId].AddRange(proGroup.Materials);
+ }
+ else
+ {
+ over90DaysGroups[proWarehouseId] = proGroup.Materials;
+ }
+ }
+ }
+
+ // 10. 鑾峰彇鎵�鏈夋秹鍙婄殑浠撳簱ID
var allWarehouseIds = expirationLabel3Groups.Keys
.Union(over90DaysGroups.Keys)
.ToList();
+ // 11. 鍙戦�侀拤閽夋秷鎭�
using (HttpClient httpClient = new HttpClient())
{
foreach (var warehouseId in allWarehouseIds)
{
- // 9.1 澶勭悊浠撳簱鍚嶇О鏄剧ず锛氫紭鍏堢敤鏄犲皠鍚嶇О锛屾棤鏄犲皠鏃舵樉绀哄師濮婭D
var warehouseName = warehouseIdToName.TryGetValue(warehouseId, out var name)
? name
: $"浠撳簱{warehouseId}";
- var messageParts = new List<string>
- {
- $"銆恵warehouseName}銆戠墿鏂欐彁閱�"
- };
+ // 11.1 鏋勫缓markdown鏍煎紡娑堟伅
+ var markdownContent = new StringBuilder();
+ markdownContent.AppendLine($"## {warehouseName}鐗╂枡鎻愰啋閫氱煡\n");
- // 娣诲姞杩囨湡鐗╂枡淇℃伅
- if (expirationLabel3Groups.TryGetValue(warehouseId, out var label3Materials) && label3Materials.Any())
+ // 缁熻淇℃伅
+ var expiredCount = expirationLabel3Groups.TryGetValue(warehouseId, out var expList) ?
+ expList.Count : 0;
+
+ var over90Count = over90DaysGroups.TryGetValue(warehouseId, out var over90List) ?
+ over90List.Count : 0;
+
+ // 濡傛灉鏄垚鍝佷粨锛岄渶瑕佽繃婊ゅ嚭鎴愬搧浠撶殑鏁版嵁
+ if (warehouseId == 7)
{
- var label3Details = label3Materials
- .Select(m => $"鈥� 鐗╂枡缂栫爜锛歿m.MaterielCode} | 鎵规鍙凤細{m.BatchNo}")
- .Aggregate((current, next) => $"{current}\n{next}");
- messageParts.Add($"涓�銆佽繃鏈熺墿鏂橽n{label3Details}");
+ over90Count = over90List?.Count(m => m.IsProStock) ?? 0;
}
- // 娣诲姞瓒呰繃90澶╂湭浣跨敤鐗╂枡淇℃伅
- if (over90DaysGroups.TryGetValue(warehouseId, out var over90Materials) && over90Materials.Any())
+ markdownContent.AppendLine($"**缁熻姒傝锛�**");
+ if (warehouseId == 7)
{
- var over90Details = over90Materials
- .Select(m => $"鈥� 鐗╂枡缂栫爜锛歿m.MaterielCode} | 鎵规鍙凤細{m.BatchNo}")
- .Aggregate((current, next) => $"{current}\n{next}");
- messageParts.Add($"浜屻�佽秴杩�90澶╂湭浣跨敤鐗╂枡\n{over90Details}");
+ markdownContent.AppendLine($"- 瓒呰繃90澶╂湭浣跨敤鎴愬搧锛歿over90Count}鏉�");
+ }
+ else
+ {
+ markdownContent.AppendLine($"- 杩囨湡鐗╂枡锛歿expiredCount}鏉�");
+ markdownContent.AppendLine($"- 瓒呰繃90澶╂湭浣跨敤鐗╂枡锛歿over90Count}鏉�");
+ }
+ markdownContent.AppendLine();
+
+ // 11.2 娣诲姞杩囨湡鐗╂枡琛ㄦ牸锛堝鏋滄湁鏁版嵁涓斾笉鏄垚鍝佷粨锛�
+ if (expiredCount > 0 && warehouseId != 7)
+ {
+ markdownContent.AppendLine("### 涓�銆佽繃鏈熺墿鏂�");
+ markdownContent.AppendLine("| 搴忓彿 | 鐗╂枡缂栫爜 | 鎵规鍙� |");
+ markdownContent.AppendLine("| :--- | :--- | :--- |");
+
+ int index = 1;
+ var expiredToShow = expList.Take(200);
+ foreach (var material in expiredToShow)
+ {
+ markdownContent.AppendLine($"| {index} | {material.MaterielCode} | {material.BatchNo} |");
+ index++;
+ }
+
+ if (expiredCount > 200)
+ {
+ markdownContent.AppendLine($"| ... | 鍏眥expiredCount}鏉★紝浠呮樉绀哄墠200鏉� | ... |");
+ }
+ markdownContent.AppendLine();
}
- var messageContent = string.Join("\n\n", messageParts);
+ // 11.3 娣诲姞瓒呰繃90澶╂湭浣跨敤鐗╂枡琛ㄦ牸锛堝鏋滄湁鏁版嵁锛�
+ if (over90Count > 0)
+ {
+ if (warehouseId == 7)
+ {
+ markdownContent.AppendLine("### 瓒呰繃90澶╂湭浣跨敤鎴愬搧");
+ }
+ else
+ {
+ markdownContent.AppendLine("### 浜屻�佽秴杩�90澶╂湭浣跨敤鐗╂枡");
+ }
+ markdownContent.AppendLine("| 搴忓彿 | 鐗╂枡缂栫爜 | 鎵规鍙� |");
+ markdownContent.AppendLine("| :--- | :--- | :--- |");
+
+ int index = 1;
+ var over90ToShow = warehouseId == 7 ?
+ over90List?.Where(m => m.IsProStock).Take(500) :
+ over90List?.Take(500);
+
+ if (over90ToShow != null)
+ {
+ foreach (var material in over90ToShow)
+ {
+ markdownContent.AppendLine($"| {index} | {material.MaterielCode} | {material.BatchNo} |");
+ index++;
+ }
+
+ if (over90Count > (warehouseId == 7 ? 500 : 200))
+ {
+ markdownContent.AppendLine($"| ... | 鍏眥over90Count}鏉★紝浠呮樉绀哄墠{(warehouseId == 7 ? 500 : 200)}鏉� | ... |");
+ }
+ }
+ markdownContent.AppendLine();
+ }
+
+ // 11.4 娣诲姞鏃堕棿鎴冲拰鎻愮ず淇℃伅
+ markdownContent.AppendLine($"**鎶ュ憡鏃堕棿锛�** {currentTime:yyyy-MM-dd HH:mm:ss}");
+ if (warehouseId == 7)
+ {
+ markdownContent.AppendLine("**澶囨敞锛�** 璇锋垚鍝佷粨绠$悊浜哄憳鍙婃椂澶勭悊瓒呰繃90澶╂湭浣跨敤鐨勬垚鍝併��");
+ }
+ else
+ {
+ markdownContent.AppendLine("**澶囨敞锛�** 璇风浉鍏充粨搴撶鐞嗕汉鍛樺強鏃跺鐞嗕互涓婄墿鏂欍��");
+ }
+
+ var messageContent = markdownContent.ToString();
+
+ // 11.5 鐢熸垚閽夐拤娑堟伅鎵�闇�鐨勬椂闂存埑鍜岀鍚�
var timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
var sign = GenerateSign(timestamp, secret);
- var url = $"{webhookUrl.Split('?')[0]}?access_token={new Uri(webhookUrl).Query.Split('=')[1]}×tamp={timestamp}&sign={sign}";
+ // 11.6 鏋勫缓閽夐拤璇锋眰URL
+ var uri = new Uri(webhookUrl);
+ var token = System.Web.HttpUtility.ParseQueryString(uri.Query)["access_token"];
+ var baseUrl = uri.GetLeftPart(UriPartial.Path);
+ var url = $"{baseUrl}?access_token={token}×tamp={timestamp}&sign={sign}";
- // 鏋勫缓璇锋眰浣擄紙绗﹀悎閽夐拤text绫诲瀷娑堟伅鏍煎紡锛�
+ // 11.7 鏋勫缓璇锋眰浣擄紙浣跨敤markdown鏍煎紡锛�
var requestBody = new
{
- msgtype = "text",
- text = new { content = messageContent }
+ msgtype = "markdown",
+ markdown = new
+ {
+ title = $"{warehouseName}鐗╂枡鎻愰啋",
+ text = messageContent
+ },
+ at = new
+ {
+ // 鍙互鎸囧畾@鏌愪簺浜猴紝濡傛灉涓嶉渶瑕佸彲浠ュ垹闄よ繖閮ㄥ垎
+ // atMobiles = new[] { "138xxxx8888" },
+ // isAtAll = false
+ }
};
+
var jsonBody = JsonConvert.SerializeObject(requestBody);
var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
+ // 11.8 鍙戦�丳OST璇锋眰骞跺鐞嗗搷搴�
var response = await httpClient.PostAsync(url, content);
if (!response.IsSuccessStatusCode)
{
var errorContent = await response.Content.ReadAsStringAsync();
throw new Exception($"銆恵warehouseName}銆戞秷鎭彂閫佸け璐ワ紝鐘舵�佺爜锛歿response.StatusCode}锛岄敊璇俊鎭細{errorContent}");
}
+
+ // 閬垮厤鍙戦�侀鐜囪繃蹇�
+ await Task.Delay(1000);
}
}
}
catch (Exception ex)
{
+ // 鎹曡幏寮傚父骞惰ˉ鍏呬笂涓嬫枃锛屼究浜庨棶棰樺畾浣�
throw new Exception($"閽夐拤娑堟伅鎺ㄩ�佹暣浣撳け璐ワ紝閿欒璇︽儏锛歿ex.Message}", ex);
}
}
-
- /// <summary>
- /// 鐢熸垚鍔犵绛惧悕
- /// </summary>
- /// <param name="timestamp">鏃堕棿鎴�</param>
- /// <returns>绛惧悕</returns>
- private string GenerateSign(long timestamp,string secret)
+ // 閽夐拤绛惧悕鐢熸垚鏂规硶
+ private string GenerateSign(long timestamp, string secret)
{
var stringToSign = $"{timestamp}\n{secret}";
- using (var hmacsha256 = new System.Security.Cryptography.HMACSHA256(Encoding.UTF8.GetBytes(secret)))
+ using (var hmac = new System.Security.Cryptography.HMACSHA256(Encoding.UTF8.GetBytes(secret)))
{
- var hashBytes = hmacsha256.ComputeHash(Encoding.UTF8.GetBytes(stringToSign));
- return Convert.ToBase64String(hashBytes).Replace("+", "%2B").Replace("/", "%2F");
+ var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign));
+ return Convert.ToBase64String(hash);
}
}
+
}
}
--
Gitblit v1.9.3