255 lines
7.2 KiB
C#
255 lines
7.2 KiB
C#
using MyCode.Project.Domain.Model;
|
||
using MyCode.Project.Infrastructure.Common;
|
||
using MyCode.Project.Services;
|
||
using MyCode.Project.Services.Implementation;
|
||
using MyCode.Project.Services.IServices;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Text.RegularExpressions;
|
||
using System.Web.Http;
|
||
|
||
namespace MyCode.Project.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 测试接口
|
||
/// </summary>
|
||
public class TestController : BaseAPIController
|
||
{
|
||
|
||
private IJackYunTaskService _jackYunTaskService;
|
||
private IWMSService _wMSService;
|
||
private IJackYunStockinService _jackYunStockinService;
|
||
private IOrderPushService _orderPushService;
|
||
|
||
public TestController(IJackYunTaskService jackYunTaskService, IWMSService wMSService
|
||
, IJackYunStockinService jackYunStockinService, IOrderPushService orderPushService)
|
||
{
|
||
_jackYunTaskService = jackYunTaskService;
|
||
_wMSService = wMSService;
|
||
_jackYunStockinService = jackYunStockinService;
|
||
_orderPushService = orderPushService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 测试推送销售数据到金蝶云星空和WMS
|
||
/// </summary>
|
||
[HttpGet]
|
||
[AllowAnonymous]
|
||
public string TaskSendKingdeeSaleOrderById(string id)
|
||
{
|
||
return _orderPushService.PushOrderToKingDee(id);
|
||
}
|
||
|
||
|
||
#region 调度运行抓吉客云销售订单
|
||
|
||
/// <summary>
|
||
/// 调度运行抓吉客云销售订单
|
||
/// </summary>
|
||
[HttpGet]
|
||
[AllowAnonymous]
|
||
public void TaskGetJackYunOrder(string now)
|
||
{
|
||
_jackYunTaskService.TaskGetJackYunOrder(now);
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 调度运行抓吉客云退货订单
|
||
|
||
/// <summary>
|
||
/// 调度运行抓吉客云退货订单
|
||
/// </summary>
|
||
[HttpGet]
|
||
[AllowAnonymous]
|
||
public void TaskGetReturnChangeList(string now)
|
||
{
|
||
_jackYunTaskService.TaskGetReturnChangeList(now);
|
||
}
|
||
#endregion
|
||
|
||
#region 抓WMS订单
|
||
/// <summary>
|
||
/// 抓WMS订单
|
||
/// </summary>
|
||
[HttpGet]
|
||
[AllowAnonymous]
|
||
public List<WMStoJackyunInventoryMovementView1> GetList(DateTime now)
|
||
{
|
||
return _wMSService.GetList(now);
|
||
}
|
||
#endregion
|
||
|
||
#region 合并吉客云订单到新表
|
||
/// <summary>
|
||
/// 合并吉客云订单到新表
|
||
/// </summary>
|
||
[HttpGet]
|
||
[AllowAnonymous]
|
||
public string GetAndMergeJackYunOrder(string now)
|
||
{
|
||
return _jackYunTaskService.GetAndMergeJackYunOrder(now);
|
||
}
|
||
#endregion
|
||
|
||
#region 合并吉客云退货订单到新表
|
||
/// <summary>
|
||
/// 合并吉客云退货订单到新表
|
||
/// </summary>
|
||
[HttpGet]
|
||
[AllowAnonymous]
|
||
public string GetAndMergeJackReturnYunOrder(string now)
|
||
{
|
||
return _jackYunTaskService.GetAndMergeJackReturnYunOrder(now);
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 替换或添加URL中的端口号(支持指定协议)
|
||
/// </summary>
|
||
/// <param name="input"></param>
|
||
/// <param name="newPort"></param>
|
||
/// <param name="protocol"></param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
[AllowAnonymous]
|
||
public string ReplaceOrAddPortAdvanced(string input, string newPort, string protocol = "http")
|
||
{
|
||
// 构建协议特定的模式
|
||
string protocolPattern = string.IsNullOrEmpty(protocol) ? @"(https?|ftp)://" : $"{protocol}://";
|
||
|
||
// 匹配已有端口号
|
||
string patternWithPort = $@"({protocolPattern}[^/]+?):\d+";
|
||
// 匹配没有端口号
|
||
string patternWithoutPort = $@"({protocolPattern}[^/:/]+)(?=/|$)";
|
||
|
||
// 先尝试替换已有端口号
|
||
string result = Regex.Replace(input, patternWithPort, $"$1:{newPort}");
|
||
|
||
// 如果没有端口号被替换,尝试添加端口号
|
||
if (result == input)
|
||
result = Regex.Replace(input, patternWithoutPort, $"$1:{newPort}");
|
||
|
||
return result;
|
||
}
|
||
|
||
//#region 订单查询
|
||
|
||
///// <summary>
|
||
///// 订单查询
|
||
///// </summary>
|
||
//[HttpGet]
|
||
//[AllowAnonymous]
|
||
//public string testTradeFullInfoGet()
|
||
//{
|
||
// return _jackYunService.testTradeFullInfoGet();
|
||
//}
|
||
//#endregion
|
||
|
||
|
||
|
||
//#region 订单查询
|
||
|
||
///// <summary>
|
||
///// 订单查询2
|
||
///// </summary>
|
||
//[HttpGet]
|
||
//[AllowAnonymous]
|
||
//public List<TradesItem> testTradeFullInfoGet(DateTime now)
|
||
//{
|
||
// return _jackYunService.testTradeFullInfoGet(now);
|
||
//}
|
||
//#endregion
|
||
|
||
//#region AESEncrypt(AES加密)
|
||
///// <summary>
|
||
///// AES加密
|
||
///// </summary>
|
||
///// <param name="text"></param>
|
||
///// <returns></returns>
|
||
//[HttpGet]
|
||
//[AllowAnonymous]
|
||
//public string AESEncrypt(string text,string secretKey)
|
||
//{
|
||
// return AESHelper.AESEncrypt(text, secretKey);
|
||
//}
|
||
//#endregion
|
||
|
||
//#region AESDecrypt(AES解密)
|
||
///// <summary>
|
||
///// AES解密
|
||
///// </summary>
|
||
///// <param name="text"></param>
|
||
///// <returns></returns>
|
||
//[AllowAnonymous]
|
||
//[HttpGet]
|
||
//public string AESDecrypt(string text,string secretKey)
|
||
//{
|
||
// if (string.IsNullOrWhiteSpace(secretKey))
|
||
// {
|
||
// return AESHelper.AESDecrypt(text, "");
|
||
// }
|
||
// return AESHelper.AESDecrypt(text, secretKey);
|
||
|
||
//}
|
||
//#endregion
|
||
|
||
#region HtmLToXls(测试html转成xls)
|
||
/// <summary>
|
||
/// 测试html转成xls
|
||
/// </summary>
|
||
[AllowAnonymous]
|
||
[HttpGet]
|
||
public void HtmLToXls()
|
||
{
|
||
ExcelHelper.HtmlToExcel(@"D:\App_File\2.html", @"D:\App_File\2.xlsx");
|
||
}
|
||
#endregion
|
||
|
||
//#region ReportExportAnsy(异步执行导出,有带websocket异步推送)
|
||
///// <summary>
|
||
///// 异步执行导出,有带websocket异步推送
|
||
///// </summary>
|
||
///// <param name="obj"></param>
|
||
//[HttpPost]
|
||
//public void ReportExportAnsy(AnsyReportExportAct act)
|
||
//{
|
||
// _reportService.ReportExportAnsy(act);
|
||
//}
|
||
//#endregion
|
||
|
||
|
||
|
||
|
||
#region GenerateHS256Key(JWTKEY)
|
||
/// <summary>
|
||
/// GenerateHS256Key
|
||
/// </summary>
|
||
/// <param name="text"></param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
[AllowAnonymous]
|
||
public string GenerateHS256Key()
|
||
{
|
||
return JwtKeyGenerator.GenerateHS256Key();
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 调度运行上传申请出入库申请单
|
||
|
||
/// <summary>
|
||
/// 调度运行上传申请出入库申请单
|
||
/// </summary>
|
||
[HttpGet]
|
||
[AllowAnonymous]
|
||
public void TaskSendJackYunInOrOutStock(string sheet)
|
||
{
|
||
_jackYunStockinService.TaskSendInventoryMovement( sheet);
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
}
|
||
|