jianghaiqing 2 years ago
commit 50bb1c8608

@ -0,0 +1,44 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Myshipping.Core.Entity;
namespace Myshipping.Application.Entity
{
/// <summary>
/// 舱单主表
/// </summary>
[SugarTable("BookingOrderSeaeEdiTemplate")]
[Description("舱单收发通模板")]
public class BookingOrderSeaeEdiTemplate : DBEntityTenant
{
/// <summary>
/// 模板名称
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 名称
/// </summary>
public string NAME { get; set; }
/// <summary>
/// 地址
/// </summary>
public string ADDR { get; set; }
/// <summary>
/// 国家code
/// </summary>
public string COUNTRY { get; set; }
/// <summary>
/// 国家
/// </summary>
public string COUNTRYName { get; set; }
/// <summary>
/// 发货人电话
/// </summary>
public string TEL { get; set; }
/// <summary>
/// 类型 1 收 2 发 3 通
/// </summary>
public string Type { get; set; }
}
}

@ -17,9 +17,10 @@ namespace Myshipping.Application.Helper
/// </summary>
public static class YardDataHelper
{
public static async Task<KeyValuePair<bool, string>> GetYardData(long tenantId, string tenantName, string mblno, string yardid, bool isWeb = true)
public static async Task<KeyValuePair<bool, string>> GetYardData(long userId, long tenantId, string tenantName, string mblno, string yardid, bool isWeb = true)
{
var cacheService = App.GetService<ISysCacheService>();
var webAccService = App.GetService<IDjyWebsiteAccountConfigService>();
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<bool, string>(false, "未找到青岛港用户名、密码配置,请通过租户参数配置");
return new KeyValuePair<bool, string>(false, "未找到青岛港用户名、密码配置,请到账号维护模块中添加");
}
qduname = tenantUserName.ItemCode;
qdpwd = tenantPwd.ItemCode;
qduname = qdPortAcc.Account;
qdpwd = qdPortAcc.Password;
}
var yardMappings = await cacheService.GetAllMappingYard();

@ -475,6 +475,11 @@ namespace Myshipping.Application
var entity = input.Adapt<BookingOrder>();
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<long> arr = new List<long>();
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<long> list = new List<long>();
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);

@ -50,10 +50,12 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingOrderSeaeEdiCtn> _seaeedictn;
private readonly ISysCacheService _cache;
private readonly SqlSugarRepository<BookingStatusLog> _repStatuslog;
private readonly SqlSugarRepository<BookingOrderSeaeEdiTemplate> _repTemplate;
private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
public BookingOrderSeaeEdiService(ILogger<BookingOrderSeaeEdiService> logger, SqlSugarRepository<BookingOrderSeaeEdi> seaeedi,
SqlSugarRepository<BookingOrderSeaeEdiCtn> seaeedictn, ISysCacheService cache, SqlSugarRepository<BookingStatusLog> repStatuslog,
IDjyWebsiteAccountConfigService webAccountConfig)
SqlSugarRepository<BookingOrderSeaeEdiTemplate> 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;
}
/// <summary>
/// 获取数据
@ -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<List<CTNDATAItem>>();
@ -368,5 +382,103 @@ namespace Myshipping.Application
}
#endregion
#region 模板
/// <summary>
/// 获取模板数据
/// </summary>
/// <returns></returns>
[HttpGet("/BookingOrderSeaeEdi/GetBookingOrderSeaeEdiTemplateList")]
public async Task<List<BookingOrderSeaeEdiTemplateDto>> 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<List<BookingOrderSeaeEdiTemplateDto>>();
return list;
}
/// <summary>
/// 保存信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[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<BookingOrderSeaeEdiTemplate>();
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();
}
}
/// <summary>
/// 删除舱单
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
[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
}
}

@ -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; }
/// <summary>
/// 模板名称
/// </summary>
public string TemplateNAME { get; set; }
/// <summary>
/// 名称
/// </summary>
public string NAME { get; set; }
/// <summary>
/// 地址
/// </summary>
public string ADDR { get; set; }
/// <summary>
/// 国家code
/// </summary>
public string COUNTRY { get; set; }
/// <summary>
/// 国家
/// </summary>
public string COUNTRYName { get; set; }
/// <summary>
/// 发货人电话
/// </summary>
public string TEL { get; set; }
/// <summary>
/// 类型 1 收 2 发 3 通
/// </summary>
public string Type { get; set; }
}
}

