jianghaiqing 1 year ago
commit 80b9635b3c

@ -0,0 +1,32 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Myshipping.Core.Entity;
namespace Myshipping.Application.Entity
{
/// <summary>
/// 订舱打印模板分享
/// </summary>
[SugarTable("booking_template_share")]
[Description("订舱打印模板分享")]
public class BookingPrintTemplateShare : DBEntityTenant
{
/// <summary>
/// 模板id
/// </summary>
public long TemplateId { get; set; }
/// <summary>
/// 分享用户Id
/// </summary>
public long ShareToId { get; set; }
/// <summary>
/// 分享用户
/// </summary>
public string ShareToName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

@ -493,7 +493,7 @@ namespace Myshipping.Application
itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId);
}
item.IsVGM=itgoods.Where(x => x.StatusName == "提交VGM").FirstOrDefault()==null?null: itgoods.Where(x => x.StatusName == "提交VGM").Select(x=>x.FinishTime).FirstOrDefault();
item.IsCanDan = itgoods.Where(x => x.StatusName == "已放舱").FirstOrDefault() == null ? null : itgoods.Where(x => x.StatusName == "已放舱").Select(x => x.FinishTime).FirstOrDefault();
item.IsCanDan = itgoods.Where(x => x.StatusName == "提交舱单").FirstOrDefault() == null ? null : itgoods.Where(x => x.StatusName == "提交舱单").Select(x => x.FinishTime).FirstOrDefault();
item.IsZZFX = itgoods.Where(x => x.StatusName == "装载放行").FirstOrDefault() == null ? null : itgoods.Where(x => x.StatusName == "装载放行").Select(x => x.FinishTime).FirstOrDefault();
item.GoodsStatusList = itgoods.Union<GoodsStatusList>(itconfig).OrderBy(x => x.Sort).ToList();
////获取提箱返场状态
@ -872,7 +872,7 @@ namespace Myshipping.Application
itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId);
}
item.IsVGM = itgoods.Where(x => x.StatusName == "提交VGM").FirstOrDefault() == null ? null : itgoods.Where(x => x.StatusName == "提交VGM").Select(x => x.FinishTime).FirstOrDefault();
item.IsCanDan = itgoods.Where(x => x.StatusName == "已放舱").FirstOrDefault() == null ? null : itgoods.Where(x => x.StatusName == "已放舱").Select(x => x.FinishTime).FirstOrDefault();
item.IsCanDan = itgoods.Where(x => x.StatusName == "提交舱单").FirstOrDefault() == null ? null : itgoods.Where(x => x.StatusName == "提交舱单").Select(x => x.FinishTime).FirstOrDefault();
item.IsZZFX = itgoods.Where(x => x.StatusName == "装载放行").FirstOrDefault() == null ? null : itgoods.Where(x => x.StatusName == "装载放行").Select(x => x.FinishTime).FirstOrDefault();
item.GoodsStatusList = itgoods.Union<GoodsStatusList>(itconfig).OrderBy(x => x.Sort).ToList();
//获取提箱返场状态

