场站箱型数据映射;刷新Token 修复orgId问题;运踪部分

master
ZR20090193-陈敬勇 7 months ago
parent ff07e44b52
commit 0a4ada0508

@ -52,6 +52,19 @@ public static class MultiLanguageConst
[Description("程序异常")]
public const string ProgramException = "Program_Exception";
#region 数据映射
[Description("场站映射信息已存在")]
public const string MappingYardExist = "MappingYard_Exist";
[Description("场站映射信息不存在")]
public const string MappingYardNotExist = "MappingYard_Not_Exist";
[Description("箱型映射信息已存在")]
public const string MappingCtnExist = "MappingCtn_Exist";
[Description("箱型映射信息不存在")]
public const string MappingCtnNotExist = "MappingCtn_Not_Exist";
#endregion
#region 用户管理
[Description("用户授权数量限制")]

@ -500,4 +500,41 @@ public static partial class Extensions
{
return obj == null ? string.Empty : JsonConvert.SerializeObject(obj);
}
/// <summary>
/// 获取字符串值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static string GetStringValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return string.Empty;
}
return jt.ToString();
}
/// <summary>
/// 获取int值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static int GetIntValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return 0;
}
var strVal = jt.ToString();
int rtnVal = 0;
int.TryParse(strVal, out rtnVal);
return rtnVal;
}
}

@ -1,18 +1,20 @@
using DS.Module.UserModule;
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.Core.Helpers;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Map.Entity;
using DS.WMS.Core.System.Entity;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DS.Module.SqlSugar;
using DS.Module.Core;
using SqlSugar;
namespace DS.Module.CrawlerData
{
public class CrawlerDataService: ICrawlerDataService
public class CrawlerDataService : ICrawlerDataService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
@ -31,7 +33,91 @@ namespace DS.Module.CrawlerData
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/// <summary>
/// 异步调取出口运踪场站详情(按箱明细显示)
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public async Task<DataResult<string>> GetYardData(YardDataReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var account = tenantDb.Queryable<CodeThirdParty>().Where(x => x.CustomerId == req.YardId && x.AccountType == "BillTrace").First();
//public DataResult<string> GetYardData(string url) { }
var userKey = db.Queryable<SysConfig>().Where(x => x.Code == "spiderUserKeyBilltrace").WithCache().First().Value;
var userSecret = db.Queryable<SysConfig>().Where(x => x.Code == "spiderUserSecretBilltrace").WithCache().First().Value;
var spiderServerUrl = db.Queryable<SysConfig>().Where(x => x.Code == "spiderServerUrlBillTraceNew").WithCache().First().Value;
var tenantName = db.Queryable<SysTenant>().Filter(null, true).Where(x => x.Id == long.Parse(user.TenantId)).WithCache().First().Name;
if (account.IsNull())
{
return await Task.FromResult(DataResult<string>.Failed("未配置出口运踪场站第三方账号信息!"));
}
var yardMap = tenantDb.Queryable<MappingYard>().Where(x => x.LinkId == req.YardId && x.Module == "BillTrace").First();
if (yardMap.IsNull())
{
return await Task.FromResult(DataResult<string>.Failed($"场站代号配置未找到:{req.YardId}"));
}
var objSend = new
{
user_key = userKey,
user_secret = userSecret,
customer_id = user.TenantId,
customer_name = tenantName,
web_code = yardMap.MapCode,
bno = req.MBLNO,
req_type = req.IsWeb ? "1" : "0",
web_user = account.AppKey,
web_psw = account.AppSecret,
};
var urlYard = spiderServerUrl;
if (!urlYard.EndsWith("/"))
{
urlYard += "/";
}
urlYard += "real/query";
var res = RequestHelper.Post(JsonConvert.SerializeObject(objSend), urlYard);
var rtnObj = JObject.Parse(res);
if (rtnObj.GetIntValue("code") != 200)
{
return await Task.FromResult(DataResult<string>.Failed("$\"获取场站数失败:{rtnObj.GetStringValue(\"msg\")}\"!"));
}
else
{
var rtnData = rtnObj.GetStringValue("data");
if (req.IsWeb)
{
var viewstatehtml = GetDataHtmlList(rtnData, "__VIEWSTATE", "/>");
if (viewstatehtml != "")
{
rtnData = rtnData.Replace(viewstatehtml, "");
}
}
return await Task.FromResult(DataResult<string>.Success(rtnData));
}
}
private static string GetDataHtmlList(string html, string startstr, string endstr)
{
var subhtml = html;
var htmllength = subhtml.Length;
var startindex = subhtml.IndexOf(startstr);
//if (startindex == -1 || startindex == 0) return "";
if (startindex == -1) return "";
subhtml = subhtml.Substring(startindex + startstr.Length, htmllength - startindex - startstr.Length);
var endindex = subhtml.IndexOf(endstr);
if (endindex != -1 && endindex != 0)
subhtml = subhtml.Substring(0, endindex);
return subhtml;
}
}
}

