diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index 62deee99..9937bb23 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -1158,5 +1158,17 @@ public static class MultiLanguageConst [Description("执行舱位失败,原因:{0}")] public const string BookingSlotApiReceiveError = "BookingSlot_ApiReceive_Error"; + /// + /// 合约数据不存在或已作废 + /// + [Description("合约数据不存在或已作废")] + public const string BookingContractRecordDeletedOrNoExists = "BookingContract_RecordDeleted_NoExists"; + + /// + /// 合约作废未提供主键ID + /// + [Description("合约作废未提供主键ID")] + public const string BookingContractDeleteIdsNull = "BookingContract_Delete_IdsNull"; + #endregion } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingContractNo/BookingContractNoManageDto.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingContractNo/BookingContractNoManageDto.cs new file mode 100644 index 00000000..7c5ab4c4 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingContractNo/BookingContractNoManageDto.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Op.Dtos +{ + /// + /// 合约管理 + /// + public class BookingContractNoManageDto + { + /// + /// 主键 + /// + /// 358942162968645 + public long Id { get; set; } + + /// + /// 合约号编号 + /// + public string ContractNo { get; set; } + + /// + /// 合约号名称 + /// + public string ContractName { get; set; } + + /// + /// 合约号备注 + /// + public string ContractNote { get; set; } + + /// + /// 航线代码 + /// + public string LaneCode { get; set; } + + /// + /// 航线中文 + /// + public string LaneCName { get; set; } + + /// + /// 目的港代码 + /// + public string PodCode { get; set; } + + /// + /// 船公司主键 + /// + public long CarrierId { get; set; } + + /// + /// 船公司代码 + /// + public string CarrierCode { get; set; } + + /// + /// 合约方公司全称 + /// + public string ContractPartyName { get; set; } + + /// + /// 合约方公司代码 + /// + public string ContractPartyCode { get; set; } + + /// + /// 合约方联系人 + /// + public string ContractLinkName { get; set; } + + /// + /// 合约方联系邮件 + /// + public string ContractLinkEmail { get; set; } + + /// + /// 是否为本公司合约价格 1-是,0-否 + /// + public bool IsOurOwnPrice { get; set; } = true; + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/BookingContractNo/BookingContractNoManage.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/BookingContractNo/BookingContractNoManage.cs new file mode 100644 index 00000000..19b240bd --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/BookingContractNo/BookingContractNoManage.cs @@ -0,0 +1,96 @@ +using DS.Module.Core.Data; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Op.Entity +{ + /// + /// 订舱合约号管理 + /// + [SqlSugar.SugarTable("booking_contract_manage", "订舱合约号管理")] + public class BookingContractNoManage : BaseModelV2 + { + /// + /// 合约号编号 + /// + [SqlSugar.SugarColumn(ColumnDescription = "合约号编号", Length = 50, IsNullable = true)] + public string ContractNo { get; set; } + + /// + /// 合约号名称 + /// + [SqlSugar.SugarColumn(ColumnDescription = "合约号名称", Length = 100, IsNullable = true)] + public string ContractName { get; set; } + + /// + /// 合约号备注 + /// + [SqlSugar.SugarColumn(ColumnDescription = "合约号备注", Length = 150, IsNullable = true)] + public string ContractNote { get; set; } + + /// + /// 航线代码 + /// + [SqlSugar.SugarColumn(ColumnDescription = "航线代码", Length = 40, IsNullable = true)] + public string LaneCode { get; set; } + + /// + /// 航线中文 + /// + [SqlSugar.SugarColumn(ColumnDescription = "航线中文", Length = 50, IsNullable = true)] + public string LaneCName { get; set; } + + /// + /// 目的港代码 + /// + [SqlSugar.SugarColumn(ColumnDescription = "目的港代码", Length = 20, IsNullable = true)] + public string PodCode { get; set; } + + /// + /// 船公司主键 + /// + [SqlSugar.SugarColumn(ColumnDescription = "船公司主键", IsNullable = true)] + public long CarrierId { get; set; } + + /// + /// 船公司代码 + /// + [SqlSugar.SugarColumn(ColumnDescription = "船公司代码", Length = 20, IsNullable = true)] + public string CarrierCode { get; set; } + + /// + /// 合约方公司全称 + /// + [SqlSugar.SugarColumn(ColumnDescription = "合约方公司全称", Length = 200, IsNullable = true)] + public string ContractPartyName { get; set; } + + /// + /// 合约方公司代码 + /// + [SqlSugar.SugarColumn(ColumnDescription = "合约方公司代码", Length = 64, IsNullable = true)] + public string ContractPartyCode { get; set; } + + /// + /// 合约方联系人 + /// + [SqlSugar.SugarColumn(ColumnDescription = "合约方联系人", Length = 200, IsNullable = true)] + public string ContractLinkName { get; set; } + + /// + /// 合约方联系邮件 + /// + [SqlSugar.SugarColumn(ColumnDescription = "合约方联系邮件", Length = 100, IsNullable = true)] + public string ContractLinkEmail { get; set; } + + /// + /// 是否为本公司合约价格 1-是,0-否 + /// + [SqlSugar.SugarColumn(ColumnDescription = "是否为本公司合约价格 1-是,0-否", IsNullable = true,DefaultValue = "0")] + public bool IsOurOwnPrice { get; set; } = true; + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/BookingContractNo/IBookingContractNoManageService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingContractNo/IBookingContractNoManageService.cs new file mode 100644 index 00000000..ee4a80a6 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingContractNo/IBookingContractNoManageService.cs @@ -0,0 +1,59 @@ +using DS.Module.Core; +using DS.WMS.Core.Op.Dtos; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Op.Interface +{ + /// + /// 合约号管理 + /// + public interface IBookingContractNoManageService + { + /// + /// 保存 + /// + /// 合约号详情 + /// 返回回执 + Task> Save(BookingContractNoManageDto model); + + /// + /// 主键获取合约号详情 + /// + /// 合约号主键 + /// 返回合约号详情 + Task> GetInfo(long Id); + + /// + /// 检索合约列表 + /// + /// 检索值可(模糊查询) + /// 返回记录最大行数 + /// 船公司代码 + /// 航线代码 + /// 航线中文 + /// 目的港代码 + /// 返回合约号详情列表 + Task>> QuerytContractNoInfo(string queryItem, int top = 10, string carrier = "", string lane = "", string lanecname = "", string pod = ""); + + + /// + /// 作废(可批量删除) + /// + /// 合约号主键组 + /// 返回回执 + Task> Delete (long[] Ids); + + + /// + /// 合约号管理台账 + /// + /// 查询条件 + /// 返回台账列表 + Task>> GetPageAsync(PageRequest QuerySearch); + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingContractNo/BookingContractNoManageService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingContractNo/BookingContractNoManageService.cs new file mode 100644 index 00000000..5ed56bfc --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingContractNo/BookingContractNoManageService.cs @@ -0,0 +1,261 @@ +using DS.Module.Core; +using DS.Module.SqlSugar; +using DS.Module.UserModule; +using DS.WMS.Core.Op.Dtos; +using DS.WMS.Core.Op.Entity; +using DS.WMS.Core.Op.Interface; +using Mapster; +using Microsoft.Extensions.DependencyInjection; +using NLog; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DS.Module.Core.Extensions; +using Microsoft.Owin.Security.Provider; +using Microsoft.AspNetCore.Identity; + +namespace DS.WMS.Core.Op.Method +{ + public class BookingContractNoManageService: IBookingContractNoManageService + { + private readonly IServiceProvider _serviceProvider; + private readonly ISqlSugarClient db; + private readonly IUser user; + private readonly ISaasDbService saasService; + + private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger(); + + public BookingContractNoManageService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = _serviceProvider.GetRequiredService(); + user = _serviceProvider.GetRequiredService(); + saasService = _serviceProvider.GetRequiredService(); + } + + #region 保存 + /// + /// 保存 + /// + /// 合约号详情 + /// 返回回执 + public async Task> Save(BookingContractNoManageDto model) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + BookingContractNoManage info = null; + + try + { + if (model.Id > 0) + { + info = await tenantDb.Queryable().FirstAsync(t => t.Id == model.Id); + + //合约数据不存在或已作废 + if (info == null) + throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingContractRecordDeletedOrNoExists))); + + info = model.Adapt(); + + info.UpdateTime = DateTime.Now; + info.UpdateBy = long.Parse(user.UserId); + + await tenantDb.Updateable(info).IgnoreColumns(it => new + { + it.CreateTime, + it.CreateBy, + //it.CreatedUserName + }).ExecuteCommandAsync(); + } + else + { + info = model.Adapt(); + + await tenantDb.Insertable(info).ExecuteReturnEntityAsync(); + } + } + catch (Exception ex) + { + DataResult.FailedData(info.Id, ex.Message); + } + + return DataResult.Success(info.Id); + } + #endregion + + #region 主键获取合约号详情 + /// + /// 主键获取合约号详情 + /// + /// 合约号主键 + /// 返回合约号详情 + public async Task> GetInfo(long Id) + { + BookingContractNoManageDto model = null; + + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + try + { + var info = await tenantDb.Queryable().FirstAsync(t => t.Id == Id); + + //合约数据不存在或已作废 + if (info == null) + throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingContractRecordDeletedOrNoExists))); + + + model = info.Adapt(); + + } + catch (Exception ex) + { + DataResult.FailedData(model, ex.Message); + } + + return DataResult.Success(model); + } + #endregion + + #region 检索合约列表 + /// + /// 检索合约列表 + /// + /// 检索值可(模糊查询) + /// 返回记录最大行数 + /// 船公司代码 + /// 航线代码 + /// 航线中文 + /// 目的港代码 + /// 返回合约号详情列表 + public async Task>> QuerytContractNoInfo(string queryItem, int top = 10, string carrier = "", string lane = "", string lanecname = "", string pod = "") + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + var query = tenantDb.Queryable(); + + if (!string.IsNullOrWhiteSpace(queryItem)) + { + query = query.Where(t => + t.ContractNo.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) || + t.ContractName.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) || + t.ContractNote.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) || + t.ContractPartyCode.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) || + t.ContractPartyName.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) || + t.ContractLinkName.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) || + t.ContractLinkEmail.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) + ); + } + + if (!string.IsNullOrWhiteSpace(carrier)) + { + query = query.Where(t => t.CarrierCode.Equals(carrier)); + } + + if (!string.IsNullOrWhiteSpace(lane)) + { + query = query.Where(t => string.IsNullOrWhiteSpace(t.LaneCode) || t.LaneCode.Contains(lane)); + } + + if (!string.IsNullOrWhiteSpace(lanecname)) + { + query = query.Where(t => string.IsNullOrWhiteSpace(t.LaneCName) || t.LaneCName.Contains(lanecname)); + } + + if (!string.IsNullOrWhiteSpace(pod)) + { + query = query.Where(t => string.IsNullOrWhiteSpace(t.PodCode) || t.PodCode.Contains(pod)); + } + + var data = await query.Select().OrderBy(a=>a.ContractNo).Take(top).ToListAsync(); + + if(data.Count > 0) + return DataResult>.FailedData(data); + + return DataResult>.Success(data); + } + #endregion + + #region 作废(可批量删除) + /// + /// 作废(可批量删除) + /// + /// 合约号主键组 + /// 返回回执 + public async Task> Delete(long[] Ids) + { + try + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + //没有提供需要作废的主键信息 + if (Ids.Length == 0) + throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingContractDeleteIdsNull))); + + + + var list = tenantDb.Queryable().Where(t => Ids.Contains(t.Id)).ToList(); + + if (list.Count != Ids.Length) + { + var noRecord = string.Join(",", Ids.GroupJoin(list, l => l, r => r.Id, (l, r) => + { + var currList = r.ToList(); + + if (r.Count() > 0) + return string.Empty; + + return l.ToString(); + }).Where(t => !string.IsNullOrWhiteSpace(t)).ToArray()); + + throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingContractRecordDeletedOrNoExists))); + } + + list.ForEach(async entity => + { + entity.Deleted = true; + entity.DeleteTime = DateTime.Now; + entity.DeleteBy = long.Parse(user.UserId); + //entity.UpdatedUserName = UserManager.Name; + + await tenantDb.Updateable().IgnoreColumns(it => new + { + it.CreateTime, + it.CreateBy, + //it.CreatedUserName + }).ExecuteCommandAsync(); + }); + + } + catch (Exception ex) + { + //throw Oops.Bah($"作废约号参数异常,{ex.Message}"); + + DataResult.FailedData(string.Empty, ex.Message); + } + + return DataResult.Success(string.Empty); + } + #endregion + + #region 合约号管理台账 + /// + /// 合约号管理台账 + /// + /// 查询条件 + /// 返回台账列表 + public async Task>> GetPageAsync(PageRequest QuerySearch) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + //序列化查询条件 + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(QuerySearch.QueryCondition); + + var data = tenantDb.Queryable() + .Where(whereList) + .Select().ToQueryPage(QuerySearch.PageCondition); + return data; + } + #endregion + } +} diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/BookingContractNoManageController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/BookingContractNoManageController.cs new file mode 100644 index 00000000..0fc03b1c --- /dev/null +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/BookingContractNoManageController.cs @@ -0,0 +1,97 @@ +using DS.Module.Core; +using DS.WMS.Core.Op.Dtos; +using DS.WMS.Core.Op.Interface; +using Microsoft.AspNetCore.Mvc; +using Org.BouncyCastle.Crypto; + +namespace DS.WMS.OpApi.Controllers +{ + /// + /// 订舱约号管理 + /// + public class BookingContractNoManageController : ApiController + { + private readonly IBookingContractNoManageService _bookingContractNoManageService; + + public BookingContractNoManageController(IBookingContractNoManageService bookingContractNoManageService) + { + _bookingContractNoManageService = bookingContractNoManageService; + } + + #region 保存 + /// + /// 保存 + /// + /// 合约号详情 + /// 返回回执 + [HttpPost] + [Route("Save")] + public async Task> Save([FromBody] BookingContractNoManageDto model) + { + return await _bookingContractNoManageService.Save(model); + } + #endregion + + #region 主键获取合约号详情 + /// + /// 主键获取合约号详情 + /// + /// 合约号主键 + /// 返回合约号详情 + [HttpGet] + [Route("GetInfo")] + public async Task> GetInfo([FromQuery] long Id) + { + return await _bookingContractNoManageService.GetInfo(Id); + } + #endregion + + #region 检索合约列表 + /// + /// 检索合约列表 + /// + /// 检索值可(模糊查询) + /// 返回记录最大行数 + /// 船公司代码 + /// 航线代码 + /// 航线中文 + /// 目的港代码 + /// 返回合约号详情列表 + [HttpGet] + [Route("QuerytContractNoInfo")] + public async Task>> QuerytContractNoInfo([FromQuery] string queryItem, [FromQuery] int top = 10, + [FromQuery] string carrier = "", [FromQuery] string lane = "", [FromQuery] string lanecname = "", [FromQuery] string pod = "") + { + return await _bookingContractNoManageService.QuerytContractNoInfo(queryItem, top, carrier, lane, lanecname, pod); + } + #endregion + + #region 作废(可批量删除) + /// + /// 作废(可批量删除) + /// + /// 合约号主键组 + /// 返回回执 + [HttpGet] + [Route("Delete")] + public async Task> Delete([FromBody] long[] Ids) + { + return await _bookingContractNoManageService.Delete(Ids); + } + #endregion + + #region 合约号管理台账 + /// + /// 合约号管理台账 + /// + /// 查询条件 + /// 返回台账列表 + [HttpPost] + [Route("GetPage")] + public async Task>> GetPageAsync([FromBody] PageRequest QuerySearch) + { + return await _bookingContractNoManageService.GetPageAsync(QuerySearch); + } + #endregion + } +} diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/SpaceBookingMSKAPISpotController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/SpaceBookingMSKAPISpotController.cs index 0974ef05..96cf1e64 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/SpaceBookingMSKAPISpotController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/SpaceBookingMSKAPISpotController.cs @@ -5,6 +5,9 @@ using Microsoft.AspNetCore.Mvc; namespace DS.WMS.OpApi.Controllers { + /// + /// 预订舱马士基API即期订舱 + /// public class SpaceBookingMSKAPISpotController : Controller { private readonly ISpaceBookingMSKSPOTAPIService _spaceBookingMSKSPOTAPIService; diff --git a/ds-wms-service/DS.WMS.OpApi/Properties/PublishProfiles/FolderProfile.pubxml.user b/ds-wms-service/DS.WMS.OpApi/Properties/PublishProfiles/FolderProfile.pubxml.user index 22ee978a..21240daa 100644 --- a/ds-wms-service/DS.WMS.OpApi/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/ds-wms-service/DS.WMS.OpApi/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -6,7 +6,7 @@ <_PublishTargetUrl>D:\Code\PublishCopy\ds8-opapi - True|2024-07-17T07:40:21.2550083Z||;True|2024-07-17T14:03:08.1814323+08:00||;True|2024-07-15T13:43:42.6073130+08:00||;True|2024-07-15T11:53:40.6498579+08:00||;True|2024-07-15T11:53:03.1652559+08:00||;True|2024-07-15T11:42:33.0154478+08:00||;True|2024-07-15T10:20:03.3925876+08:00||;True|2024-07-15T10:13:28.1415352+08:00||;True|2024-07-08T14:33:12.6884426+08:00||;True|2024-07-08T09:56:58.4995696+08:00||; + True|2024-07-17T08:13:32.9037697Z||;True|2024-07-17T15:40:21.2550083+08:00||;True|2024-07-17T14:03:08.1814323+08:00||;True|2024-07-15T13:43:42.6073130+08:00||;True|2024-07-15T11:53:40.6498579+08:00||;True|2024-07-15T11:53:03.1652559+08:00||;True|2024-07-15T11:42:33.0154478+08:00||;True|2024-07-15T10:20:03.3925876+08:00||;True|2024-07-15T10:13:28.1415352+08:00||;True|2024-07-08T14:33:12.6884426+08:00||;True|2024-07-08T09:56:58.4995696+08:00||; \ No newline at end of file