@ -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<BookingTruckService> logger,
SqlSugarRepository<BookingTruck> bookingTruckRepository,
public BookingTruckService(ISysCacheService cache, ILogger<BookingTruckService> logger,
SqlSugarRepository<BookingTruck> bookingTruckRepository,
SqlSugarRepository<BookingTruckCtn> bookingTruckContaRepository,
SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<BookingCtn> bookingCtnRepository,
@ -130,7 +130,7 @@ namespace Myshipping.Application
/// <param name="isCallBack">是否回写</param>
/// <returns>返回派车Id</returns>
[SqlSugarUnitOfWork]
private async Task<long> InnerSave(BookingTruckDto info,bool isCallBack = false)
private async Task<long> InnerSave(BookingTruckDto info, bool isCallBack = false)
{
BookingTruck entity = info.Adapt<BookingTruck>();
@ -139,7 +139,7 @@ namespace Myshipping.Application
List<BookingTruckCtn> entityCtnList = info.ContaList.Adapt<List<BookingTruckCtn>>();
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 批量提交派车
/// <summary>
@ -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<Task<TaskManageOrderResultDto>> taskList = new List<Task<TaskManageOrderResultDto>>();
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<string> msgList = new List<string>();
taskList.ForEach(async a => {
taskList.ForEach(async a =>
{
var rlt = a.Result;
if (!rlt.succ)
@ -971,7 +973,8 @@ namespace Myshipping.Application
List<Task<TaskManageOrderResultDto>> taskList = new List<Task<TaskManageOrderResultDto>>();
list.ForEach(async tk => {
list.ForEach(async tk =>
{
taskList.Add(InnerCancel(tk.Id, batchNo));
});
@ -983,7 +986,8 @@ namespace Myshipping.Application
List<string> msgList = new List<string>();
taskList.ForEach(async a => {
taskList.ForEach(async a =>
{
var rlt = a.Result;
if (!rlt.succ)
@ -1014,7 +1018,7 @@ namespace Myshipping.Application
/// <param name="id">派车主键</param>
/// <param name="batchNo">批次号</param>
/// <returns>返回回执</returns>
private async Task<TaskManageOrderResultDto> InnerCancel(long id,string batchNo)
private async Task<TaskManageOrderResultDto> 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
/// <param name="ids">派车主键组</param>
/// <returns>返回回执</returns>
[HttpPost("/BookingTruck/DeleteBatch")]
public async Task<TaskManageOrderResultDto> DeleteBatch([FromBody]long[] ids)
public async Task<TaskManageOrderResultDto> 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
/// <param name="printType">打印类型10FastReport、20Excel模板</param>
/// <returns>返回回执</returns>
[HttpGet("/BookingTruck/Print")]
public async Task<string> Print([FromQuery]long id, [FromQuery] long templateId, [FromQuery] string cateCode, [FromQuery] PrintFileTypeEnum printFileType = PrintFileTypeEnum.PDF,
public async Task<string> 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<BookingTruckSyncMessageMainInfo>();
bookingTruckSyncDto.ContaList = info.ContaList.Adapt<List<BookingTruckCtnDto>>();
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("发送MQrlt={rlt}",JSON.Serialize(mqRlt));
_logger.LogInformation("发送MQrlt={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)
{

@ -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<Task<TaskManageOrderResultDto>> taskList = new List<Task<TaskManageOrderResultDto>>();
list.ForEach(async tk => {
list.ForEach(async tk =>
{
taskList.Add(InnerSendDispatch(tk));
});
@ -763,7 +764,8 @@ namespace Myshipping.Application
List<string> msgList = new List<string>();
taskList.ForEach(async a => {
taskList.ForEach(async a =>
{
var rlt = a.Result;
if (!rlt.succ)
@ -822,7 +824,8 @@ namespace Myshipping.Application
List<Task<TaskManageOrderResultDto>> taskList = new List<Task<TaskManageOrderResultDto>>();
list.ForEach(async tk => {
list.ForEach(async tk =>
{
taskList.Add(InnerSendDispatch(tk));
});
@ -834,7 +837,8 @@ namespace Myshipping.Application
List<string> msgList = new List<string>();
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<BookingTruckDto>();
model.CallBackStatus = info.Status;
@ -1049,7 +1053,8 @@ namespace Myshipping.Application
List<Task<TaskManageOrderResultDto>> taskList = new List<Task<TaskManageOrderResultDto>>();
list.ForEach(async tk => {
list.ForEach(async tk =>
{
taskList.Add(InnerCancelDispatch(tk));
});
@ -1061,7 +1066,8 @@ namespace Myshipping.Application
List<string> msgList = new List<string>();
taskList.ForEach(async a => {
taskList.ForEach(async a =>
{
var rlt = a.Result;
if (!rlt.succ)
@ -1120,7 +1126,8 @@ namespace Myshipping.Application
List<Task<TaskManageOrderResultDto>> taskList = new List<Task<TaskManageOrderResultDto>>();
list.ForEach(async tk => {
list.ForEach(async tk =>
{
taskList.Add(InnerCancelDispatch(tk));
});
@ -1132,7 +1139,8 @@ namespace Myshipping.Application
List<string> msgList = new List<string>();
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)

@ -8958,6 +8958,11 @@
关键字
</summary>
</member>
<member name="P:Myshipping.Core.Service.NameQueryDto.ENName">
<summary>
英文名
</summary>
</member>
<member name="P:Myshipping.Core.Service.NameQueryDto.Limit">
<summary>
在分页中用不到
@ -11930,9 +11935,34 @@
</summary>
<returns></returns>
</member>
<member name="P:Myshipping.Core.Service.QueryDjyVesselInfoInput.KeyWord">
<member name="P:Myshipping.Core.Service.QueryDjyVesselInfoInput.CARRIER">
<summary>
关键字
船公司
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryDjyVesselInfoInput.Vessel">
<summary>
船名
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryDjyVesselInfoInput.VoynoInside">
<summary>
内部航次
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryDjyVesselInfoInput.Voyno">
<summary>
航次
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryDjyVesselInfoInput.StartETD">
<summary>
ETD开始日期
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryDjyVesselInfoInput.EndETD">
<summary>
ETD截止日期
</summary>
</member>
<member name="T:Myshipping.Core.Service.DjyWebsiteAccountConfigService">

@ -464,7 +464,7 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
/// <returns></returns>
public Task<List<MappingForwarder>> GetAllMappingForwarder()
{
return _cache.GetAsync<List<MappingForwarder>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD);
return _cache.GetAsync<List<MappingForwarder>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FORWARDER);
}
/// <summary>

@ -1583,7 +1583,9 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
{
List<CodeCountry> 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))

@ -18,6 +18,11 @@ namespace Myshipping.Core.Service
/// </summary>
public string KeyWord { get; set; }
/// <summary>
/// 英文名
/// </summary>
public string ENName { get; set; }
/// <summary>
/// 在分页中用不到
/// </summary>

@ -237,7 +237,7 @@ namespace Myshipping.Core.Service
[HttpGet("/DJYTenantParam/getParamValue")]
public async Task<List<DjyTenantParamValue>> 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();
}
/// <summary>
/// 增加参数

@ -55,11 +55,14 @@ namespace Myshipping.Core.Service
public async Task<dynamic> 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);
}

@ -13,9 +13,34 @@ namespace Myshipping.Core.Service
/// <summary>
/// 关键字
/// 船公司
/// </summary>
public string KeyWord { get; set; }
public string CARRIER { get; set; }
/// <summary>
/// 船名
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 内部航次
/// </summary>
public string VoynoInside { get; set; }
/// <summary>
/// 航次
/// </summary>
public string Voyno { get; set; }
/// <summary>
/// ETD开始日期
/// </summary>
public DateTime? StartETD { get; set; }
/// <summary>
/// ETD截止日期
/// </summary>
public DateTime? EndETD { get; set; }
}
}

Loading…
Cancel
Save