@ -0,0 +1,27 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.Module.CrawlerData
{
/// <summary>
/// 注入运踪服务
/// </summary>
public static class CrawlerModuleInstall
{
/// <summary>
///
/// </summary>
/// <param name="services"></param>
/// <exception cref="ArgumentNullException"></exception>
public static void AddCrawlerModuleInstall(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services.AddScoped<ICrawlerDataService, CrawlerDataService>();
}
}
}

@ -13,8 +13,4 @@
<ProjectReference Include="..\DS.WMS.Core\DS.WMS.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="新文件夹\" />
</ItemGroup>
</Project>

@ -1,4 +1,5 @@
using System;
using DS.Module.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -8,5 +9,12 @@ namespace DS.Module.CrawlerData
{
public interface ICrawlerDataService
{
/// <summary>
/// 异步调取出口运踪场站详情(按箱明细显示)
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public Task<DataResult<string>> GetYardData(YardDataReq req);
}
}

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.Module.CrawlerData
{
/// <summary>
///
/// </summary>
public class YardDataReq
{
///// <summary>
///// 用户名ID
///// </summary>
//public long UserId { get; set; }
///// <summary>
///// 租户ID
///// </summary>
//public long TenantId { get; set; }
///// <summary>
///// 租户名称
///// </summary>
//public string TenantName { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string MBLNO { get; set; }
/// <summary>
/// 场站ID
/// </summary>
public long YardId { get; set; }
/// <summary>
/// 是否网站
/// </summary>
public bool IsWeb { get; set; } = true;
}
}

