2025-11-14 11:40:09 +08:00
|
|
|
|
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;
|
|
|
|
|
|
private IPurchaseStockInService _purchaseStockInService;
|
|
|
|
|
|
private ISalesOutboundService _salesOutboundService;
|
|
|
|
|
|
private ISalesReturnService _salesReturnService;
|
|
|
|
|
|
private IPurchaseReturnService _purchaseReturnService;
|
|
|
|
|
|
|
|
|
|
|
|
public TestController(IJackYunTaskService jackYunTaskService, IWMSService wMSService
|
|
|
|
|
|
, IJackYunStockinService jackYunStockinService, IOrderPushService orderPushService
|
|
|
|
|
|
, IPurchaseStockInService purchaseStockInService, ISalesOutboundService salesOutboundService
|
|
|
|
|
|
, ISalesReturnService salesReturnService, IPurchaseReturnService purchaseReturnService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_jackYunTaskService = jackYunTaskService;
|
|
|
|
|
|
_wMSService = wMSService;
|
|
|
|
|
|
_jackYunStockinService = jackYunStockinService;
|
|
|
|
|
|
_orderPushService = orderPushService;
|
|
|
|
|
|
_purchaseStockInService = purchaseStockInService;
|
|
|
|
|
|
_salesOutboundService = salesOutboundService;
|
|
|
|
|
|
_salesReturnService = salesReturnService;
|
|
|
|
|
|
_purchaseReturnService = purchaseReturnService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 测试推送销售数据到金蝶云星空和WMS
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public string TaskSendKingdeeSaleOrderById(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _orderPushService.PushOrderToKingDee(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 测试推送采购入库单到金蝶云星空
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public string TaskSendKingdeePurchaseStockInById(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _purchaseStockInService.PushPurchaseStockInToKingDee(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 测试推送销售出库单到金蝶云星空
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public string TaskSendKingdeeSalesOutboundById(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _salesOutboundService.PushSalesOutboundToKingDee(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 测试推送销售退货单到金蝶云星空
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public string TaskSendKingdeeSalesReturnById(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _salesReturnService.PushSalesReturnToKingDee(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 测试推送采购退料单到金蝶云星空
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public string TaskSendKingdeePurchaseReturnById(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _purchaseReturnService.PushPurchaseReturnToKingDee(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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 调度运行获取吉客云采购入库
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 调度运行获取吉客云采购入库
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public void GetPurchaseInboundData(string now)
|
|
|
|
|
|
{
|
|
|
|
|
|
_jackYunTaskService.GetPurchaseInboundData(now);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2025-11-21 18:09:44 +08:00
|
|
|
|
#region 获取吉客云采购退料单
|
2025-11-14 11:40:09 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2025-11-21 18:09:44 +08:00
|
|
|
|
/// 获取吉客云采购退料单
|
2025-11-14 11:40:09 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public void GetStorageGoodsDocOutV2(string now)
|
|
|
|
|
|
{
|
|
|
|
|
|
_jackYunTaskService.GetStorageGoodsDocOutV2(now);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 合并吉客云采购订单到新表
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 合并吉客云采购订单到新表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public string GetAndMergePushGoodsDocInOrder(string now)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _jackYunTaskService.GetAndMergePushGoodsDocInOrder(now);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|