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);
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,6 +857,10 @@ namespace Myshipping.Application
_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")
try
{
@ -873,6 +893,8 @@ namespace Myshipping.Application
}
}
}
else
{
@ -906,11 +928,19 @@ namespace Myshipping.Application
await _bookingEDIExt.UpdateAsync(x => x.BookingId == Id, x => new BookingEDIExt { IsDeleted = false });
List<long> list = new List<long>();
list.Add(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 + "恢复删除成功!");
}
}
//try
//{
@ -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,9 +50,11 @@ 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,
SqlSugarRepository<BookingOrderSeaeEdiTemplate> repTemplate,
IDjyWebsiteAccountConfigService webAccountConfig)
{
this._logger = logger;
@ -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)
@ -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,
@ -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; }
}
}

@ -864,7 +864,8 @@ 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));
});
@ -876,7 +877,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)
@ -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)
@ -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 });
});
@ -1885,7 +1890,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)

@ -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)
@ -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)
@ -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