From f52bacd52cbc8f8250766d2910e638a8bf4dbcc8 Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期六, 22 六月 2024 16:59:12 +0800
Subject: [PATCH] 调用内部代码的定时任务
---
Wms/Wms/Controllers/UpApiController.cs | 83 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 79 insertions(+), 4 deletions(-)
diff --git a/Wms/Wms/Controllers/UpApiController.cs b/Wms/Wms/Controllers/UpApiController.cs
index ab24289..4929f8e 100644
--- a/Wms/Wms/Controllers/UpApiController.cs
+++ b/Wms/Wms/Controllers/UpApiController.cs
@@ -14,6 +14,12 @@
using Model.ModelVm.BllCheckVm;
using WMS.DAL;
using Microsoft.AspNetCore.Authorization;
+using Utility;
+using System.Collections.Generic;
+using System.Reflection.Emit;
+using System.Linq;
+using System.Text;
+using Newtonsoft.Json.Linq;
namespace Wms.Controllers
{
@@ -30,7 +36,7 @@
private readonly IArrivalNoticeServer _arrivalNoticeSvc;
private readonly IStockCheckServer _stockCheckSvc;//鐩樼偣鍗昐vc
private readonly IProcurePlanServer _procurePlanSvc;//閲囪喘鍗昐vs
- public UpApiController(IOptions<ApiUrlConfig> setting,IExportNoticeServer exNoticeSvc,IArrivalNoticeServer arrivalNoticeServer,IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc)
+ public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc)
{
_config = setting.Value;
_exNoticeSvc = exNoticeSvc;
@@ -77,7 +83,7 @@
/// <param name="model">鍏ュ簱鍗曞彿</param>
/// <returns></returns>
[HttpPost]
- public IActionResult FinishAsn(IdVm model)
+ public IActionResult FinishAsn(IdVm model)
{
try
{
@@ -124,7 +130,7 @@
return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- _arrivalNoticeSvc.ByPdaFinish(model.Code, model.Code.Substring(0,2) == "AS" ? _config.ErpHost + _config.AsnFinishUrl : _config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
+ _arrivalNoticeSvc.ByPdaFinish(model.Code, model.Code.Substring(0, 2) == "AS" ? _config.ErpHost + _config.AsnFinishUrl : _config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
return Ok(new { code = 0, count = 0, msg = "鍗曟嵁澶嶆牳骞朵笂浼犳垚鍔�" });
}
@@ -330,7 +336,7 @@
{
SoResInfo result = _exNoticeSvc.ErpAddExportNotice(model);
return Ok(result);
-
+
}
catch (Exception e)
{
@@ -413,6 +419,10 @@
#region 娴嬭瘯灏忔暟浣嶆暟鍊�
+ ///// <summary>
+ ///// 娴嬭瘯灏忔暟浣嶆暟鍊�
+ ///// </summary>
+ ///// <returns></returns>
//[HttpGet]
//public IActionResult Demo()
//{
@@ -433,6 +443,71 @@
// }
//}
+ /// <summary>
+ /// 娴嬭瘯楠岀鍔犲瘑
+ /// </summary>
+ /// <returns></returns>
+ [Verification]
+ [HttpPost]
+ public IActionResult Demo2(IdVm model)
+ {
+ var result = new ErpModel { Success = -1, Message = "" };
+ try
+ {
+ //var com = new Common();
+ //decimal s = 13.3450M;
+ //var sdf = com.GetViewVal(4, s);
+ result = new ErpModel { Success = -1, Message = "sdf.ToString()" };
+
+ return Ok(result);
+ }
+ catch (Exception e)
+ {
+ result.Message = e.Message;
+ return Ok(result);
+ }
+ }
+
+ [HttpGet]
+ [ServiceFilter(typeof(ApiResponseActionFilter))]
+ public string Demo3()
+ {
+ string jsonParams = "{\"param1\": \"value1\", \"param2\": \"value2\"}";
+
+ // 鐢熸垚鏃堕棿鎴筹紙Unix 鏃堕棿鎴筹級
+ var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
+
+ // 鐢熸垚绛惧悕
+ var signature = GenerateSignature(jsonParams);
+
+ // 杈撳嚭绛惧悕
+ Console.WriteLine("Generated Signature: " + signature);
+ return signature;
+ }
+
+ private static string GenerateSignature(string jsonParams)
+ {
+ var appKey = "90170307d4184844ac2a26b431f79980";
+ // 灏� JSON 瀛楃涓茶浆鎹负 JObject
+ JObject jObject = JObject.Parse(jsonParams);
+
+ // 杩囨护鎺夋暟缁勭被鍨嬬殑灞炴��
+ var filteredProperties = jObject.Properties()
+ .Where(p => p.Value.Type != JTokenType.Array)
+ .ToDictionary(p => p.Name, p => p.Value.ToString());
+
+ // 娣诲姞鏃堕棿鎴筹紙Unix 鏃堕棿鎴筹級
+ var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
+ filteredProperties.Add("timestamp", timestamp);
+ filteredProperties.Add("appKey", appKey);
+
+ // 鏋勫缓寰呯鍚嶅瓧绗︿覆
+ var signatureBaseString = string.Join("&", filteredProperties.OrderBy(p => p.Key).Select(p => p.Key + "=" + p.Value));
+
+ // 璁$畻 MD5 鍊�
+ var computedSignature = Md5Tools.CalcMd5(signatureBaseString);
+ return computedSignature;
+ }
#endregion
}
}
--
Gitblit v1.8.0