@ -405,7 +405,7 @@ namespace Myshipping.Application
Sort = config.Sort
}).ToList();
var ConfigId = config.Where(x => x.StatusName == "已订舱").Select(x => x.ConfigId).First();
var ConfigId = config.Where(x => x.StatusName == "提交舱单").Select(x => x.ConfigId).First();
await _goodsStatus.InsertAsync(new BookingGoodsStatus
{

@ -36,9 +36,10 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingOrder> _repOrder;
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrintTemplate;
private readonly SqlSugarRepository<BookingPrintTemplateShare> _repPrintTemplateShare;
private readonly ILogger<BookingTemplate> _logger;
public BookingTemplateService(SqlSugarRepository<BookingTemplate> rep, SqlSugarRepository<BookingOrder> repOrder, SqlSugarRepository<BookingPrintTemplate> repPrintTemplate, ILogger<BookingTemplate> logger)
public BookingTemplateService(SqlSugarRepository<BookingTemplate> rep, SqlSugarRepository<BookingOrder> repOrder, SqlSugarRepository<BookingPrintTemplate> repPrintTemplate, SqlSugarRepository<BookingPrintTemplateShare> repPrintTemplateShare,ILogger<BookingTemplate> logger)
{
@ -46,6 +47,7 @@ namespace Myshipping.Application
_rep = rep;
_logger = logger;
_repPrintTemplate = repPrintTemplate;
_repPrintTemplateShare = repPrintTemplateShare;
}
/// <summary>
@ -123,6 +125,72 @@ namespace Myshipping.Application
{
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
}
/// <summary>
/// 新增编辑分享
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/BookingTemplate/SaveTemplateShare")]
public async Task SaveTemplateShare(List<BookingPrintTemplateShareDto> dto)
{
if (dto==null|| dto.Count==0) {
throw Oops.Oh("请上传正确数据");
}
foreach (var item in dto)
{
var entity = item.Adapt<BookingPrintTemplateShare>();
if (entity.Id == 0)
{
await _repPrintTemplateShare.InsertAsync(entity);
}
else {
await _repPrintTemplateShare.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
}
}
/// <summary>
/// 删除分享
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
[HttpPost("/BookingTemplate/DeleteTemplateShare")]
public async Task DeleteTemplateShare(string Ids)
{
var arr = Ids.Split(",");
if (arr.Count() > 0)
{
foreach (var ar in arr)
{
long Id = Convert.ToInt64(ar);
var entity = await _repPrintTemplateShare.FirstOrDefaultAsync(u => u.Id == Id);
await _repPrintTemplateShare.DeleteAsync(entity);
}
}
}
/// <summary>
/// 获取分享列表
/// </summary>
/// <returns></returns>
public async Task<dynamic> GetTemplateShare() {
return null;
}
}
}

@ -106,4 +106,36 @@ namespace Myshipping.Application
}
public class BookingPrintTemplateShareDto {
/// <summary>
/// 业务id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板id
/// </summary>
public long TemplateId { get; set; }
/// <summary>
/// 分享用户Id
/// </summary>
public long ShareToId { get; set; }
/// <summary>
/// 分享用户
/// </summary>
public string ShareToName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}

