更新采购退料相关服务:添加IPurchaseReturnService接口和PurchaseReturnService实现类
This commit is contained in:
parent
54d0d2e82c
commit
6a6546129f
@ -1,143 +1,143 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购退料单模型
|
||||
/// </summary>
|
||||
public class PurchaseReturnModel
|
||||
{
|
||||
public int? FID { get; set; }
|
||||
public FBillTypeID FBillTypeID { get; set; }
|
||||
public string FDate { get; set; }
|
||||
public string FMRTYPE { get; set; }
|
||||
public string FMRMODE { get; set; }
|
||||
public FStockOrgId FStockOrgId { get; set; }
|
||||
public bool? FIsConvert { get; set; }
|
||||
public FRequireOrgId FRequireOrgId { get; set; }
|
||||
public FPurchaseOrgId FPurchaseOrgId { get; set; }
|
||||
public FSupplierID FSupplierID { get; set; }
|
||||
public FACCEPTORID FACCEPTORID { get; set; }
|
||||
public string FAcceptAddress { get; set; }
|
||||
public FSettleId FSettleId { get; set; }
|
||||
public FCHARGEID FCHARGEID { get; set; }
|
||||
public string FOwnerTypeIdHead { get; set; }
|
||||
public FOwnerIdHead FOwnerIdHead { get; set; }
|
||||
public int? FCDateOffsetValue { get; set; }
|
||||
public FAcceptorContactID FAcceptorContactID { get; set; }
|
||||
public FSalOutStockOrgId FSalOutStockOrgId { get; set; }
|
||||
public string FACCTYPE { get; set; }
|
||||
public FPURMRBFIN FPURMRBFIN { get; set; }
|
||||
public List<FPURMRBENTRY> FPURMRBENTRY { get; set; }
|
||||
}
|
||||
|
||||
public class FRequireOrgId
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FSupplierID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FACCEPTORID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FSettleId
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FCHARGEID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FAcceptorContactID
|
||||
{
|
||||
public string FCONTACTNUMBER { get; set; }
|
||||
}
|
||||
|
||||
public class FPURMRBFIN
|
||||
{
|
||||
public FSettleOrgId FSettleOrgId { get; set; }
|
||||
public FSettleCurrId FSettleCurrId { get; set; }
|
||||
public bool? FIsIncludedTax { get; set; }
|
||||
public string FPRICETIMEPOINT { get; set; }
|
||||
public FLOCALCURRID FLOCALCURRID { get; set; }
|
||||
public FEXCHANGETYPEID FEXCHANGETYPEID { get; set; }
|
||||
public decimal? FEXCHANGERATE { get; set; }
|
||||
public bool? FISPRICEEXCLUDETAX { get; set; }
|
||||
public decimal? FHSExchangeRate { get; set; }
|
||||
}
|
||||
|
||||
public class FLOCALCURRID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FEXCHANGETYPEID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FPURMRBENTRY
|
||||
{
|
||||
public string FRowType { get; set; }
|
||||
public FMATERIALID FMATERIALID { get; set; }
|
||||
public string FMaterialDesc { get; set; }
|
||||
public FUnitID FUnitID { get; set; }
|
||||
public decimal? FRMREALQTY { get; set; }
|
||||
public decimal? FREPLENISHQTY { get; set; }
|
||||
public decimal? FKEAPAMTQTY { get; set; }
|
||||
public FPRICEUNITID FPRICEUNITID { get; set; }
|
||||
public decimal? FPrice { get; set; }
|
||||
public decimal? FExtAuxUnitQty { get; set; }
|
||||
public bool? FIsReceiveUpdateStock { get; set; }
|
||||
public decimal? FInvoicedJoinQty { get; set; }
|
||||
public bool? FGiveAway { get; set; }
|
||||
public decimal? FPriceBaseQty { get; set; }
|
||||
public FCARRYUNITID FCARRYUNITID { get; set; }
|
||||
public decimal? FCarryQty { get; set; }
|
||||
public decimal? FCarryBaseQty { get; set; }
|
||||
public int? FPOORDERENTRYID { get; set; }
|
||||
public bool? FBILLINGCLOSE { get; set; }
|
||||
public decimal? FRMMUSTQTY { get; set; }
|
||||
public decimal? FAUXUNITQTY { get; set; }
|
||||
public string FOWNERTYPEID { get; set; }
|
||||
public FOwnerId FOWNERID { get; set; }
|
||||
public decimal? FENTRYTAXRATE { get; set; }
|
||||
public decimal? FDISCOUNTRATE { get; set; }
|
||||
public decimal? FTAXPRICE { get; set; }
|
||||
public decimal? FPriceDiscount { get; set; }
|
||||
public int? FReturnStockEntryId { get; set; }
|
||||
public bool? FIsStock { get; set; }
|
||||
public string FSRCBillTypeId { get; set; }
|
||||
public string FSRCBillNo { get; set; }
|
||||
public int? FSUBREQBILLSEQ { get; set; }
|
||||
public int? FSUBREQENTRYID { get; set; }
|
||||
}
|
||||
|
||||
public class FMATERIALID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FPRICEUNITID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FCARRYUNITID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MyCode.Project.Domain.Message.Request.KingDee.SaveModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购退料单模型
|
||||
/// </summary>
|
||||
public class PurchaseReturnModel
|
||||
{
|
||||
public int? FID { get; set; }
|
||||
public FBillTypeID FBillTypeID { get; set; }
|
||||
public string FDate { get; set; }
|
||||
public string FMRTYPE { get; set; }
|
||||
public string FMRMODE { get; set; }
|
||||
public FStockOrgId FStockOrgId { get; set; }
|
||||
public bool? FIsConvert { get; set; }
|
||||
public FRequireOrgId FRequireOrgId { get; set; }
|
||||
public FPurchaseOrgId FPurchaseOrgId { get; set; }
|
||||
public FSupplierID FSupplierID { get; set; }
|
||||
public FACCEPTORID FACCEPTORID { get; set; }
|
||||
public string FAcceptAddress { get; set; }
|
||||
public FSettleId FSettleId { get; set; }
|
||||
public FCHARGEID FCHARGEID { get; set; }
|
||||
public string FOwnerTypeIdHead { get; set; }
|
||||
public FOwnerIdHead FOwnerIdHead { get; set; }
|
||||
public int? FCDateOffsetValue { get; set; }
|
||||
public FAcceptorContactID FAcceptorContactID { get; set; }
|
||||
public FSalOutStockOrgId FSalOutStockOrgId { get; set; }
|
||||
public string FACCTYPE { get; set; }
|
||||
public FPURMRBFIN FPURMRBFIN { get; set; }
|
||||
public List<FPURMRBENTRY> FPURMRBENTRY { get; set; }
|
||||
}
|
||||
|
||||
public class FRequireOrgId
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FSupplierID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FACCEPTORID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FSettleId
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FCHARGEID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FAcceptorContactID
|
||||
{
|
||||
public string FCONTACTNUMBER { get; set; }
|
||||
}
|
||||
|
||||
public class FPURMRBFIN
|
||||
{
|
||||
public FSettleOrgId FSettleOrgId { get; set; }
|
||||
public FSettleCurrId FSettleCurrId { get; set; }
|
||||
public bool? FIsIncludedTax { get; set; }
|
||||
public string FPRICETIMEPOINT { get; set; }
|
||||
public FLOCALCURRID FLOCALCURRID { get; set; }
|
||||
public FEXCHANGETYPEID FEXCHANGETYPEID { get; set; }
|
||||
public decimal? FEXCHANGERATE { get; set; }
|
||||
public bool? FISPRICEEXCLUDETAX { get; set; }
|
||||
public decimal? FHSExchangeRate { get; set; }
|
||||
}
|
||||
|
||||
public class FLOCALCURRID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FEXCHANGETYPEID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FPURMRBENTRY
|
||||
{
|
||||
public string FRowType { get; set; }
|
||||
public FMATERIALID FMATERIALID { get; set; }
|
||||
public string FMaterialDesc { get; set; }
|
||||
public FUnitID FUnitID { get; set; }
|
||||
public decimal? FRMREALQTY { get; set; }
|
||||
public decimal? FREPLENISHQTY { get; set; }
|
||||
public decimal? FKEAPAMTQTY { get; set; }
|
||||
public FPRICEUNITID FPRICEUNITID { get; set; }
|
||||
public decimal? FPrice { get; set; }
|
||||
public decimal? FExtAuxUnitQty { get; set; }
|
||||
public bool? FIsReceiveUpdateStock { get; set; }
|
||||
public decimal? FInvoicedJoinQty { get; set; }
|
||||
public bool? FGiveAway { get; set; }
|
||||
public decimal? FPriceBaseQty { get; set; }
|
||||
public FCARRYUNITID FCARRYUNITID { get; set; }
|
||||
public decimal? FCarryQty { get; set; }
|
||||
public decimal? FCarryBaseQty { get; set; }
|
||||
public int? FPOORDERENTRYID { get; set; }
|
||||
public bool? FBILLINGCLOSE { get; set; }
|
||||
public decimal? FRMMUSTQTY { get; set; }
|
||||
public decimal? FAUXUNITQTY { get; set; }
|
||||
public string FOWNERTYPEID { get; set; }
|
||||
public FOwnerId FOWNERID { get; set; }
|
||||
public decimal? FENTRYTAXRATE { get; set; }
|
||||
public decimal? FDISCOUNTRATE { get; set; }
|
||||
public decimal? FTAXPRICE { get; set; }
|
||||
public decimal? FPriceDiscount { get; set; }
|
||||
public int? FReturnStockEntryId { get; set; }
|
||||
public bool? FIsStock { get; set; }
|
||||
public string FSRCBillTypeId { get; set; }
|
||||
public string FSRCBillNo { get; set; }
|
||||
public int? FSUBREQBILLSEQ { get; set; }
|
||||
public int? FSUBREQENTRYID { get; set; }
|
||||
}
|
||||
|
||||
public class FMATERIALID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FPRICEUNITID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
|
||||
public class FCARRYUNITID
|
||||
{
|
||||
public string FNumber { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MyCode.Project.Services.IServices
|
||||
{
|
||||
public interface IPurchaseReturnService
|
||||
{
|
||||
/// <summary>
|
||||
/// 推送采购退料单到金蝶云星空
|
||||
/// </summary>
|
||||
/// <param name="id">StorageGoodsDocOutHead表的主键ID(Guid格式的字符串)</param>
|
||||
/// <returns>返回金蝶API的响应结果(JSON格式)</returns>
|
||||
string PushPurchaseReturnToKingDee(string id);
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MyCode.Project.Services.IServices
|
||||
{
|
||||
public interface IPurchaseReturnService
|
||||
{
|
||||
/// <summary>
|
||||
/// 推送采购退料单到金蝶云星空
|
||||
/// </summary>
|
||||
/// <param name="id">StorageGoodsDocOutHead表的主键ID(Guid格式的字符串)</param>
|
||||
/// <returns>返回金蝶API的响应结果(JSON格式)</returns>
|
||||
string PushPurchaseReturnToKingDee(string id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ namespace MyCode.Project.Services.Implementation
|
||||
, IJackYunService jackYunService
|
||||
, IKingDeeService kingDeeService,
|
||||
IWorkProcessService workProcessService)
|
||||
{洋浦
|
||||
{
|
||||
_yTKJTShopParameterRepository = yTKJTShopParameterRepository;
|
||||
_pushKingDeeOrderRepository = pushKingDeeOrderRepository;
|
||||
_pushKingDeeOrderItemRepository = pushKingDeeOrderItemRepository;
|
||||
|
||||
@ -0,0 +1,381 @@
|
||||
using MyCode.Project.Domain.Message.Request.KingDee;
|
||||
using MyCode.Project.Domain.Message.Request.KingDee.SaveModel;
|
||||
using MyCode.Project.Domain.Message.Response.KingDee.K3Result;
|
||||
using MyCode.Project.Domain.Message.Response.KingDee.K3Result.Model;
|
||||
using MyCode.Project.Domain.Model;
|
||||
using MyCode.Project.Domain.Repositories;
|
||||
using MyCode.Project.Infrastructure.Common;
|
||||
using MyCode.Project.Infrastructure.Exceptions;
|
||||
using MyCode.Project.OutSideService;
|
||||
using MyCode.Project.Services.IServices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MyCode.Project.Services.Implementation
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购退料单服务实现
|
||||
/// 功能:处理采购退料单推送到金蝶云星空的业务逻辑
|
||||
/// </summary>
|
||||
public class PurchaseReturnService : ServiceBase, IPurchaseReturnService
|
||||
{
|
||||
private const string BILL_TYPE_CODE = "TLD01_SYS";
|
||||
private const string OWNER_TYPE = "BD_OwnerOrg";
|
||||
private const string EXCHANGE_TYPE = "HLTX01_SYS";
|
||||
private const string DEFAULT_ORG = "100";
|
||||
private const string DEFAULT_CURRENCY = "PRE001";
|
||||
private const string DEFAULT_UNIT = "Pcs";
|
||||
private const string ROW_TYPE_STANDARD = "Standard";
|
||||
private const string ROW_TYPE_SERVICE = "Service";
|
||||
private const string FORM_ID = "PUR_MRB";
|
||||
private const string MR_TYPE = "B";
|
||||
private const string MR_MODE = "A";
|
||||
private const string ACCT_TYPE = "Q";
|
||||
private const int INOUT_TYPE_PURCHASE_RETURN = 205; // 采购退货
|
||||
|
||||
private IStorageGoodsDocOutHeadRepository _storageGoodsDocOutHeadRepository;
|
||||
private IStorageGoodsDocOutDetailRepository _storageGoodsDocOutDetailRepository;
|
||||
private IYTKJTShopParameterRepository _yTKJTShopParameterRepository;
|
||||
private IKingDeeService _kingDeeService;
|
||||
|
||||
public PurchaseReturnService(
|
||||
IStorageGoodsDocOutHeadRepository storageGoodsDocOutHeadRepository,
|
||||
IStorageGoodsDocOutDetailRepository storageGoodsDocOutDetailRepository,
|
||||
IYTKJTShopParameterRepository yTKJTShopParameterRepository,
|
||||
IKingDeeService kingDeeService)
|
||||
{
|
||||
_storageGoodsDocOutHeadRepository = storageGoodsDocOutHeadRepository;
|
||||
_storageGoodsDocOutDetailRepository = storageGoodsDocOutDetailRepository;
|
||||
_yTKJTShopParameterRepository = yTKJTShopParameterRepository;
|
||||
_kingDeeService = kingDeeService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送采购退料单到金蝶云星空
|
||||
/// </summary>
|
||||
/// <param name="id">StorageGoodsDocOutHead表的主键ID(Guid格式的字符串)</param>
|
||||
/// <returns>返回金蝶API的响应结果(JSON格式)</returns>
|
||||
public string PushPurchaseReturnToKingDee(string id)
|
||||
{
|
||||
var outHead = _storageGoodsDocOutHeadRepository
|
||||
.Queryable()
|
||||
.Where(t => id == t.Id.ToString())
|
||||
.First();
|
||||
|
||||
if (outHead == null)
|
||||
{
|
||||
throw new BaseException($"未找到ID为 {id} 的采购退料单记录");
|
||||
}
|
||||
|
||||
if (outHead.Status != 0 && outHead.Status != 1)
|
||||
{
|
||||
throw new BaseException($"采购退料单 {outHead.GoodsdocNo} 已经推送过,状态为:{outHead.Status},不允许重复推送");
|
||||
}
|
||||
|
||||
// 校验出库类型是否为采购退货
|
||||
if (outHead.Inouttype != INOUT_TYPE_PURCHASE_RETURN)
|
||||
{
|
||||
throw new BaseException($"出库单类型 {outHead.Inouttype} 不是采购退货(Inouttype应为205),无法推送");
|
||||
}
|
||||
|
||||
var param = _yTKJTShopParameterRepository
|
||||
.Queryable()
|
||||
.Where(t => t.FDOCUMENTSTATUS == "C")
|
||||
.First();
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new BaseException("没有找到已审核的门店参数配置,请联系管理员检查门店参数表");
|
||||
}
|
||||
|
||||
// 检查采购退货单同步配置(使用采购入库单的配置字段,如果没有则使用通用配置)
|
||||
string syncConfig = param.FPURCHASERETURNORDER ?? param.FSYNCHRONIZEKINGDEE;
|
||||
if (syncConfig == "0")
|
||||
{
|
||||
throw new BaseException("门店参数配置中采购退料单同步功能未启用,请联系管理员检查门店参数配置");
|
||||
}
|
||||
|
||||
if (syncConfig == "1")
|
||||
{
|
||||
var response = PushKingdeePurchaseReturn(outHead, param);
|
||||
string result = JsonHelper.ToJson(response);
|
||||
|
||||
if (response.IsSuccess)
|
||||
{
|
||||
outHead.Status = 2;
|
||||
_storageGoodsDocOutHeadRepository.Update(outHead);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送到金蝶云星空
|
||||
/// </summary>
|
||||
private K3CloudResponseStatus PushKingdeePurchaseReturn(StorageGoodsDocOutHead outHead, YTKJTShopParameter param)
|
||||
{
|
||||
// 从StorageGoodsDocOutDetail表获取明细数据
|
||||
var detailList = _storageGoodsDocOutDetailRepository
|
||||
.Queryable()
|
||||
.Where(t => outHead.Id == t.HeadId)
|
||||
.ToList();
|
||||
|
||||
if (detailList == null || detailList.Count == 0)
|
||||
{
|
||||
throw new BaseException($"采购退料单 {outHead.GoodsdocNo} 没有找到明细数据,无法推送");
|
||||
}
|
||||
|
||||
// 校验供应商编码(从VendCustomerId获取)
|
||||
if (string.IsNullOrEmpty(outHead.VendCustomerId))
|
||||
{
|
||||
throw new BaseException($"采购退料单 {outHead.GoodsdocNo} 供应商编码为空,无法推送");
|
||||
}
|
||||
|
||||
// 获取采购组织ID
|
||||
string purchaseOrgId = param.FPURCHASEORGID?.ToString() ?? param.FSALEORGID?.ToString() ?? DEFAULT_ORG;
|
||||
|
||||
// 获取仓库编码
|
||||
string warehouseCode = outHead.WarehouseCode ?? param.FPURCHASINGWAREHOUSECODE ?? "";
|
||||
|
||||
if (string.IsNullOrEmpty(warehouseCode))
|
||||
{
|
||||
throw new BaseException($"采购退料单 {outHead.GoodsdocNo} 仓库编码为空,无法推送");
|
||||
}
|
||||
|
||||
// 构建金蝶API的明细行数据
|
||||
var entryList = detailList.Select(n => BuildEntryItem(n, param, purchaseOrgId, outHead)).ToList();
|
||||
|
||||
if (entryList.Count == 0)
|
||||
{
|
||||
throw new BaseException($"采购退料单 {outHead.GoodsdocNo} 明细数据转换失败,无法推送");
|
||||
}
|
||||
|
||||
// 构建金蝶API的主表数据
|
||||
var model = BuildMainModel(outHead, param, purchaseOrgId, entryList);
|
||||
|
||||
// 构建金蝶API请求对象
|
||||
BillSave billSave = new BillSave()
|
||||
{
|
||||
Model = model,
|
||||
IsAutoSubmitAndAudit = true,
|
||||
};
|
||||
|
||||
// 调用金蝶服务保存单据
|
||||
var responseStatus = _kingDeeService.Save(FORM_ID, billSave);
|
||||
return responseStatus;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构建明细行数据
|
||||
/// </summary>
|
||||
private FPURMRBENTRY BuildEntryItem(StorageGoodsDocOutDetail detail, YTKJTShopParameter param, string orgId, StorageGoodsDocOutHead outHead)
|
||||
{
|
||||
// 根据物料类型动态设置FRowType(如果物料名称包含"服务"或"费用"等关键字,则设置为Service,否则为Standard)
|
||||
string rowType = ROW_TYPE_STANDARD;
|
||||
if (!string.IsNullOrEmpty(detail.GoodsName))
|
||||
{
|
||||
string goodsName = detail.GoodsName.ToUpper();
|
||||
if (goodsName.Contains("服务") || goodsName.Contains("费用") || goodsName.Contains("运费") ||
|
||||
goodsName.Contains("SERVICE") || goodsName.Contains("FEE") || goodsName.Contains("FREIGHT"))
|
||||
{
|
||||
rowType = ROW_TYPE_SERVICE;
|
||||
}
|
||||
}
|
||||
|
||||
// 计算数量
|
||||
decimal realQty = Math.Abs(detail.Quantity ?? 0);
|
||||
|
||||
// 计算含税单价
|
||||
decimal taxPrice = detail.EstPrice ?? 0;
|
||||
|
||||
// 计算无税单价
|
||||
decimal taxRate = detail.TaxRate ?? param.FTAXRATE;
|
||||
decimal price = taxRate > 0 && taxPrice > 0 ? Math.Round(taxPrice / (1 + taxRate / 100), 10) : taxPrice;
|
||||
|
||||
return new FPURMRBENTRY()
|
||||
{
|
||||
FRowType = rowType,
|
||||
FMATERIALID = new FMATERIALID()
|
||||
{
|
||||
FNumber = detail.SkuBarcode ?? ""
|
||||
},
|
||||
FMaterialDesc = detail.GoodsName ?? "",
|
||||
FUnitID = new FUnitID()
|
||||
{
|
||||
FNumber = detail.UnitName ?? DEFAULT_UNIT
|
||||
},
|
||||
FRMREALQTY = realQty,
|
||||
FREPLENISHQTY = 0,
|
||||
FKEAPAMTQTY = 0,
|
||||
FPRICEUNITID = new FPRICEUNITID()
|
||||
{
|
||||
FNumber = detail.UnitName ?? DEFAULT_UNIT
|
||||
},
|
||||
FPrice = price,
|
||||
FExtAuxUnitQty = 0,
|
||||
FIsReceiveUpdateStock = false,
|
||||
FInvoicedJoinQty = 0,
|
||||
FGiveAway = false,
|
||||
FPriceBaseQty = realQty,
|
||||
FCARRYUNITID = new FCARRYUNITID()
|
||||
{
|
||||
FNumber = detail.UnitName ?? DEFAULT_UNIT
|
||||
},
|
||||
FCarryQty = 0,
|
||||
FCarryBaseQty = 0,
|
||||
FPOORDERENTRYID = 0,
|
||||
FBILLINGCLOSE = false,
|
||||
FRMMUSTQTY = realQty,
|
||||
FAUXUNITQTY = 0,
|
||||
FOWNERTYPEID = OWNER_TYPE,
|
||||
FOWNERID = new FOwnerId()
|
||||
{
|
||||
FNumber = orgId
|
||||
},
|
||||
FENTRYTAXRATE = taxRate,
|
||||
FDISCOUNTRATE = 0,
|
||||
FTAXPRICE = taxPrice,
|
||||
FPriceDiscount = 0,
|
||||
FReturnStockEntryId = 0,
|
||||
FIsStock = false,
|
||||
FSRCBillTypeId = "",
|
||||
FSRCBillNo = detail.SourceDetailId ?? outHead.SourceBillNo ?? "",
|
||||
FSUBREQBILLSEQ = 0,
|
||||
FSUBREQENTRYID = 0
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构建主表数据
|
||||
/// </summary>
|
||||
private PurchaseReturnModel BuildMainModel(StorageGoodsDocOutHead outHead, YTKJTShopParameter param, string orgId, List<FPURMRBENTRY> entryList)
|
||||
{
|
||||
// 解析出库日期
|
||||
DateTime? outDate = null;
|
||||
if (!string.IsNullOrEmpty(outHead.InOutDate))
|
||||
{
|
||||
if (DateTime.TryParse(outHead.InOutDate, out DateTime parsedDate))
|
||||
{
|
||||
outDate = parsedDate;
|
||||
}
|
||||
}
|
||||
string dateStr = outDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 获取供应商编码
|
||||
string supplierCode = outHead.VendCustomerId ?? "";
|
||||
|
||||
// 构建收货地址(从收件人地址字段组合)
|
||||
string acceptAddress = BuildAcceptAddress(outHead);
|
||||
|
||||
return new PurchaseReturnModel()
|
||||
{
|
||||
FID = 0,
|
||||
FBillTypeID = new FBillTypeID()
|
||||
{
|
||||
FNUMBER = BILL_TYPE_CODE
|
||||
},
|
||||
FDate = dateStr,
|
||||
FMRTYPE = MR_TYPE,
|
||||
FMRMODE = MR_MODE,
|
||||
FStockOrgId = new FStockOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
},
|
||||
FIsConvert = false,
|
||||
FRequireOrgId = new FRequireOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
},
|
||||
FPurchaseOrgId = new FPurchaseOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
},
|
||||
FSupplierID = !string.IsNullOrEmpty(supplierCode) ? new FSupplierID()
|
||||
{
|
||||
FNumber = supplierCode
|
||||
} : null,
|
||||
FACCEPTORID = !string.IsNullOrEmpty(supplierCode) ? new FACCEPTORID()
|
||||
{
|
||||
FNumber = supplierCode
|
||||
} : null,
|
||||
FAcceptAddress = acceptAddress,
|
||||
FSettleId = !string.IsNullOrEmpty(supplierCode) ? new FSettleId()
|
||||
{
|
||||
FNumber = supplierCode
|
||||
} : null,
|
||||
FCHARGEID = !string.IsNullOrEmpty(supplierCode) ? new FCHARGEID()
|
||||
{
|
||||
FNumber = supplierCode
|
||||
} : null,
|
||||
FOwnerTypeIdHead = OWNER_TYPE,
|
||||
FOwnerIdHead = new FOwnerIdHead()
|
||||
{
|
||||
FNumber = orgId
|
||||
},
|
||||
FCDateOffsetValue = 0,
|
||||
FAcceptorContactID = null, // 如果需要联系人,可以从其他字段获取
|
||||
FSalOutStockOrgId = new FSalOutStockOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
},
|
||||
FACCTYPE = ACCT_TYPE,
|
||||
FPURMRBFIN = new FPURMRBFIN()
|
||||
{
|
||||
FSettleOrgId = new FSettleOrgId()
|
||||
{
|
||||
FNumber = orgId
|
||||
},
|
||||
FSettleCurrId = new FSettleCurrId()
|
||||
{
|
||||
FNumber = outHead.CurrencyCode ?? DEFAULT_CURRENCY
|
||||
},
|
||||
FIsIncludedTax = true,
|
||||
FPRICETIMEPOINT = "1",
|
||||
FLOCALCURRID = new FLOCALCURRID()
|
||||
{
|
||||
FNumber = outHead.CurrencyCode ?? DEFAULT_CURRENCY
|
||||
},
|
||||
FEXCHANGETYPEID = new FEXCHANGETYPEID()
|
||||
{
|
||||
FNumber = EXCHANGE_TYPE
|
||||
},
|
||||
FEXCHANGERATE = outHead.CurrencyRate ?? 1m,
|
||||
FISPRICEEXCLUDETAX = true,
|
||||
FHSExchangeRate = 1m
|
||||
},
|
||||
FPURMRBENTRY = entryList
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构建收货地址
|
||||
/// </summary>
|
||||
private string BuildAcceptAddress(StorageGoodsDocOutHead outHead)
|
||||
{
|
||||
if (string.IsNullOrEmpty(outHead.ReceiveAddress))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
// 组合地址信息
|
||||
var addressParts = new List<string>();
|
||||
if (!string.IsNullOrEmpty(outHead.ReceiveProvinceName))
|
||||
addressParts.Add(outHead.ReceiveProvinceName);
|
||||
if (!string.IsNullOrEmpty(outHead.ReceiveCityName))
|
||||
addressParts.Add(outHead.ReceiveCityName);
|
||||
if (!string.IsNullOrEmpty(outHead.ReceiveTownName))
|
||||
addressParts.Add(outHead.ReceiveTownName);
|
||||
if (!string.IsNullOrEmpty(outHead.ReceiveStreetName))
|
||||
addressParts.Add(outHead.ReceiveStreetName);
|
||||
if (!string.IsNullOrEmpty(outHead.ReceiveAddress))
|
||||
addressParts.Add(outHead.ReceiveAddress);
|
||||
|
||||
return string.Join("", addressParts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,329 +1,341 @@
|
||||
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;
|
||||
|
||||
public TestController(IJackYunTaskService jackYunTaskService, IWMSService wMSService
|
||||
, IJackYunStockinService jackYunStockinService, IOrderPushService orderPushService
|
||||
, IPurchaseStockInService purchaseStockInService, ISalesOutboundService salesOutboundService
|
||||
, ISalesReturnService salesReturnService)
|
||||
{
|
||||
_jackYunTaskService = jackYunTaskService;
|
||||
_wMSService = wMSService;
|
||||
_jackYunStockinService = jackYunStockinService;
|
||||
_orderPushService = orderPushService;
|
||||
_purchaseStockInService = purchaseStockInService;
|
||||
_salesOutboundService = salesOutboundService;
|
||||
_salesReturnService = salesReturnService;
|
||||
}
|
||||
|
||||
/// <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);
|
||||
}
|
||||
|
||||
|
||||
#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
|
||||
|
||||
#region 调度运行吉客云采购出库单
|
||||
|
||||
/// <summary>
|
||||
/// 调度运行吉客云采购出库单
|
||||
/// </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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
#region 调度运行吉客云采购出库单
|
||||
|
||||
/// <summary>
|
||||
/// 调度运行吉客云采购出库单
|
||||
/// </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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user