diff --git a/Myshipping.Application/Entity/BookingOrderSeaeEdiTemplate.cs b/Myshipping.Application/Entity/BookingOrderSeaeEdiTemplate.cs new file mode 100644 index 00000000..0405536d --- /dev/null +++ b/Myshipping.Application/Entity/BookingOrderSeaeEdiTemplate.cs @@ -0,0 +1,44 @@ +using System; +using SqlSugar; +using System.ComponentModel; +using Myshipping.Core.Entity; +namespace Myshipping.Application.Entity +{ + /// + /// 舱单主表 + /// + [SugarTable("BookingOrderSeaeEdiTemplate")] + [Description("舱单收发通模板")] + public class BookingOrderSeaeEdiTemplate : DBEntityTenant + { + /// + /// 模板名称 + /// + public string TemplateName { get; set; } + /// + /// 名称 + /// + public string NAME { get; set; } + /// + /// 地址 + /// + public string ADDR { get; set; } + /// + /// 国家code + /// + public string COUNTRY { get; set; } + /// + /// 国家 + /// + public string COUNTRYName { get; set; } + /// + /// 发货人电话 + /// + public string TEL { get; set; } + /// + /// 类型 1 收 2 发 3 通 + /// + public string Type { get; set; } + + } +} \ No newline at end of file diff --git a/Myshipping.Application/Helper/YardDataHelper.cs b/Myshipping.Application/Helper/YardDataHelper.cs index dfc6da47..f4756b44 100644 --- a/Myshipping.Application/Helper/YardDataHelper.cs +++ b/Myshipping.Application/Helper/YardDataHelper.cs @@ -17,9 +17,10 @@ namespace Myshipping.Application.Helper /// public static class YardDataHelper { - public static async Task> GetYardData(long tenantId, string tenantName, string mblno, string yardid, bool isWeb = true) + public static async Task> GetYardData(long userId, long tenantId, string tenantName, string mblno, string yardid, bool isWeb = true) { var cacheService = App.GetService(); + var webAccService = App.GetService(); var sysConfig = await cacheService.GetAllSysConfig(); @@ -35,16 +36,17 @@ namespace Myshipping.Application.Helper { //从租户参数中获取网站青岛港账号密码 var tenantParam = await cacheService.GetAllTenantParam(); - var tenantUserName = tenantParam.FirstOrDefault(x => x.TenantId == tenantId && x.ParaCode == "QDPORT_USERNAME"); - var tenantPwd = tenantParam.FirstOrDefault(x => x.TenantId == tenantId && x.ParaCode == "QDPORT_PWD"); + var qdPortAcc = await webAccService.GetAccountConfig("QingDaoPort", userId); + //var tenantUserName = tenantParam.FirstOrDefault(x => x.TenantId == tenantId && x.ParaCode == "QDPORT_USERNAME"); + //var tenantPwd = tenantParam.FirstOrDefault(x => x.TenantId == tenantId && x.ParaCode == "QDPORT_PWD"); - if (tenantUserName == null || tenantPwd == null) + if (qdPortAcc == null || string.IsNullOrEmpty(qdPortAcc.Account) || string.IsNullOrEmpty(qdPortAcc.Password)) { - return new KeyValuePair(false, "未找到青岛港用户名、密码配置,请通过租户参数配置"); + return new KeyValuePair(false, "未找到青岛港用户名、密码配置,请到账号维护模块中添加"); } - qduname = tenantUserName.ItemCode; - qdpwd = tenantPwd.ItemCode; + qduname = qdPortAcc.Account; + qdpwd = qdPortAcc.Password; } var yardMappings = await cacheService.GetAllMappingYard(); diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 8d93c3f9..bb2cb52a 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -475,6 +475,11 @@ namespace Myshipping.Application var entity = input.Adapt(); if (input.Id == 0) { + if (string.IsNullOrEmpty( entity.VOYNO)) { + entity.VOYNO = entity.VOYNOINNER; + } + + entity.BOOKINGNO = Yitter.IdGenerator.YitIdHelper.NextId().ToString(); await _rep.InsertAsync(entity); if (input.ctnInputs != null) @@ -522,6 +527,10 @@ namespace Myshipping.Application else { var mlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync(); + if (string.IsNullOrEmpty(entity.VOYNO)) + { + entity.VOYNO = entity.VOYNOINNER; + } await _rep.AsUpdateable(entity).IgnoreColumns(it => new { it.ParentId, @@ -703,7 +712,14 @@ namespace Myshipping.Application } List arr = new List(); arr.Add(Id); - await SendBookingOrder(arr.ToArray()); + var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault(); + if (!string.IsNullOrEmpty(itemcode)) + { + if (itemcode == "true") + await SendBookingOrder(arr.ToArray()); + } + + return ordOut; @@ -841,37 +857,43 @@ namespace Myshipping.Application _logger.LogInformation(Id + "删除成功!"); } - - try + var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault(); + if (!string.IsNullOrEmpty(itemcode)) { - const string MqActionExchangeName = "djy.output.dingcang.ds6"; - const string MqActionQueueName = "djy.output.dingcang.ds6_delete"; - ConnectionFactory factory = new ConnectionFactory(); - factory.Uri = new Uri(_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault()); + if (itemcode == "true") - using (IConnection conn = factory.CreateConnection()) - { - IModel mqModel = conn.CreateModel(); - mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct); - var queueName = $"{MqActionQueueName}.{UserManager.TENANT_ID}"; - mqModel.QueueDeclare(queueName, false, false, false, null); - mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null); - byte[] messageBodyBytes = Encoding.UTF8.GetBytes(Ids); - IBasicProperties props = mqModel.CreateBasicProperties(); - props.DeliveryMode = 2; - mqModel.BasicPublish(MqActionExchangeName, - queueName, props, - messageBodyBytes); - conn.Close(); - _logger.LogInformation($"订舱数据删除回推,已发送数据到消息队列【{_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault()}】,数据内容:【{Ids}】"); - } - } - catch (Exception ex) - { - _logger.LogError(ex.Message); - _logger.LogError(ex.StackTrace); + try + { + const string MqActionExchangeName = "djy.output.dingcang.ds6"; + const string MqActionQueueName = "djy.output.dingcang.ds6_delete"; + ConnectionFactory factory = new ConnectionFactory(); + factory.Uri = new Uri(_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault()); + using (IConnection conn = factory.CreateConnection()) + { + IModel mqModel = conn.CreateModel(); + mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct); + var queueName = $"{MqActionQueueName}.{UserManager.TENANT_ID}"; + mqModel.QueueDeclare(queueName, false, false, false, null); + mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null); + byte[] messageBodyBytes = Encoding.UTF8.GetBytes(Ids); + IBasicProperties props = mqModel.CreateBasicProperties(); + props.DeliveryMode = 2; + mqModel.BasicPublish(MqActionExchangeName, + queueName, props, + messageBodyBytes); + conn.Close(); + _logger.LogInformation($"订舱数据删除回推,已发送数据到消息队列【{_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault()}】,数据内容:【{Ids}】"); + } + } + catch (Exception ex) + { + _logger.LogError(ex.Message); + _logger.LogError(ex.StackTrace); + + } } + } else { @@ -906,8 +928,16 @@ namespace Myshipping.Application await _bookingEDIExt.UpdateAsync(x => x.BookingId == Id, x => new BookingEDIExt { IsDeleted = false }); List list = new List(); list.Add(Id); - await SendBookingOrder(list.ToArray()); - _logger.LogInformation(Id + "恢复删除成功!"); + var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault(); + if (!string.IsNullOrEmpty(itemcode)) + { + if (itemcode == "true") + await SendBookingOrder(list.ToArray()); + _logger.LogInformation(Id + "恢复删除成功!"); + } + + + } @@ -4018,16 +4048,16 @@ namespace Myshipping.Application if (!string.IsNullOrWhiteSpace(order.ISSUETYPE)) { - var currIssueTypeInfo = ediIssueTypeList.FirstOrDefault(t => !string.IsNullOrWhiteSpace(t.CarrierCode) - && t.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase) + var currIssueTypeInfo = ediIssueTypeList.FirstOrDefault(t => !string.IsNullOrWhiteSpace(t.CarrierCode) + && t.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase) && t.Code.Equals(baseIssueTypeInfo.Code, StringComparison.OrdinalIgnoreCase)); if (currIssueTypeInfo == null) { //如果没有对应的船司记录,则取默认的第一个代码对应的记录 - currIssueTypeInfo = ediIssueTypeList.FirstOrDefault(t => t.Code.Equals(baseIssueTypeInfo.Code, StringComparison.OrdinalIgnoreCase)); + currIssueTypeInfo = ediIssueTypeList.FirstOrDefault(t => t.Code.Equals(baseIssueTypeInfo.Code, StringComparison.OrdinalIgnoreCase)); } - + if (currIssueTypeInfo == null) throw Oops.Bah($"签单方式{order.ISSUETYPE}的EDI代码未找到"); @@ -5153,7 +5183,7 @@ namespace Myshipping.Application throw Oops.Bah("请先选择场站"); } - var rtn = await YardDataHelper.GetYardData(order.TenantId.Value, order.TenantName, order.MBLNO, order.YARDID, isWeb); + var rtn = await YardDataHelper.GetYardData(UserManager.UserId, order.TenantId.Value, order.TenantName, order.MBLNO, order.YARDID, isWeb); if (!rtn.Key) { throw Oops.Bah(rtn.Value); diff --git a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs index de01edd6..1340a425 100644 --- a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs +++ b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs @@ -50,10 +50,12 @@ namespace Myshipping.Application private readonly SqlSugarRepository _seaeedictn; private readonly ISysCacheService _cache; private readonly SqlSugarRepository _repStatuslog; + private readonly SqlSugarRepository _repTemplate; private readonly IDjyWebsiteAccountConfigService _webAccountConfig; public BookingOrderSeaeEdiService(ILogger logger, SqlSugarRepository seaeedi, SqlSugarRepository seaeedictn, ISysCacheService cache, SqlSugarRepository repStatuslog, - IDjyWebsiteAccountConfigService webAccountConfig) + SqlSugarRepository repTemplate, + IDjyWebsiteAccountConfigService webAccountConfig) { this._logger = logger; this._seaeedi = seaeedi; @@ -61,7 +63,7 @@ namespace Myshipping.Application this._cache = cache; this._repStatuslog = repStatuslog; this._webAccountConfig = webAccountConfig; - + this._repTemplate = repTemplate; } /// /// 获取数据 @@ -113,6 +115,12 @@ namespace Myshipping.Application { entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault(); } + if (entity.CARGOID!="D") { + + entity.DCLASS = string.Empty; + entity.DUNNO = string.Empty; + } + await _seaeedi.InsertAsync(entity); if (input.EdiCtn != null) @@ -133,7 +141,7 @@ namespace Myshipping.Application ctn.CTN = ctn.CTNALL.Split("'")[1].ToString(); } - + await _seaeedictn.InsertAsync(ctn); } } @@ -145,6 +153,12 @@ namespace Myshipping.Application { entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault(); } + if (entity.CARGOID != "D") + { + + entity.DCLASS = string.Empty; + entity.DUNNO = string.Empty; + } await _seaeedi.AsUpdateable(entity).IgnoreColumns(it => new { it.MBLNO, @@ -273,13 +287,13 @@ namespace Myshipping.Application mDATA.SENDREMARK = SENDREMARK; var FORWARDER = mDATA.FORWARDER; var YardCode = mDATA.YARDID; - if (_cache.GetAllMappingForwarder().Result.Where(x => x.Code == FORWARDER && x.Module == "cangdan").Select(x => x.MapCode).FirstOrDefault()==null) + if (_cache.GetAllMappingForwarder().Result.Where(x => x.Code == FORWARDER && x.Module == "cangdan").Select(x => x.MapCode).FirstOrDefault() == null) { throw Oops.Bah("暂不支持此船代"); } mDATA.FORWARDER = _cache.GetAllMappingForwarder().Result.Where(x => x.Code == FORWARDER && x.Module == "cangdan").Select(x => x.MapCode).FirstOrDefault(); - + mDATA.YARDID = _cache.GetAllCodeYard().Result.Where(x => x.Code == YardCode).Select(x => x.ShowCode).FirstOrDefault(); CTNDATA = ctns.Adapt>(); @@ -368,5 +382,103 @@ namespace Myshipping.Application } #endregion + + + #region 模板 + + /// + /// 获取模板数据 + /// + /// + [HttpGet("/BookingOrderSeaeEdi/GetBookingOrderSeaeEdiTemplateList")] + public async Task> GetBookingOrderSeaeEdiTemplateList(string type, string templatename = null) + { + + var entities = await _repTemplate.AsQueryable().Where(x => x.Type == type). + WhereIF(!string.IsNullOrEmpty(templatename), x => x.TemplateName.Contains(templatename)). + ToListAsync(); + var list = entities.Adapt>(); + + return list; + } + + + + /// + /// 保存信息 + /// + /// + /// + [HttpPost("/BookingOrderSeaeEdi/SaveBookingOrderSeaeEdiTemplate")] + public async Task SaveBookingOrderSeaeEdiTemplate(BookingOrderSeaeEdiTemplateDto input) + { + + if (input == null) + { + throw Oops.Bah("请传入正常数据!"); + } + if (!string.IsNullOrWhiteSpace(input.TemplateNAME)) + { + var et = await _repTemplate.Where(x => x.TemplateName == input.TemplateNAME && x.Id != input.Id).FirstAsync(); + if (et != null) + { + + throw Oops.Bah("当前模板名称已存在,请勿重复录入!"); + + } + } + var entity = input.Adapt(); + + if (input.Id == 0) + { + + + await _repTemplate.InsertAsync(entity); + + + } + else + { + + await _repTemplate.AsUpdateable(entity).IgnoreColumns(it => new + { + it.TenantId, + it.CreatedTime, + it.CreatedUserId, + it.CreatedUserName, + it.IsDeleted + }).ExecuteCommandAsync(); + } + + + + } + + + + /// + /// 删除舱单 + /// + /// + /// + [SqlSugarUnitOfWork] + + [HttpPost("/BookingOrderSeaeEdi/DeleteBookingOrderSeaeEdiTemplate")] + public async Task DeleteBookingOrderSeaeEdiTemplate(string Ids) + { + var arr = Ids.Split(","); + if (arr.Count() > 0) + { + foreach (var ar in arr) + { + long Id = Convert.ToInt64(ar); + await _repTemplate.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdiTemplate { IsDeleted = true }); + + + } + } + } + + #endregion } } diff --git a/Myshipping.Application/Service/BookingOrderSeaeEdi/Dto/BookingOrderSeaeEdiTemplateDto.cs b/Myshipping.Application/Service/BookingOrderSeaeEdi/Dto/BookingOrderSeaeEdiTemplateDto.cs new file mode 100644 index 00000000..5273e05e --- /dev/null +++ b/Myshipping.Application/Service/BookingOrderSeaeEdi/Dto/BookingOrderSeaeEdiTemplateDto.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application.Service.BookingOrderSeaeEdi.Dto +{ + public class BookingOrderSeaeEdiTemplateDto + { + public long Id { get; set; } + /// + /// 模板名称 + /// + public string TemplateNAME { get; set; } + /// + /// 名称 + /// + public string NAME { get; set; } + /// + /// 地址 + /// + public string ADDR { get; set; } + /// + /// 国家code + /// + public string COUNTRY { get; set; } + /// + /// 国家 + /// + public string COUNTRYName { get; set; } + /// + /// 发货人电话 + /// + public string TEL { get; set; } + /// + /// 类型 1 收 2 发 3 通 + /// + public string Type { get; set; } + } +} diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index 5b50d53e..64dc599b 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -66,8 +66,8 @@ namespace Myshipping.Application const string MQ_EXCHANGE_NAME = "djy.output.booktruck.ds6"; const string MQ_QUEUE_NAME = "djy.output.booktruck.ds6"; - public BookingTruckService(ISysCacheService cache, ILogger logger, - SqlSugarRepository bookingTruckRepository, + public BookingTruckService(ISysCacheService cache, ILogger logger, + SqlSugarRepository bookingTruckRepository, SqlSugarRepository bookingTruckContaRepository, SqlSugarRepository bookingOrderRepository, SqlSugarRepository bookingCtnRepository, @@ -130,7 +130,7 @@ namespace Myshipping.Application /// 是否回写 /// 返回派车Id [SqlSugarUnitOfWork] - private async Task InnerSave(BookingTruckDto info,bool isCallBack = false) + private async Task InnerSave(BookingTruckDto info, bool isCallBack = false) { BookingTruck entity = info.Adapt(); @@ -139,7 +139,7 @@ namespace Myshipping.Application List entityCtnList = info.ContaList.Adapt>(); - if(entityCtnList != null && entityCtnList.Count > 0) + if (entityCtnList != null && entityCtnList.Count > 0) { //保存时默认统计箱型箱量 entity.CntrTotal = string.Join(";", entityCtnList.GroupBy(a => a.CTNALL) @@ -182,8 +182,8 @@ namespace Myshipping.Application throw Oops.Oh($"派车信息获取失败,派车信息不存在或已作废", typeof(InvalidOperationException)); if (!isCallBack) - { - //校验 + { + //校验 ValidateTruck(OperateTypeEnum.Save, new BookingTruck[] { model }); entity.UpdatedTime = DateTime.Now; @@ -229,7 +229,7 @@ namespace Myshipping.Application }).ExecuteCommandAsync(); } - + await _bookingTruckContaRepository.DeleteAsync(x => x.TruckId == model.Id); @@ -521,7 +521,7 @@ namespace Myshipping.Application //这里岗位是调度的信息,如果默认只有一条记录,取第一条,其他情况不返回默认值 var userPosInfo = await _sysUserService.QueryUserByPos("", "PCDD"); - if(userPosInfo.Count == 1) + if (userPosInfo.Count == 1) { model.DispatcherId = userPosInfo.FirstOrDefault().SysEmpId; model.DispatcherName = userPosInfo.FirstOrDefault().SysEmpName; @@ -529,9 +529,9 @@ namespace Myshipping.Application var yardList = await _djyCustomerService.QuerytDjyCustomerInfo("", new string[] { "yard" }, 999); - if(yardList.Count > 0) + if (yardList.Count > 0) { - if((string.IsNullOrWhiteSpace(model.YARDCONTRACT) || string.IsNullOrWhiteSpace(model.YARDCONTRACTTEL)) + if ((string.IsNullOrWhiteSpace(model.YARDCONTRACT) || string.IsNullOrWhiteSpace(model.YARDCONTRACTTEL)) && !string.IsNullOrWhiteSpace(model.YARD)) { var currYardList = yardList.Select(a => @@ -834,7 +834,7 @@ namespace Myshipping.Application } #endregion - + #region 批量提交派车 /// @@ -856,7 +856,7 @@ namespace Myshipping.Application var list = _bookingTruckRepository.AsQueryable() .Where(a => ids.Contains(a.Id)).ToList(); - if(list.Count != ids.Length) + if (list.Count != ids.Length) throw Oops.Oh($"部分派车信息获取失败,不能提交,派车信息不存在或已作废"); //校验 @@ -864,19 +864,21 @@ namespace Myshipping.Application List> taskList = new List>(); - list.ForEach(async tk => { + list.ForEach(async tk => + { taskList.Add(InnerSubmit(new BookingTruckDto { Id = tk.Id }, batchNo, false)); }); //等待所有结果 - Task.WaitAll(taskList.ToArray(),20000); + Task.WaitAll(taskList.ToArray(), 20000); result.succ = true; result.msg = "提交成功"; List msgList = new List(); - taskList.ForEach(async a => { + taskList.ForEach(async a => + { var rlt = a.Result; if (!rlt.succ) @@ -971,7 +973,8 @@ namespace Myshipping.Application List> taskList = new List>(); - list.ForEach(async tk => { + list.ForEach(async tk => + { taskList.Add(InnerCancel(tk.Id, batchNo)); }); @@ -983,7 +986,8 @@ namespace Myshipping.Application List msgList = new List(); - taskList.ForEach(async a => { + taskList.ForEach(async a => + { var rlt = a.Result; if (!rlt.succ) @@ -1014,7 +1018,7 @@ namespace Myshipping.Application /// 派车主键 /// 批次号 /// 返回回执 - private async Task InnerCancel(long id,string batchNo) + private async Task InnerCancel(long id, string batchNo) { /* 撤销派车流程 @@ -1074,7 +1078,7 @@ namespace Myshipping.Application DateTime eDate = DateTime.Now; - + TimeSpan ts = eDate.Subtract(bDate); var timeDiff = ts.TotalMilliseconds; @@ -1091,7 +1095,7 @@ namespace Myshipping.Application model.UpdatedUserId = UserManager.UserId; model.UpdatedUserName = UserManager.Name; model.TaskNo = null; - + await _bookingTruckRepository.AsUpdateable(model).UpdateColumns(it => new { it.Status, @@ -1148,7 +1152,7 @@ namespace Myshipping.Application /// 派车主键组 /// 返回回执 [HttpPost("/BookingTruck/DeleteBatch")] - public async Task DeleteBatch([FromBody]long[] ids) + public async Task DeleteBatch([FromBody] long[] ids) { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); @@ -1164,7 +1168,8 @@ namespace Myshipping.Application //先校验 ValidateTruck(OperateTypeEnum.Delete, truckOrderList.ToArray()); - truckOrderList.ForEach(async tk => { + truckOrderList.ForEach(async tk => + { await _bookingTruckRepository.UpdateAsync(x => x.Id == tk.Id, x => new BookingTruck { IsDeleted = true }); }); @@ -1247,7 +1252,7 @@ namespace Myshipping.Application /// 打印类型,10:FastReport、20:Excel模板 /// 返回回执 [HttpGet("/BookingTruck/Print")] - public async Task Print([FromQuery]long id, [FromQuery] long templateId, [FromQuery] string cateCode, [FromQuery] PrintFileTypeEnum printFileType = PrintFileTypeEnum.PDF, + public async Task Print([FromQuery] long id, [FromQuery] long templateId, [FromQuery] string cateCode, [FromQuery] PrintFileTypeEnum printFileType = PrintFileTypeEnum.PDF, [FromQuery] BookingPrintTemplateType printType = BookingPrintTemplateType.FastReport) { var printTemplate = await _bookingPrintTemplateTemplate.AsQueryable().Filter(null, true) @@ -1259,7 +1264,7 @@ namespace Myshipping.Application } var truckOrder = await _bookingTruckRepository.FirstOrDefaultAsync(x => x.Id == id); - if(!truckOrder.NeedArriveTime.HasValue) + if (!truckOrder.NeedArriveTime.HasValue) { throw Oops.Oh("要求送达日期不能为空"); } @@ -1275,7 +1280,7 @@ namespace Myshipping.Application //{ // throw Oops.Bah("分类代码参数不正确"); //} - + if (printType == BookingPrintTemplateType.FastReport) { #region FastReport打印 @@ -1616,7 +1621,7 @@ namespace Myshipping.Application { model.Vessel = bookingOrder.VESSEL; - if(!string.IsNullOrWhiteSpace(bookingOrder.VOYNO)) + if (!string.IsNullOrWhiteSpace(bookingOrder.VOYNO)) { model.VoyNo = bookingOrder.VOYNO; } @@ -1624,7 +1629,7 @@ namespace Myshipping.Application { model.VoyNo = bookingOrder.VOYNOINNER; } - + model.MBLNo = bookingOrder.MBLNO; model.CarrierID = bookingOrder.CARRIERID; model.Carrier = bookingOrder.CARRIER; @@ -1668,7 +1673,7 @@ namespace Myshipping.Application throw Oops.Oh($"派车状态只有暂存、已撤销才能提交", typeof(InvalidOperationException)); } - if(entityArg.Any(a=> !a.DispatcherId.HasValue ||(a.DispatcherId.HasValue && a.DispatcherId.Value == 0))) + if (entityArg.Any(a => !a.DispatcherId.HasValue || (a.DispatcherId.HasValue && a.DispatcherId.Value == 0))) { throw Oops.Oh($"未填写调度,不能提交", typeof(InvalidOperationException)); } @@ -1693,9 +1698,9 @@ namespace Myshipping.Application throw Oops.Oh($"派车状态只有暂存、已撤销才能作废", typeof(InvalidOperationException)); } } - else if(operateType == OperateTypeEnum.DispatchBackSave) + else if (operateType == OperateTypeEnum.DispatchBackSave) { - if (entityArg.Any(a => a.Status != BookingTruckStatus.SUBMITED.ToString() + if (entityArg.Any(a => a.Status != BookingTruckStatus.SUBMITED.ToString() && a.Status != BookingTruckStatus.SEND_DISPATCH.ToString() && a.Status != BookingTruckStatus.CANCEL_DISPATCH.ToString())) { @@ -1729,12 +1734,12 @@ namespace Myshipping.Application if (bookingTruckInfo == null) throw Oops.Oh($"派车信息不存在", typeof(InvalidOperationException)); - if(bookingTruckInfo.Status != BookingTruckStatus.SUBMITED.ToString() - && bookingTruckInfo.Status != BookingTruckStatus.SEND_DISPATCH.ToString() + if (bookingTruckInfo.Status != BookingTruckStatus.SUBMITED.ToString() + && bookingTruckInfo.Status != BookingTruckStatus.SEND_DISPATCH.ToString() && bookingTruckInfo.Status != BookingTruckStatus.CANCEL_DISPATCH.ToString()) throw Oops.Oh($"当前派车信息不是已提交状态不能接收回写", typeof(InvalidOperationException)); - var id = await InnerSave(info,true); + var id = await InnerSave(info, true); BookingTruckSyncMessageInfo messageInfo = new BookingTruckSyncMessageInfo(); @@ -1757,7 +1762,7 @@ namespace Myshipping.Application BookingTruckSyncMessageMainInfo bookingTruckSyncDto = info.Adapt(); bookingTruckSyncDto.ContaList = info.ContaList.Adapt>(); - if(info.CallBackStatus == BookingTruckStatus.CANCEL_DISPATCH.ToString()) + if (info.CallBackStatus == BookingTruckStatus.CANCEL_DISPATCH.ToString()) { bookingTruckSyncDto.OperType = "Delete"; } @@ -1773,12 +1778,12 @@ namespace Myshipping.Application var mqRlt = await PushSyncBookingTruckMQToDS6(messageInfo); - _logger.LogInformation("发送MQ,rlt={rlt}",JSON.Serialize(mqRlt)); + _logger.LogInformation("发送MQ,rlt={rlt}", JSON.Serialize(mqRlt)); result.succ = true; result.msg = "保存成功"; result.ext = id; - + } catch (Exception ex) { @@ -1809,13 +1814,13 @@ namespace Myshipping.Application throw Oops.Bah("字典未配置 url_set->BookingOrderMQUri 请联系管理员"); } - + //请求MQ var json = JSON.Serialize(bookingTruckSyncMessageInfo); var mqRlt = MQHelper.SendMQ(json, mqUrl, MQ_EXCHANGE_NAME, MQ_QUEUE_NAME , bookingTruckSyncMessageInfo.Main.TenantId); - _logger.LogInformation("发送MQ请求完成,结果={rlt}",JSON.Serialize(mqRlt)); + _logger.LogInformation("发送MQ请求完成,结果={rlt}", JSON.Serialize(mqRlt)); if (mqRlt.succ) { @@ -1828,7 +1833,7 @@ namespace Myshipping.Application } } - catch(Exception ex) + catch (Exception ex) { result.succ = false; result.msg = ex.GetMessage("同步东胜失败"); @@ -1854,8 +1859,8 @@ namespace Myshipping.Application throw Oops.Oh($"派车信息不能为空", typeof(InvalidOperationException)); BookingOrder bookingOrder = null; - - if(entity.BookingId.HasValue) + + if (entity.BookingId.HasValue) { bookingOrder = _bookingOrderRepository.AsQueryable().First(x => x.Id == entity.BookingId.Value); } @@ -1863,13 +1868,13 @@ namespace Myshipping.Application string yardId = string.Empty; string mblNo = string.Empty; - if(bookingOrder != null) + if (bookingOrder != null) { yardId = bookingOrder.YARDID; mblNo = bookingOrder.MBLNO; } - if(string.IsNullOrWhiteSpace(yardId)) + if (string.IsNullOrWhiteSpace(yardId)) yardId = entity.YARDID; if (string.IsNullOrWhiteSpace(mblNo)) @@ -1885,8 +1890,8 @@ namespace Myshipping.Application throw Oops.Bah("提单号不能为空"); } - var rtn = await YardDataHelper.GetYardData(bookingOrder.TenantId.Value, bookingOrder.TenantName, - mblNo, yardId , isWeb); + var rtn = await YardDataHelper.GetYardData(UserManager.UserId, bookingOrder.TenantId.Value, bookingOrder.TenantName, + mblNo, yardId, isWeb); if (!rtn.Key) { diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs index 38976b45..09e3a0a8 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageTruckService.cs @@ -260,9 +260,9 @@ namespace Myshipping.Application try { - var taskBase =_taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); + var taskBase = _taskBaseRepository.AsQueryable().First(a => a.PK_ID == taskPkId); - if(taskBase == null) + if (taskBase == null) throw Oops.Oh($"任务主键{taskPkId}无法获取业务信息"); var truckOrder = _taskTruckRepository.AsQueryable().First(a => a.TASK_ID == taskBase.PK_ID); @@ -710,7 +710,7 @@ namespace Myshipping.Application { var model = _taskTruckRepository.AsQueryable().First(a => a.PK_ID == pkId); - if(model == null) + if (model == null) throw Oops.Oh($"派车主键{pkId}无法获取业务信息"); result = await InnerSendDispatch(model); @@ -751,7 +751,8 @@ namespace Myshipping.Application List> taskList = new List>(); - list.ForEach(async tk => { + list.ForEach(async tk => + { taskList.Add(InnerSendDispatch(tk)); }); @@ -763,7 +764,8 @@ namespace Myshipping.Application List msgList = new List(); - taskList.ForEach(async a => { + taskList.ForEach(async a => + { var rlt = a.Result; if (!rlt.succ) @@ -822,7 +824,8 @@ namespace Myshipping.Application List> taskList = new List>(); - list.ForEach(async tk => { + list.ForEach(async tk => + { taskList.Add(InnerSendDispatch(tk)); }); @@ -834,7 +837,8 @@ namespace Myshipping.Application List msgList = new List(); - taskList.ForEach(a => { + taskList.ForEach(a => + { var rlt = a.Result; if (!rlt.succ) @@ -906,7 +910,7 @@ namespace Myshipping.Application }).ExecuteCommandAsync(); - var truckCtnList =_taskTruckContaRepository.AsQueryable().Where(a => a.P_ID == info.PK_ID).ToList(); + var truckCtnList = _taskTruckContaRepository.AsQueryable().Where(a => a.P_ID == info.PK_ID).ToList(); BookingTruckDto model = info.Adapt(); model.CallBackStatus = info.Status; @@ -1049,7 +1053,8 @@ namespace Myshipping.Application List> taskList = new List>(); - list.ForEach(async tk => { + list.ForEach(async tk => + { taskList.Add(InnerCancelDispatch(tk)); }); @@ -1061,7 +1066,8 @@ namespace Myshipping.Application List msgList = new List(); - taskList.ForEach(async a => { + taskList.ForEach(async a => + { var rlt = a.Result; if (!rlt.succ) @@ -1120,7 +1126,8 @@ namespace Myshipping.Application List> taskList = new List>(); - list.ForEach(async tk => { + list.ForEach(async tk => + { taskList.Add(InnerCancelDispatch(tk)); }); @@ -1132,7 +1139,8 @@ namespace Myshipping.Application List msgList = new List(); - taskList.ForEach(a => { + taskList.ForEach(a => + { var rlt = a.Result; if (!rlt.succ) @@ -1205,7 +1213,7 @@ namespace Myshipping.Application } else if (operateType == OperateTypeEnum.SendDispatch) { - if (entityArg.Any(a => a.Status != BookingTruckStatus.TEMP.ToString() + if (entityArg.Any(a => a.Status != BookingTruckStatus.TEMP.ToString() && a.Status != BookingTruckStatus.SUBMITED.ToString() && a.Status != BookingTruckStatus.CANCEL_DISPATCH.ToString())) { @@ -1323,7 +1331,7 @@ namespace Myshipping.Application throw Oops.Bah("提单号不能为空"); } - var rtn = await YardDataHelper.GetYardData(bookingOrder.TenantId.Value, bookingOrder.TenantName, + var rtn = await YardDataHelper.GetYardData(UserManager.UserId, bookingOrder.TenantId.Value, bookingOrder.TenantName, mblNo, yardId, isWeb); if (!rtn.Key) diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 1ea74936..6933d695 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -8958,6 +8958,11 @@ 关键字 + + + 英文名 + + 在分页中用不到 @@ -11930,9 +11935,34 @@ - + - 关键字 + 船公司 + + + + + 船名 + + + + + 内部航次 + + + + + 航次 + + + + + ETD开始日期 + + + + + ETD截止日期 diff --git a/Myshipping.Core/Service/Cache/SysCacheService.cs b/Myshipping.Core/Service/Cache/SysCacheService.cs index 67b92192..7fa65265 100644 --- a/Myshipping.Core/Service/Cache/SysCacheService.cs +++ b/Myshipping.Core/Service/Cache/SysCacheService.cs @@ -464,7 +464,7 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet /// public Task> GetAllMappingForwarder() { - return _cache.GetAsync>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD); + return _cache.GetAsync>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FORWARDER); } /// diff --git a/Myshipping.Core/Service/CommonDB/CommonDBService.cs b/Myshipping.Core/Service/CommonDB/CommonDBService.cs index 46b9d3f4..b47931b0 100644 --- a/Myshipping.Core/Service/CommonDB/CommonDBService.cs +++ b/Myshipping.Core/Service/CommonDB/CommonDBService.cs @@ -1583,7 +1583,9 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie { List list = await _sysCacheService.GetAllCodeCountry(); - var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), + var queryList = list + .WhereIF(!string.IsNullOrEmpty(input.ENName),x=> x.EnName.Contains(input.ENName, System.StringComparison.CurrentCultureIgnoreCase)) + .WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) || (!string.IsNullOrWhiteSpace(x.EnName) && x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) || (!string.IsNullOrWhiteSpace(x.CnName) && x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)) diff --git a/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs b/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs index 25c7c750..3bf958f3 100644 --- a/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs +++ b/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs @@ -18,6 +18,11 @@ namespace Myshipping.Core.Service /// public string KeyWord { get; set; } + /// + /// 英文名 + /// + public string ENName { get; set; } + /// /// 在分页中用不到 /// diff --git a/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs b/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs index 1f836d78..f170c486 100644 --- a/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs +++ b/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs @@ -237,7 +237,7 @@ namespace Myshipping.Core.Service [HttpGet("/DJYTenantParam/getParamValue")] public async Task> GetParamValue(long tenantId, string paraCode = null) { - return await _valuerep.AsQueryable().Filter(null, true).Where(x => x.TenantId == tenantId).WhereIF(paraCode != null, x => x.ParaCode == paraCode).OrderBy(x => x.Sort).ToListAsync(); + return await _valuerep.AsQueryable().Filter(null, true).WhereIF(paraCode != null, x => x.ParaCode == paraCode).OrderBy(x => x.Sort).ToListAsync(); } /// /// 增加参数 diff --git a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs index 8e6a0940..45cf710f 100644 --- a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs +++ b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs @@ -55,11 +55,14 @@ namespace Myshipping.Core.Service public async Task GetListPage([FromQuery] QueryDjyVesselInfoInput input) { - return await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID). - WhereIF(!string.IsNullOrWhiteSpace(input.KeyWord), x => x.Vessel.Contains(input.KeyWord) - || x.CARRIER.Contains(input.KeyWord) || x.Voyno.Contains(input.KeyWord) || x.PortLoading.Contains(input.KeyWord) || x.PortTransit.Contains(input.KeyWord) || - x.PortDischarge.Contains(input.KeyWord) || x.VoynoInside.Contains(input.KeyWord) - ).ToPagedListAsync(input.PageNo, input.PageSize); + return await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID) + .WhereIF(!string.IsNullOrWhiteSpace(input.CARRIER), x => x.CARRIER.Contains(input.CARRIER)) + .WhereIF(!string.IsNullOrWhiteSpace(input.Vessel), x => x.Vessel.Contains(input.Vessel)) + .WhereIF(!string.IsNullOrWhiteSpace(input.VoynoInside), x => x.VoynoInside.Contains(input.VoynoInside)) + .WhereIF(!string.IsNullOrWhiteSpace(input.Voyno), x => x.Voyno.Contains(input.Voyno)) + .WhereIF(input.StartETD != null, x => x.ETD >= input.StartETD) + .WhereIF(input.EndETD != null, x => x.ETD <= input.EndETD) + .ToPagedListAsync(input.PageNo, input.PageSize); } diff --git a/Myshipping.Core/Service/DjyVesselInfo/Dto/QueryDjyVesselInfoInput.cs b/Myshipping.Core/Service/DjyVesselInfo/Dto/QueryDjyVesselInfoInput.cs index 35b67c84..8c9896d1 100644 --- a/Myshipping.Core/Service/DjyVesselInfo/Dto/QueryDjyVesselInfoInput.cs +++ b/Myshipping.Core/Service/DjyVesselInfo/Dto/QueryDjyVesselInfoInput.cs @@ -13,9 +13,34 @@ namespace Myshipping.Core.Service /// - /// 关键字 + /// 船公司 /// - public string KeyWord { get; set; } + public string CARRIER { get; set; } + /// + /// 船名 + /// + public string Vessel { get; set; } + /// + /// 内部航次 + /// + public string VoynoInside { get; set; } + + /// + /// 航次 + /// + public string Voyno { get; set; } + + /// + /// ETD开始日期 + /// + public DateTime? StartETD { get; set; } + + /// + /// ETD截止日期 + /// + public DateTime? EndETD { get; set; } } + + }