Merge branch 'dev' of http://60.209.125.238:20010/chenjingyong/ds8-solution-pro into dev
commit
44fd9b0389
@ -0,0 +1,63 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
using DS.WMS.Core.Code.Interface;
|
||||
using DS.WMS.Core.Sys.Dtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DS.WMS.AdminApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 船公司信息服务
|
||||
/// </summary>
|
||||
public class CodeCarrierController : ApiController
|
||||
{
|
||||
private readonly ICodeCarrierService _invokeService;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="invokeService"></param>
|
||||
public CodeCarrierController(ICodeCarrierService invokeService)
|
||||
{
|
||||
_invokeService = invokeService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("GetCodeCarrierList")]
|
||||
public DataResult<List<CodeCarrierRes>> GetCodeCarrierList([FromBody] PageRequest request)
|
||||
{
|
||||
var res = _invokeService.GetListByPage(request);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("EditCodeCarrier")]
|
||||
public DataResult EditCodeCarrier([FromBody] CodeCarrierReq model)
|
||||
{
|
||||
var res = _invokeService.EditCodeCarrier(model);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetCodeCarrierInfo")]
|
||||
public DataResult<CodeCarrierRes> GetCodeCarrierInfo([FromQuery] string id)
|
||||
{
|
||||
var res = _invokeService.GetCodeCarrierInfo(id);
|
||||
return res;
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.Code.Entity;
|
||||
using FluentValidation;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 船公司信息请求实体
|
||||
/// </summary>
|
||||
public class CodeCarrierReq
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 英文简称
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 中文名称
|
||||
/// </summary>
|
||||
public string CnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 中文简称
|
||||
/// </summary>
|
||||
public string CnShortName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 英文名称
|
||||
/// </summary>
|
||||
public string EnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 船公司代码别名
|
||||
/// </summary>
|
||||
public string OtherCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家Id
|
||||
/// </summary>
|
||||
public long CountryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家名称
|
||||
/// </summary>
|
||||
public string CountryName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 船公司Logo
|
||||
/// </summary>
|
||||
public string Logo { get; set; }
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
/// <summary>
|
||||
/// EDI代码
|
||||
/// </summary>
|
||||
public string EdiCode { get; set; }
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证
|
||||
/// </summary>
|
||||
public class CodeCarrierReqValidator : AbstractValidator<CodeCarrierReq>
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public CodeCarrierReqValidator()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
using DS.Module.Core;
|
||||
|
||||
namespace DS.WMS.Core.Code.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 船公司信息返回
|
||||
/// </summary>
|
||||
public class CodeCarrierRes
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 英文简称
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 中文名称
|
||||
/// </summary>
|
||||
public string CnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 中文简称
|
||||
/// </summary>
|
||||
public string CnShortName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 英文名称
|
||||
/// </summary>
|
||||
public string EnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 船公司代码别名
|
||||
/// </summary>
|
||||
public string OtherCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家Id
|
||||
/// </summary>
|
||||
public long CountryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家名称
|
||||
/// </summary>
|
||||
public string CountryName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 船公司Logo
|
||||
/// </summary>
|
||||
public string Logo { get; set; }
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
/// <summary>
|
||||
/// EDI代码
|
||||
/// </summary>
|
||||
public string EdiCode { 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,57 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
|
||||
namespace DS.WMS.Core.Code.Interface;
|
||||
|
||||
public interface ICodeCarrierService
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<CodeCarrierRes>> GetListByPage(PageRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditCodeCarrier(CodeCarrierReq req);
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<CodeCarrierRes> GetCodeCarrierInfo(string id);
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<CodeCarrierRes>> GetClientListByPage(PageRequest request);
|
||||
/// <summary>
|
||||
/// 编辑-客户端
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditClientCodeCarrier(CodeCarrierReq req);
|
||||
/// <summary>
|
||||
/// 获取详情 -客户端
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult<CodeCarrierRes> GetClientCodeCarrierInfo(string id);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult BatchDelCodeCarrier(IdModel req);
|
||||
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Constants;
|
||||
using DS.Module.Core.Data;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
using DS.WMS.Core.Code.Entity;
|
||||
using DS.WMS.Core.Code.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Method;
|
||||
|
||||
public class CodeCarrierService:ICodeCarrierService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
private readonly ISaasDbService saasService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public CodeCarrierService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
||||
}
|
||||
|
||||
public DataResult<List<CodeCarrierRes>> GetListByPage(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<CodeCarrier>()
|
||||
.Where(whereList)
|
||||
.Select<CodeCarrierRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult EditCodeCarrier(CodeCarrierReq req)
|
||||
{
|
||||
if (req.Id == 0)
|
||||
{
|
||||
|
||||
if (db.Queryable<CodeCarrier>().Where(x=>x.Code == req.Code.Trim()).Any())
|
||||
{
|
||||
return DataResult.Failed("船公司信息已存在!", MultiLanguageConst.CodeCarrierExist);
|
||||
}
|
||||
var data = req.Adapt<CodeCarrier>();
|
||||
|
||||
var entity = db.Insertable(data).ExecuteReturnEntity();
|
||||
|
||||
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = db.Queryable<CodeCarrier>().Where(x => x.Id == req.Id).First();
|
||||
|
||||
info = req.Adapt(info);
|
||||
|
||||
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||||
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
public DataResult<CodeCarrierRes> GetCodeCarrierInfo(string id)
|
||||
{
|
||||
var data = db.Queryable<CodeCarrier>()
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<CodeCarrierRes>()
|
||||
.First();
|
||||
return DataResult<CodeCarrierRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
|
||||
public DataResult<List<CodeCarrierRes>> GetClientListByPage(PageRequest request)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = tenantDb.Queryable<CodeCarrier>()
|
||||
.Where(whereList)
|
||||
.Select<CodeCarrierRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult EditClientCodeCarrier(CodeCarrierReq req)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
if (req.Id == 0)
|
||||
{
|
||||
|
||||
if (tenantDb.Queryable<CodeCarrier>().Where(x=>x.Code == req.Code.Trim()).Any())
|
||||
{
|
||||
return DataResult.Failed("船公司信息已存在!", MultiLanguageConst.CodeCarrierExist);
|
||||
}
|
||||
var data = req.Adapt<CodeCarrier>();
|
||||
|
||||
var entity = tenantDb.Insertable(data).RemoveDataCache($"{SqlSugarCacheConst.Carrier}{user.TenantId}").ExecuteReturnEntity();
|
||||
|
||||
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = tenantDb.Queryable<CodeCarrier>().Where(x => x.Id == req.Id).First();
|
||||
|
||||
info = req.Adapt(info);
|
||||
|
||||
tenantDb.Updateable(info).RemoveDataCache($"{SqlSugarCacheConst.Carrier}{user.TenantId}").IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||||
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
public DataResult<CodeCarrierRes> GetClientCodeCarrierInfo(string id)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
var data = tenantDb.Queryable<CodeCarrier>()
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<CodeCarrierRes>()
|
||||
.First();
|
||||
return DataResult<CodeCarrierRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
|
||||
public DataResult BatchDelCodeCarrier(IdModel req)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
var list = tenantDb.Queryable<CodeCarrier>().Where(x => req.Ids.Contains(x.Id)).ToList();
|
||||
if (list.Count > 0)
|
||||
{
|
||||
tenantDb.Deleteable(list).RemoveDataCache($"{SqlSugarCacheConst.Carrier}{user.TenantId}").ExecuteCommand();
|
||||
}
|
||||
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,75 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
using DS.WMS.Core.Code.Interface;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DS.WMS.MainApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 船公司信息服务
|
||||
/// </summary>
|
||||
public class CodeCarrierController : ApiController
|
||||
{
|
||||
private readonly ICodeCarrierService _invokeService;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="invokeService"></param>
|
||||
public CodeCarrierController(ICodeCarrierService invokeService)
|
||||
{
|
||||
_invokeService = invokeService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("GetCodeCarrierList")]
|
||||
public DataResult<List<CodeCarrierRes>> GetCodeCarrierList([FromBody] PageRequest request)
|
||||
{
|
||||
var res = _invokeService.GetClientListByPage(request);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("EditCodeCarrier")]
|
||||
public DataResult EditCodeCarrier([FromBody] CodeCarrierReq model)
|
||||
{
|
||||
var res = _invokeService.EditClientCodeCarrier(model);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetCodeCarrierInfo")]
|
||||
public DataResult<CodeCarrierRes> GetCodeCarrierInfo([FromQuery] string id)
|
||||
{
|
||||
var res = _invokeService.GetClientCodeCarrierInfo(id);
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
/// <param name="req">主表Ids</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("BatchDelCodeCarrier")]
|
||||
public DataResult BatchDelCodeCarrier([FromBody] IdModel req)
|
||||
{
|
||||
var res = _invokeService.BatchDelCodeCarrier(req);
|
||||
return res;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<NameOfLastUsedPublishProfile>D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
|
||||
<NameOfLastUsedPublishProfile>D:\Source\Repos\DS8\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
|
||||
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||
</PropertyGroup>
|
||||
|
Loading…
Reference in New Issue