@ -31,9 +31,11 @@ namespace DS.WMS.Core.Code.Method
public DataResult<List<CodeThirdPartyRes>> GetListByPage(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<CodeThirdParty>()
var data = tenantDb.Queryable<CodeThirdParty>()
.Where(whereList)
.Select<CodeThirdPartyRes>().ToQueryPage(request.PageCondition);
return data;
@ -41,34 +43,36 @@ namespace DS.WMS.Core.Code.Method
public DataResult EditCodeThirdParty(CodeThirdPartyReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (req.Id == 0)
{
if (db.Queryable<CodeThirdParty>().Where(x => x.AccountType == req.AccountType.Trim()&& x.CustomerId == req.CustomerId).Any())
if (tenantDb.Queryable<CodeThirdParty>().Where(x => x.AccountType == req.AccountType.Trim()&& x.CustomerId == req.CustomerId).Any())
{
return DataResult.Failed("第三方账号已存在!", MultiLanguageConst.CodeThirdPartyExist);
}
var data = req.Adapt<CodeThirdParty>();
var entity = db.Insertable(data).ExecuteReturnEntity();
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = db.Queryable<CodeThirdParty>().Where(x => x.Id == req.Id).First();
var info = tenantDb.Queryable<CodeThirdParty>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
public DataResult<CodeThirdPartyRes> GetCodeThirdPartyInfo(string id)
{
var data = db.Queryable<CodeThirdParty>()
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodeThirdParty>()
.Where(a => a.Id == long.Parse(id))
.Select<CodeThirdPartyRes>()
.First();

@ -20,7 +20,7 @@ public class FeeTemplateReq
/// <summary>
/// 业务类型(海运出口、海运进口、空运出口、空运进口)
/// </summary>
public int OpType { get; set; }
public string OpType { get; set; }
/// <summary>
/// 收付类型(收、付)
/// </summary>

@ -20,7 +20,7 @@ public class FeeTemplateRes
/// <summary>
/// 业务类型(海运出口、海运进口、空运出口、空运进口)
/// </summary>
public int OpType { get; set; }
public string OpType { get; set; }
/// <summary>
/// 收付类型(收、付)
/// </summary>

@ -17,8 +17,8 @@ public class FeeTemplate: BaseOrgModel<long>
/// <summary>
/// 业务类型(海运出口、海运进口、空运出口、空运进口)
/// </summary>
[SugarColumn(ColumnDescription = "业务类型 海运出口、海运进口、空运出口、空运进口", IsNullable = false, DefaultValue = "0")]
public int OpType { get; set; }
[SugarColumn(ColumnDescription = "业务类型 海运出口、海运进口、空运出口、空运进口", IsNullable = false, Length = 20)]
public string OpType { get; set; }
/// <summary>
/// 收付类型(收、付)
/// </summary>

@ -0,0 +1,76 @@
using DS.Module.Core;
using DS.WMS.Core.Code.Dtos;
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Map.Dtos
{
/// <summary>
/// 箱型映射信息请求
/// </summary>
public class MappingCtnReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 关联业务id
/// </summary>
public long LinkId { get; set; }
/// <summary>
/// 模块
/// </summary>
public string Module { get; set; }
/// <summary>
/// 映射代码
/// </summary>
public string MapCode { get; set; }
/// <summary>
/// 映射名称
/// </summary>
public string MapName { get; set; }
/// <summary>
/// 船司Id
/// </summary>
public long CarrierId { get; set; }
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 验证
/// </summary>
public class MappingCtnReqValidator : AbstractValidator<MappingCtnReq>
{
/// <summary>
/// 构造函数
/// </summary>
public MappingCtnReqValidator()
{
this.RuleFor(o => o.LinkId)
.NotEmpty().WithName("箱型Id");
this.RuleFor(o => o.Module)
.NotEmpty().WithName("模块");
this.RuleFor(o => o.MapCode)
.NotEmpty().WithName("映射代码");
this.RuleFor(o => o.MapName)
.NotEmpty().WithName("映射名称");
}
}
}

@ -0,0 +1,61 @@
using DS.Module.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Map.Dtos
{
/// <summary>
/// 箱型映射信息返回
/// </summary>
public class MappingCtnRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 关联业务id
/// </summary>
public long LinkId { get; set; }
/// <summary>
/// 模块
/// </summary>
public string Module { get; set; }
/// <summary>
/// 映射代码
/// </summary>
public string MapCode { get; set; }
/// <summary>
/// 映射名称
/// </summary>
public string MapName { get; set; }
/// <summary>
/// 船司Id
/// </summary>
public long CarrierId { get; set; }
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}

@ -0,0 +1,77 @@
using DS.Module.Core;
using DS.WMS.Core.Code.Dtos;
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Map.Dtos
{
/// <summary>
/// 场站映射信息请求
/// </summary>
public class MappingYardReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 关联业务id
/// </summary>
public long LinkId { get; set; }
/// <summary>
/// 模块
/// </summary>
public string Module { get; set; }
/// <summary>
/// 映射代码
/// </summary>
public string MapCode { get; set; }
/// <summary>
/// 映射名称
/// </summary>
public string MapName { get; set; }
/// <summary>
/// 船司Id
/// </summary>
public long CarrierId { get; set; }
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 验证
/// </summary>
public class MappingYardReqValidator : AbstractValidator<MappingYardReq>
{
/// <summary>
/// 构造函数
/// </summary>
public MappingYardReqValidator()
{
this.RuleFor(o => o.LinkId)
.NotEmpty().WithName("场站Id");
this.RuleFor(o => o.Module)
.NotEmpty().WithName("模块");
this.RuleFor(o => o.MapCode)
.NotEmpty().WithName("映射代码");
this.RuleFor(o => o.MapName)
.NotEmpty().WithName("映射名称");
}
}
}

@ -0,0 +1,61 @@
using DS.Module.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Map.Dtos
{
/// <summary>
/// 场站映射信息返回
/// </summary>
public class MappingYardRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 关联业务id
/// </summary>
public long LinkId { get; set; }
/// <summary>
/// 模块
/// </summary>
public string Module { get; set; }
/// <summary>
/// 映射代码
/// </summary>
public string MapCode { get; set; }
/// <summary>
/// 映射名称
/// </summary>
public string MapName { get; set; }
/// <summary>
/// 船司Id
/// </summary>
public long CarrierId { get; set; }
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}

@ -0,0 +1,46 @@
using DS.Module.Core.Data;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Map.Entity
{
/// <summary>
/// 箱型映射信息
/// </summary>
[SqlSugar.SugarTable("op_map_ctn", "箱型映射信息")]
public class MappingCtn : BaseModel<long>
{
/// <summary>
/// 关联业务id
/// </summary>
public long LinkId { get; set; }
/// <summary>
/// 模块
/// </summary>
[SugarColumn(ColumnDescription = "模块", Length = 100, IsNullable = false)]
public string Module { get; set; }
/// <summary>
/// 映射代码
/// </summary>
[SugarColumn(ColumnDescription = "映射代码", Length = 100, IsNullable = false)]
public string MapCode { get; set; }
/// <summary>
/// 映射名称
/// </summary>
[SugarColumn(ColumnDescription = "映射名称", Length = 100, IsNullable = true)]
public string MapName { get; set; }
/// <summary>
/// 船司Id
/// </summary>
[SugarColumn(ColumnDescription = "船司Id", IsNullable = true,DefaultValue ="0")]
public long CarrierId { get; set; }
}
}

@ -0,0 +1,47 @@
using DS.Module.Core.Data;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Map.Entity
{
/// <summary>
/// 场站映射信息
/// </summary>
[SqlSugar.SugarTable("op_map_yard", "场站映射信息")]
public class MappingYard : BaseModel<long>
{
/// <summary>
/// 关联业务id
/// </summary>
public long LinkId { get; set; }
/// <summary>
/// 模块
/// </summary>
[SugarColumn(ColumnDescription = "模块", Length = 100, IsNullable = false)]
public string Module { get; set; }
/// <summary>
/// 映射代码
/// </summary>
[SugarColumn(ColumnDescription = "映射代码", Length = 100, IsNullable = false)]
public string MapCode { get; set; }
/// <summary>
/// 映射名称
/// </summary>
[SugarColumn(ColumnDescription = "映射名称", Length = 100, IsNullable = true)]
public string MapName { get; set; }
/// <summary>
/// 船司Id
/// </summary>
[SugarColumn(ColumnDescription = "船司Id", IsNullable = true,DefaultValue ="0")]
public long CarrierId { get; set; }
}
}

@ -0,0 +1,49 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Map.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Map.Interface
{
public interface IMappingCtnService
{
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<MappingCtnRes>> GetListByPage(PageRequest request);
/// <summary>
/// 编辑
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditMappingCtn(MappingCtnReq req);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<MappingCtnRes> GetMappingCtnInfo(string id);
/// <summary>
/// 删除
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult DelMappingCtn(IdModel req);
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult BatchDelMappingCtn(IdModel req);
}
}

@ -0,0 +1,49 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Map.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Map.Interface
{
public interface IMappingYardService
{
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<MappingYardRes>> GetListByPage(PageRequest request);
/// <summary>
/// 编辑
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditMappingYard(MappingYardReq req);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<MappingYardRes> GetMappingYardInfo(string id);
/// <summary>
/// 删除
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult DelMappingYard(IdModel req);
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult BatchDelMappingYard(IdModel req);
}
}

@ -0,0 +1,116 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Map.Dtos;
using DS.WMS.Core.Map.Entity;
using DS.WMS.Core.Map.Interface;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using DS.Module.Core.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Org.BouncyCastle.Ocsp;
using Mapster;
using DS.WMS.Core.Fee.Entity;
namespace DS.WMS.Core.Map.Method
{
public class MappingCtnService : IMappingCtnService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public MappingCtnService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
public DataResult BatchDelMappingCtn(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = tenantDb.Queryable<MappingCtn>().Where(x => req.Ids.Contains(x.Id)).ToList();
;
if (list.Count > 0)
{
tenantDb.Deleteable(list).ExecuteCommand();
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
public DataResult DelMappingCtn(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<MappingCtn>().Where(x => x.Id == long.Parse(req.Id)).First();
if (info == null)
{
return DataResult.Failed("箱型映射信息不存在!", MultiLanguageConst.MappingCtnNotExist);
}
tenantDb.Deleteable(info).ExecuteCommand();
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
public DataResult EditMappingCtn(MappingCtnReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (req.Id == 0)
{
if (tenantDb.Queryable<MappingCtn>().Where(x => x.LinkId == req.LinkId && x.Module == req.Module).Any())
{
return DataResult.Failed("箱型映射信息已存在!", MultiLanguageConst.MappingCtnExist);
}
var data = req.Adapt<MappingCtn>();
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = tenantDb.Queryable<MappingCtn>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
public DataResult<List<MappingCtnRes>> GetListByPage(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = tenantDb.Queryable<MappingCtn>()
.Where(whereList)
.Select<MappingCtnRes>().ToQueryPage(request.PageCondition);
return data;
}
public DataResult<MappingCtnRes> GetMappingCtnInfo(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<MappingCtn>()
.Where(a => a.Id == long.Parse(id))
.Select<MappingCtnRes>()
.First();
return DataResult<MappingCtnRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
}
}

@ -0,0 +1,116 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Map.Dtos;
using DS.WMS.Core.Map.Entity;
using DS.WMS.Core.Map.Interface;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using DS.Module.Core.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Org.BouncyCastle.Ocsp;
using Mapster;
using DS.WMS.Core.Fee.Entity;
namespace DS.WMS.Core.Map.Method
{
public class MappingYardService : IMappingYardService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public MappingYardService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
public DataResult BatchDelMappingYard(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = tenantDb.Queryable<MappingYard>().Where(x => req.Ids.Contains(x.Id)).ToList();
;
if (list.Count > 0)
{
tenantDb.Deleteable(list).ExecuteCommand();
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
public DataResult DelMappingYard(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<MappingYard>().Where(x => x.Id == long.Parse(req.Id)).First();
if (info == null)
{
return DataResult.Failed("场站映射信息不存在!", MultiLanguageConst.MappingYardNotExist);
}
tenantDb.Deleteable(info).ExecuteCommand();
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
public DataResult EditMappingYard(MappingYardReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (req.Id == 0)
{
if (tenantDb.Queryable<MappingYard>().Where(x => x.LinkId == req.LinkId && x.Module == req.Module).Any())
{
return DataResult.Failed("场站映射信息已存在!", MultiLanguageConst.MappingYardExist);
}
var data = req.Adapt<MappingYard>();
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = tenantDb.Queryable<MappingYard>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
public DataResult<List<MappingYardRes>> GetListByPage(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = tenantDb.Queryable<MappingYard>()
.Where(whereList)
.Select<MappingYardRes>().ToQueryPage(request.PageCondition);
return data;
}
public DataResult<MappingYardRes> GetMappingYardInfo(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<MappingYard>()
.Where(a => a.Id == long.Parse(id))
.Select<MappingYardRes>()
.First();
return DataResult<MappingYardRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
}
}

@ -1014,6 +1014,14 @@ public class SeaExportReq
/// </summary>
public string TransRemark { get; set; }
/// <summary>
/// 截单备注
/// </summary>
public string CloseDocRemark { get; set; }
/// <summary>
/// 订舱备注
/// </summary>
public string BookingRemark { get; set; }
/// <summary>
/// 预录
/// </summary>

@ -1024,7 +1024,14 @@ public class SeaExportRes
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 截单备注
/// </summary>
public string CloseDocRemark { get; set; }
/// <summary>
/// 订舱备注
/// </summary>
public string BookingRemark { get; set; }
/// <summary>
/// Desc:提单签发状态

@ -826,6 +826,16 @@ public class SeaExport : BaseOrgModel<long>
[SqlSugar.SugarColumn(ColumnDescription = "截单日期", IsNullable = false)]
public DateTime CloseDocDate { get; set; }
/// <summary>
/// 截单备注
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "截单备注", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string CloseDocRemark { get; set; }
/// <summary>
/// 订舱备注
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "订舱备注", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string BookingRemark { get; set; }
/// <summary>
/// 集港日期
/// </summary>

@ -99,7 +99,7 @@ public class CommonService : ICommonService
// GID = userInfo.GID,
TenantId = tenantId.ToString(),
};
var refreshToken = JwtHelper.Encrypt(tokenModel, true);
var refreshToken = JwtHelper.Encrypt(tokenModel, true,false);
var data = db.Queryable<SysUser>().Filter(null, true).Where(x => x.Id == userId)
.Select(a => new CurrentUserViewModel
@ -321,17 +321,19 @@ public class CommonService : ICommonService
var userId = long.Parse(user.UserId);
var tenantId = user.GetTenantId();
var orgId = user.GetOrgId();
var tokenModel = new JwtHelper.JwtTokenModel
{
Uid = user.UserId,
Name = db.Queryable<SysUser>().Filter(null, true).First(x => x.Id == userId).UserName,
OrgId = orgId.ToString(),
TenantId = tenantId.ToString(),
};
var data = new RefreshTokenRes
{
AccessToken = JwtHelper.Encrypt(tokenModel),
RefreshToken = JwtHelper.Encrypt(tokenModel, true)
AccessToken = JwtHelper.Encrypt(tokenModel,false,true),
RefreshToken = JwtHelper.Encrypt(tokenModel, true, true)
};
return DataResult<RefreshTokenRes>.Success(data);
}
@ -368,9 +370,6 @@ public class CommonService : ICommonService
return DataResult<string>.Failed("密码错误!");
}
//取第一个机构
var orgRelation = db.Queryable<SysOrgUser>()
.First(x => x.UserId == userInfo.Id);
var tokenModel = new JwtHelper.JwtTokenModel
{
Uid = userInfo.Id.ToString(),

@ -0,0 +1,92 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Map.Dtos;
using DS.WMS.Core.Map.Interface;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.MainApi.Controllers
{
/// <summary>
/// 箱型映射信息 模块
/// </summary>
public class MappingCtnController : ApiController
{
private readonly IMappingCtnService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public MappingCtnController(IMappingCtnService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetMappingCtnList")]
public DataResult<List<MappingCtnRes>> GetMappingCtnList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("EditMappingCtn")]
public DataResult EditMappingCtn([FromBody] MappingCtnReq req)
{
var res = _invokeService.EditMappingCtn(req);
return res;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id">Id</param>
/// <returns></returns>
[HttpGet]
[Route("GetMappingCtnInfo")]
public DataResult<MappingCtnRes> GetMappingCtnInfo([FromQuery] string id)
{
var res = _invokeService.GetMappingCtnInfo(id);
return res;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="req">Id</param>
/// <returns></returns>
[HttpPost]
[Route("DelMappingCtn")]
public DataResult DelMappingCtn([FromBody] IdModel req)
{
var res = _invokeService.DelMappingCtn(req);
return res;
}
/// <summary>
///批量删除
/// </summary>
/// <param name="req">Id</param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelMappingCtn")]
public DataResult BatchDelMappingCtn([FromBody] IdModel req)
{
var res = _invokeService.BatchDelMappingCtn(req);
return res;
}
}
}

@ -0,0 +1,92 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Map.Dtos;
using DS.WMS.Core.Map.Interface;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.MainApi.Controllers
{
/// <summary>
/// 场站映射信息 模块
/// </summary>
public class MappingYardController : ApiController
{
private readonly IMappingYardService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public MappingYardController(IMappingYardService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetMappingYardList")]
public DataResult<List<MappingYardRes>> GetMappingYardList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("EditMappingYard")]
public DataResult EditMappingYard([FromBody] MappingYardReq req)
{
var res = _invokeService.EditMappingYard(req);
return res;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id">Id</param>
/// <returns></returns>
[HttpGet]
[Route("GetMappingYardInfo")]
public DataResult<MappingYardRes> GetMappingYardInfo([FromQuery] string id)
{
var res = _invokeService.GetMappingYardInfo(id);
return res;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="req">Id</param>
/// <returns></returns>
[HttpPost]
[Route("DelMappingYard")]
public DataResult DelMappingYard([FromBody] IdModel req)
{
var res = _invokeService.DelMappingYard(req);
return res;
}
/// <summary>
///批量删除
/// </summary>
/// <param name="req">Id</param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelMappingYard")]
public DataResult BatchDelMappingYard([FromBody] IdModel req)
{
var res = _invokeService.BatchDelMappingYard(req);
return res;
}
}
}

@ -34,7 +34,8 @@ public class SaasTest
{
Type[] types = Assembly
.LoadFrom("DS.WMS.Core.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
.GetTypes().Where(it => it.FullName.Contains("DS.WMS.Core.Code.Entity.") || it.FullName.Contains("DS.WMS.Core.Info.Entity.") || it.FullName.Contains("DS.WMS.Core.Op.Entity.") || it.FullName.Contains("DS.WMS.Core.Fee.Entity."))//命名空间过滤,当然你也可以写其他条件过滤
.GetTypes().Where(it => it.FullName.Contains("DS.WMS.Core.Code.Entity.") || it.FullName.Contains("DS.WMS.Core.Info.Entity.") || it.FullName.Contains("DS.WMS.Core.Op.Entity.")
|| it.FullName.Contains("DS.WMS.Core.Fee.Entity.") || it.FullName.Contains("DS.WMS.Core.Map.Entity."))//命名空间过滤,当然你也可以写其他条件过滤
.ToArray();
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
// var temp = tenantDb.CodeFirst.GetDifferenceTables(types);

Loading…
Cancel
Save