You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ds8-solution-pro/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportRuleEngineService.cs

59 lines
1.9 KiB
C#

using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.DjyRulesEngine;
using DS.WMS.Core.Op.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mapster;
namespace DS.WMS.Core.Op.Method
{
/// <summary>
/// 海运出口规则引擎接口
/// </summary>
public partial class SeaExportService
{
/// <summary>
/// 海运出口规则引擎校验
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<DataResult<RuleEngineResult>> ExcuteRuleEngine(string id)
{
var SenderKey = AppSetting.app(new string[] { "ExcuteRuleService", "SenderKey" }).ObjToString();
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<SeaExport>().Where(x => x.Id == long.Parse(id)).First();
if (info.IsNull())
return await Task.FromResult(DataResult<RuleEngineResult>.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist));
var mainInfo = info.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
var ctnlist = new List<RulesEngineOrderBookingContaInfo>();
var ctns= tenantDb.Queryable<OpCtn>().Where(x => x.BSNO == id).ToList();
if (ctns.Count > 0)
{
ctns.Adapt(ctnlist);
mainInfo.ContaList = ctnlist;
}
var req = new RuleEngineReq();
//req.Head = new HeadInfo();
req.Head.SenderKey = SenderKey;
req.Main.BusinessInfo = mainInfo;
var res = await _ruleEngineService.ExcuteRulesOceanBooking(req);
return await Task.FromResult(DataResult<RuleEngineResult>.Success("海运出口规则引擎校验完成!", res, MultiLanguageConst.SeaExportRuleEngineFinished));
}
}
}