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 { /// /// 海运出口规则引擎接口 /// public partial class SeaExportService { /// /// 海运出口规则引擎校验 /// /// /// public async Task> ExcuteRuleEngine(string id) { var SenderKey = AppSetting.app(new string[] { "ExcuteRuleService", "SenderKey" }).ObjToString(); var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var info = tenantDb.Queryable().Where(x => x.Id == long.Parse(id)).First(); if (info.IsNull()) return await Task.FromResult(DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist)); var mainInfo = info.Adapt(); var ctnlist = new List(); var ctns= tenantDb.Queryable().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.Success("海运出口规则引擎校验完成!", res, MultiLanguageConst.SeaExportRuleEngineFinished)); } } }