jianghaiqing 1 year ago
commit 43090ef0bf

@ -1,32 +0,0 @@
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; }
}
}

@ -492,9 +492,9 @@ 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.IsZZFX = itgoods.Where(x => x.StatusName == "装载放行").FirstOrDefault() == null ? null : itgoods.Where(x => x.StatusName == "装载放行").Select(x => x.FinishTime).FirstOrDefault();
item.IsVGM=itgoods.Where(x => x.SystemCode == "YFVGM").FirstOrDefault()==null?null: itgoods.Where(x => x.SystemCode == "YFVGM").Select(x=>x.FinishTime).FirstOrDefault();
item.IsCanDan = itgoods.Where(x => x.SystemCode == "YFCD").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFCD").Select(x => x.FinishTime).FirstOrDefault();
item.IsZZFX = itgoods.Where(x => x.SystemCode == "ZZFX").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "ZZFX").Select(x => x.FinishTime).FirstOrDefault();
item.GoodsStatusList = itgoods.Union<GoodsStatusList>(itconfig).OrderBy(x => x.Sort).ToList();
////获取提箱返场状态
//var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList();
@ -506,7 +506,7 @@ namespace Myshipping.Application
//}
var statusids = statusloglist.Where(x => x.BookingId == item.Id).Select(x => x.Id).ToList();
var dto = statuslogdetaillist.Where(x => statusids.Contains(x.PId)).ToList();
List<CNTRNODto> CNTRNODtolist =new List<CNTRNODto>();
List<CNTRNODto> CNTRNODtolist = new List<CNTRNODto>();
foreach (var d in dto)
{
var ctn = CNTRNODtolist.Where(x => x.CNTRNO == d.CNTRNO).FirstOrDefault();
@ -871,9 +871,9 @@ 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.IsZZFX = itgoods.Where(x => x.StatusName == "装载放行").FirstOrDefault() == null ? null : itgoods.Where(x => x.StatusName == "装载放行").Select(x => x.FinishTime).FirstOrDefault();
item.IsVGM = itgoods.Where(x => x.SystemCode == "YFVGM").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFVGM").Select(x => x.FinishTime).FirstOrDefault();
item.IsCanDan = itgoods.Where(x => x.SystemCode == "YFCD").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFCD").Select(x => x.FinishTime).FirstOrDefault();
item.IsZZFX = itgoods.Where(x => x.SystemCode == "ZZFX").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "ZZFX").Select(x => x.FinishTime).FirstOrDefault();
item.GoodsStatusList = itgoods.Union<GoodsStatusList>(itconfig).OrderBy(x => x.Sort).ToList();
//获取提箱返场状态
//var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList();
@ -2854,6 +2854,9 @@ namespace Myshipping.Application
throw Oops.Bah($"邮件发送失败:{sendResult.Value}");
}
#endregion
//设置货物状态-放舱
SetGoogsStatus("YFC", bookingId);
}
/// <summary>
@ -3605,6 +3608,9 @@ namespace Myshipping.Application
//订舱状态
await SaveBookingStatus(bookingId, "sta_xhz", "下货纸");
//设置货物状态:已发下货纸,并回传东胜
SetGoogsStatus("YFXHZ", bookingId);
}
#endregion
@ -4262,33 +4268,7 @@ namespace Myshipping.Application
}
//设置货物状态已发VGM并回传东胜
var gsCfg = _goodsStatusConfig.FirstOrDefault(x => x.SystemCode == "YFVGM" && x.CreatedUserId == UserManager.UserId);
if (gsCfg != null)
{
_logger.LogInformation($"发送VGM检查货物状态{bookingId},{order.MBLNO}");
var gs = _goodsStatus.FirstOrDefault(x => x.ConfigId == gsCfg.Id && x.bookingId == bookingId);
if (gs == null)
{
gs = new BookingGoodsStatus();
gs.bookingId = bookingId;
gs.ConfigId = gsCfg.Id;
gs.FinishUser = UserManager.Name;
gs.FinishTime = DateTime.Now;
gs.FinishUserId = UserManager.UserId;
await _goodsStatus.InsertAsync(gs);
_logger.LogInformation($"发送VGM后自动完成货物状态,Id{bookingId},提单号:{order.MBLNO},操作人:{UserManager.Name}");
//推送东胜
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) && itemcode == "true")
{
await SendBookingOrder(new long[] { bookingId });
_logger.LogInformation($"发送VGM后货物状态推送东胜完成,Id{bookingId},提单号:{order.MBLNO},操作人:{UserManager.Name}");
}
}
}
SetGoogsStatus("YFVGM", bookingId);
}
@ -8408,6 +8388,43 @@ namespace Myshipping.Application
}
return order;
}
/// <summary>
/// 设置货物状态完成,并推送东胜
/// </summary>
/// <param name="code"></param>
/// <param name="bookingId"></param>
/// <returns></returns>
public async Task SetGoogsStatus(string code, long bookingId)
{
var gsCfg = _goodsStatusConfig.FirstOrDefault(x => x.SystemCode == code && x.CreatedUserId == UserManager.UserId);
if (gsCfg != null)
{
_logger.LogInformation($"发送VGM检查货物状态{bookingId}");
var gs = _goodsStatus.FirstOrDefault(x => x.ConfigId == gsCfg.Id && x.bookingId == bookingId);
if (gs == null)
{
gs = new BookingGoodsStatus();
gs.bookingId = bookingId;
gs.ConfigId = gsCfg.Id;
gs.FinishUser = UserManager.Name;
gs.FinishTime = DateTime.Now;
gs.FinishUserId = UserManager.UserId;
await _goodsStatus.InsertAsync(gs);
_logger.LogInformation($"发送VGM后自动完成货物状态,Id{bookingId},操作人:{UserManager.Name}");
//推送东胜
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) && itemcode == "true")
{
await SendBookingOrder(new long[] { bookingId });
_logger.LogInformation($"发送VGM后货物状态推送东胜完成,Id{bookingId},操作人:{UserManager.Name}");
}
}
}
}
#endregion
#region 临时测试使用