@ -266,7 +266,7 @@ namespace Myshipping.Application
public async Task SyncCustomer(List<DjyCustomerSyncDto> model)
{
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var mlist = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var mlist = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var shiplist = await _codeForwarder.AsQueryable().ToListAsync();
foreach (var item in model)
{
@ -421,18 +421,21 @@ namespace Myshipping.Application
public async Task<dynamic> SyncVesselDateList(List<DjyVesselInfoDto> model)
{
var mapcarrier = _mapcarrier.Where(x => x.Module == "HeChuan").ToList();
var mapcarrier = _mapcarrier.Where(x => x.Module == "HeChuan").ToList();
var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList();
var mlist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList();
var orderlist= _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList();
var mlist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList();
var orderlist = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList();
foreach (var item in model)
{
var CreatedUserId= userlist.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault();
if (string.IsNullOrWhiteSpace(item.BSNO))
{
throw Oops.Bah("BSNO未录入");
}
var m = mlist.Where(x => x.BSNO == item.BSNO).FirstOrDefault();
var entity = item.Adapt<DjyVesselInfo>();
entity.Vessel = item.Vessel.ToUpper().Trim();
@ -456,7 +459,7 @@ namespace Myshipping.Application
if (!string.IsNullOrEmpty(item.CreatedUserName))
{
entity.CreatedUserId = userlist.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault();
entity.CreatedUserId = CreatedUserId;
}
if (string.IsNullOrEmpty(item.Voyno))
{
@ -470,13 +473,28 @@ namespace Myshipping.Application
else
{
entity.Id = m.Id;
if (m.ETD!=null) {
entity.ETD = m.ETD;
}
if (m.ETD != null)
{
entity.ETD = m.ETD;
}
if (m.ATD != null)
{
entity.ATD = m.ATD;
}
if (m.YgtETD != null)
{
entity.YgtETD = m.YgtETD;
}
await _vesselinfo.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
////根据船公司船名航次更新船期信息
if (!string.IsNullOrEmpty(item.CARRIER) && !string.IsNullOrEmpty(item.Vessel) && (!string.IsNullOrEmpty(item.Voyno) || !string.IsNullOrWhiteSpace(item.VoynoInside)))
{
var order = orderlist.Where(x => x.CARRIERID == item.CARRIERID && x.VESSEL == item.Vessel)
var order = orderlist.Where(x => x.CARRIERID == item.CARRIERID && x.VESSEL == item.Vessel)
.WhereIF(!string.IsNullOrEmpty(item.Voyno), x => x.VOYNO == item.Voyno)
.WhereIF(!string.IsNullOrEmpty(item.VoynoInside), x => x.VOYNOINNER == item.VoynoInside).ToList();
@ -484,15 +502,15 @@ namespace Myshipping.Application
foreach (var it in order)
{
//更新订舱船期
if (it.ETD != item.ETD)
if (it.ETD != item.ETD && item.ETD!=null)
{
it.ETD = item.ETD;
}
if (it.ATD != item.ATD)
if (it.ATD != item.ATD&&item.ATD != null)
{
it.ATD = item.ATD;
}
if (it.YgtETD != item.YgtETD)
if (it.YgtETD != item.YgtETD&&item.YgtETD != null)
{
it.YgtETD = item.YgtETD;
}
@ -526,9 +544,9 @@ namespace Myshipping.Application
BookingId = it.Id,
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
CreatedTime = DateTime.Now,
CreatedUserId = UserManager.UserId,
CreatedUserName = UserManager.Name
});
CreatedUserId = CreatedUserId,
CreatedUserName = item.CreatedUserName
});
if (it.ETD != item.ETD)
{
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
@ -584,7 +602,7 @@ namespace Myshipping.Application
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var djycustomer = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var goodsconfig = await _goodsStatusConfig.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false&& x.TenantId == UserManager.TENANT_ID).ToListAsync();
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var linelist = await _repline.AsQueryable().Filter(null, true).Where(m => m.TenantId == UserManager.TENANT_ID).ToListAsync();
foreach (var model in list)
@ -598,12 +616,12 @@ namespace Myshipping.Application
throw Oops.Bah("未录入创建人");
}
var user = userlist.Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).FirstOrDefault();
var user = userlist.Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).FirstOrDefault();
if (user == null)
{
throw Oops.Bah($"未匹配到创建人{model.CreatedUserName.Trim()}请联系管理员添加相关用户");
}
var order = orderlist.Where(x => x.BSNO == model.BSNO ).FirstOrDefault();
var order = orderlist.Where(x => x.BSNO == model.BSNO).FirstOrDefault();
if (order == null)
@ -687,7 +705,7 @@ namespace Myshipping.Application
}
if (!string.IsNullOrEmpty(entity.LineName))
{
var line = linelist.Where(m => m.LineName.Contains(entity.LineName)).FirstOrDefault();
var line = linelist.Where(m => m.LineName.Contains(entity.LineName)).FirstOrDefault();
if (line == null)
{
await _repline.InsertAsync(new DjyTenantLine
@ -1674,12 +1692,12 @@ namespace Myshipping.Application
public async Task SaveSyncVesselDate(List<DjyVesselDto> dto)
{
var infolist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList();
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
foreach (var item in dto)
{
var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).FirstOrDefault();
if (model != null)
if (model != null)
{
model.ETA = item.ETA;
model.YgtETD = item.ETD;
@ -1825,7 +1843,7 @@ namespace Myshipping.Application
[SqlSugarUnitOfWork]
public async Task SaveSyncGHVesselDate(List<DjyVesselGHDto> dto)
{
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
foreach (var item in dto)
{
@ -2187,14 +2205,17 @@ namespace Myshipping.Application
var usrList = _repUser.AsQueryable().Filter(null, true).Where(u => u.TenantId == tenantId && !u.IsDeleted).ToList();
Dictionary<string, List<string>> dic = new Dictionary<string, List<string>>();
//遍历船名航次,查询订舱数据
//遍历船名航次,查询船期维护人
foreach (var item in dto)
{
var boUserList = _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && (x.ParentId == 0 || x.ParentId == null) && !x.IsDeleted && x.TenantId == tenantId)
.Select(x => x.CreatedUserId).ToList();
if (boUserList.Count > 0)
var veUserList = _vesselinfo.AsQueryable().Filter(null, true)
.Where(v => v.TenantId == tenantId && v.Vessel == item.Vessel && v.Voyno == item.Voyno && !v.IsDeleted)
.Select(x => x.CreatedUserId)
.ToList();
if (veUserList.Count > 0)
{
var phoneList = usrList.Where(u => boUserList.Contains(u.Id) && u.Phone != "" && u.Phone != null).Select(x => x.Phone).ToList();
var phoneList = usrList.Where(u => veUserList.Contains(u.Id) && u.Phone != "" && u.Phone != null).Select(x => x.Phone).ToList();
foreach (var phone in phoneList)
{

Loading…
Cancel
Save