@ -36,10 +36,10 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingOrder> _repOrder;
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrintTemplate;
private readonly SqlSugarRepository<BookingPrintTemplateShare> _repPrintTemplateShare;
private readonly SqlSugarRepository<BookingTemplateShare> _repPrintTemplateShare;
private readonly ILogger<BookingTemplate> _logger;
public BookingTemplateService(SqlSugarRepository<BookingTemplate> rep, SqlSugarRepository<BookingOrder> repOrder, SqlSugarRepository<BookingPrintTemplate> repPrintTemplate, SqlSugarRepository<BookingPrintTemplateShare> repPrintTemplateShare,ILogger<BookingTemplate> logger)
public BookingTemplateService(SqlSugarRepository<BookingTemplate> rep, SqlSugarRepository<BookingOrder> repOrder, SqlSugarRepository<BookingPrintTemplate> repPrintTemplate, SqlSugarRepository<BookingTemplateShare> repPrintTemplateShare,ILogger<BookingTemplate> logger)
{
@ -133,7 +133,7 @@ namespace Myshipping.Application
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/BookingTemplate/SaveTemplateShare")]
public async Task SaveTemplateShare(List<BookingPrintTemplateShareDto> dto)
public async Task SaveTemplateShare(List<BookingTemplateShareDto> dto)
{
if (dto==null|| dto.Count==0) {
@ -141,7 +141,7 @@ namespace Myshipping.Application
}
foreach (var item in dto)
{
var entity = item.Adapt<BookingPrintTemplateShare>();
var entity = item.Adapt<BookingTemplateShare>();
if (entity.Id == 0)
{
@ -184,12 +184,15 @@ namespace Myshipping.Application
/// 获取分享列表
/// </summary>
/// <returns></returns>
public async Task<dynamic> GetTemplateShare() {
[HttpGet("/BookingTemplate/GetTemplateShare")]
public async Task<dynamic> GetTemplateShare(string TemplateName)
{
var TemplateIds=_repPrintTemplateShare.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.ShareToId == UserManager.UserId).Select(x => x.TemplateId).ToList();
var list =await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && (TemplateIds.Contains(x.Id) || x.CreatedUserId == UserManager.UserId)).
WhereIF(!string.IsNullOrEmpty(TemplateName),x=>x.Title.Contains(TemplateName)).ToListAsync();
return null;
return list;
}
}

@ -64,7 +64,7 @@ namespace Myshipping.Application
/// <summary>
/// 订舱模板修改输入参数
/// </summary>
public class UpdateBookingTemplateInput: BookingTemplateInput
public class UpdateBookingTemplateInput : BookingTemplateInput
{
/// <summary>
/// 主键
@ -108,7 +108,8 @@ namespace Myshipping.Application
}
public class BookingPrintTemplateShareDto {
public class BookingTemplateShareDto
{
/// <summary>
@ -138,4 +139,15 @@ namespace Myshipping.Application
}
public class BookingTemplateShareQuery
{
public string TemplateName { get; set; }
public string ShareToId { get; set; }
}
}

Loading…
Cancel
Save