|
|
|
@ -130,8 +130,12 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<BookingLineOpMgrConfig> _repLineOpMgrConfig;
|
|
|
|
|
private readonly SqlSugarRepository<SysEmp> _repSysEmp;
|
|
|
|
|
private readonly SqlSugarRepository<Booking_AutoYardImport> _repAutoYard;
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingExtendState> _repextendstate;
|
|
|
|
|
|
|
|
|
|
private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
|
|
|
|
|
const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_RT";
|
|
|
|
|
private const string PrintRecentListTypeKey = "booking_print_recent_list";
|
|
|
|
@ -152,7 +156,8 @@ namespace Myshipping.Application
|
|
|
|
|
SqlSugarRepository<BookingExcelTemplate> excelrep, SqlSugarRepository<DjyUserMailAccount> repUserMail, SqlSugarRepository<BookingGoodsStatus> goodsStatus, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig,
|
|
|
|
|
SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<BookingStatus> repBookingStatus, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingServiceItem> serviceItem,
|
|
|
|
|
SqlSugarRepository<ParaContractNoInfo> paraContractNoInfoRepository, IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig, SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository,
|
|
|
|
|
ISysOrgService orgService, SqlSugarRepository<BookingLineOpMgrConfig> repLineOpMgrConfig, SqlSugarRepository<SysEmp> repSysEmp, SqlSugarRepository<Booking_AutoYardImport> repAutoYard)
|
|
|
|
|
ISysOrgService orgService, SqlSugarRepository<BookingLineOpMgrConfig> repLineOpMgrConfig, SqlSugarRepository<SysEmp> repSysEmp, SqlSugarRepository<Booking_AutoYardImport> repAutoYard,
|
|
|
|
|
IServiceWorkFlowManageService serviceWorkFlowManageService)
|
|
|
|
|
{
|
|
|
|
|
this._logger = logger;
|
|
|
|
|
this._rep = rep;
|
|
|
|
@ -192,13 +197,12 @@ namespace Myshipping.Application
|
|
|
|
|
this._repPrintTemplateShare = repPrintTemplateShare;
|
|
|
|
|
_httpContextAccessor = httpContextAccessor;
|
|
|
|
|
_GoodsConfig = GoodsConfig;
|
|
|
|
|
|
|
|
|
|
_djyWebsiteAccountConfigRepository = djyWebsiteAccountConfigRepository;
|
|
|
|
|
|
|
|
|
|
this._repLineOpMgrConfig = repLineOpMgrConfig;
|
|
|
|
|
this._repSysEmp = repSysEmp;
|
|
|
|
|
this._repAutoYard = repAutoYard;
|
|
|
|
|
this._repextendstate = repextendstate;
|
|
|
|
|
_serviceWorkFlowManageService = serviceWorkFlowManageService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 主表和箱信息
|
|
|
|
@ -981,23 +985,41 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(entity.CUSTNO))
|
|
|
|
|
{
|
|
|
|
|
var Config = config.Where(x => x.SystemCode == "YDC").FirstOrDefault();
|
|
|
|
|
if (Config != null)
|
|
|
|
|
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
|
|
|
|
|
{
|
|
|
|
|
_goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
|
|
|
|
|
//更新货物状态
|
|
|
|
|
await SetGoodsStatusCancel("YDC",Id);
|
|
|
|
|
|
|
|
|
|
await SetBookingOrderGoodsStatus(Id);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var Config = config.Where(x => x.SystemCode == "YDC").FirstOrDefault();
|
|
|
|
|
if (Config != null)
|
|
|
|
|
{
|
|
|
|
|
_goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
|
|
|
|
|
//更新货物状态
|
|
|
|
|
await SetBookingOrderGoodsStatus(Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(entity.MBLNO))
|
|
|
|
|
{
|
|
|
|
|
var Config = config.Where(x => x.SystemCode == "YSDBC").FirstOrDefault();
|
|
|
|
|
if (Config != null)
|
|
|
|
|
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
|
|
|
|
|
{
|
|
|
|
|
_goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
|
|
|
|
|
//更新货物状态
|
|
|
|
|
await SetGoodsStatusCancel("YSDBC", Id);
|
|
|
|
|
|
|
|
|
|
await SetBookingOrderGoodsStatus(Id);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var Config = config.Where(x => x.SystemCode == "YSDBC").FirstOrDefault();
|
|
|
|
|
if (Config != null)
|
|
|
|
|
{
|
|
|
|
|
_goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
|
|
|
|
|
//更新货物状态
|
|
|
|
|
await SetBookingOrderGoodsStatus(Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
@ -8427,6 +8449,12 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
|
|
|
|
|
|
|
|
|
|
public async Task SetGoodsStatus(string code, long bookingId)
|
|
|
|
|
{
|
|
|
|
|
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
|
|
|
|
|
{
|
|
|
|
|
await SetGoodsStatusPush(code, bookingId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var CreatedUserId = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == bookingId).Select(x => x.CreatedUserId).First();
|
|
|
|
|
if (CreatedUserId != null)
|
|
|
|
|
{
|
|
|
|
@ -8838,6 +8866,194 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
|
|
|
|
|
|
|
|
|
|
await SendBookingOrder(orderlist.ToArray());
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 推送服务状态
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 推送服务状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="code">服务状态代码</param>
|
|
|
|
|
/// <param name="bookingId">订舱ID</param>
|
|
|
|
|
/// <param name="isAutoSyncDS">是否默认同步东胜 true-自动同步 false-不自动同步</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task SetGoodsStatusPush(string code, long bookingId, bool isAutoSyncDS = false)
|
|
|
|
|
{
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1、调取推送服务状态。
|
|
|
|
|
2、获取单票的服务状态排序值最大状态。写入订舱的状态(BSSTATUSNAME)
|
|
|
|
|
3、调取同步订舱同步东胜。
|
|
|
|
|
*/
|
|
|
|
|
if (string.IsNullOrWhiteSpace(code))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 调取{name} 服务状态代码不能为空", batchNo, nameof(SetGoodsStatusPush));
|
|
|
|
|
throw Oops.Oh($"服务状态代码不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bookingId == 0)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 调取{name} 订舱ID不能为空", batchNo, nameof(SetGoodsStatusPush));
|
|
|
|
|
throw Oops.Oh($"订舱ID不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var saveStatusRlt = await _serviceWorkFlowManageService.SaveServiceStatus(new ModifyServiceProjectStatusDto
|
|
|
|
|
{
|
|
|
|
|
BookingId = bookingId,
|
|
|
|
|
SourceType = TrackingSourceTypeEnum.AUTO,
|
|
|
|
|
StatusCodes = new List<ModifyServiceProjectStatusDetailDto> {
|
|
|
|
|
new ModifyServiceProjectStatusDetailDto {
|
|
|
|
|
StatusCode = code
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 异步推送状态完成,结果={rlt}", batchNo, JSON.Serialize(saveStatusRlt));
|
|
|
|
|
|
|
|
|
|
if (saveStatusRlt.succ)
|
|
|
|
|
{
|
|
|
|
|
//拉取最新的状态数据,并取已完成的排序最大的状态写入订舱的字段 BSSTATUSNAME
|
|
|
|
|
var bookingOrder = _rep.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(a => a.Id == bookingId);
|
|
|
|
|
|
|
|
|
|
QueryServiceProjectWithStatus queryInfo = new QueryServiceProjectWithStatus
|
|
|
|
|
{
|
|
|
|
|
BookingId = bookingId,
|
|
|
|
|
QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_PROJECT,
|
|
|
|
|
TenantId = bookingOrder.TenantId.Value
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var queryRlt = await _serviceWorkFlowManageService.GetEnableStatusListByBusiness(queryInfo);
|
|
|
|
|
|
|
|
|
|
if (queryRlt.succ)
|
|
|
|
|
{
|
|
|
|
|
var statusList = JSON.Deserialize<List<ServiceProjectStatusDto>>(JSON.Serialize(queryRlt.ext));
|
|
|
|
|
|
|
|
|
|
if (statusList != null)
|
|
|
|
|
{
|
|
|
|
|
var maxStatus = statusList.Where(a => a.IsYield)
|
|
|
|
|
.OrderByDescending(a => a.CalcSortNo).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
if (maxStatus != null)
|
|
|
|
|
{
|
|
|
|
|
var model = _rep.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(a => a.Id == bookingId);
|
|
|
|
|
|
|
|
|
|
model.BSSTATUSNAME = maxStatus.ShowName;
|
|
|
|
|
model.VERSION = IDGen.NextID().ToString().Replace("-", "");
|
|
|
|
|
|
|
|
|
|
//更新订舱
|
|
|
|
|
_rep.AsUpdateable(model)
|
|
|
|
|
.UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.BSSTATUSNAME,
|
|
|
|
|
it.VERSION
|
|
|
|
|
}).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
//推送东胜
|
|
|
|
|
if (isAutoSyncDS)
|
|
|
|
|
await SendBookingOrder(new long[] { bookingId });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 取消服务状态
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 取消服务状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="code">服务状态代码</param>
|
|
|
|
|
/// <param name="bookingId">订舱编号</param>
|
|
|
|
|
/// <param name="isAutoSyncDS">是否默认同步东胜 true-自动同步 false-不自动同步</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task SetGoodsStatusCancel(string code, long bookingId, bool isAutoSyncDS = false)
|
|
|
|
|
{
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1、调取推送服务状态。
|
|
|
|
|
2、获取单票的服务状态排序值最大状态。写入订舱的状态(BSSTATUSNAME)
|
|
|
|
|
3、调取同步订舱同步东胜。
|
|
|
|
|
*/
|
|
|
|
|
if (string.IsNullOrWhiteSpace(code))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 调取{name} 服务状态代码不能为空", batchNo, nameof(SetGoodsStatusPush));
|
|
|
|
|
throw Oops.Oh($"服务状态代码不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bookingId == 0)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 调取{name} 订舱ID不能为空", batchNo, nameof(SetGoodsStatusPush));
|
|
|
|
|
throw Oops.Oh($"订舱ID不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var saveStatusRlt = await _serviceWorkFlowManageService.CancelServiceStatus(new ModifyServiceProjectStatusDto
|
|
|
|
|
{
|
|
|
|
|
BookingId = bookingId,
|
|
|
|
|
SourceType = TrackingSourceTypeEnum.AUTO,
|
|
|
|
|
StatusCodes = new List<ModifyServiceProjectStatusDetailDto> {
|
|
|
|
|
new ModifyServiceProjectStatusDetailDto {
|
|
|
|
|
StatusCode = code
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 异步取消状态完成,结果={rlt}", batchNo, JSON.Serialize(saveStatusRlt));
|
|
|
|
|
|
|
|
|
|
if (saveStatusRlt.succ)
|
|
|
|
|
{
|
|
|
|
|
//拉取最新的状态数据,并取已完成的排序最大的状态写入订舱的字段 BSSTATUSNAME
|
|
|
|
|
var bookingOrder = _rep.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(a => a.Id == bookingId);
|
|
|
|
|
|
|
|
|
|
QueryServiceProjectWithStatus queryInfo = new QueryServiceProjectWithStatus
|
|
|
|
|
{
|
|
|
|
|
BookingId = bookingId,
|
|
|
|
|
QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_PROJECT,
|
|
|
|
|
TenantId = bookingOrder.TenantId.Value
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var queryRlt = await _serviceWorkFlowManageService.GetEnableStatusListByBusiness(queryInfo);
|
|
|
|
|
|
|
|
|
|
if (queryRlt.succ)
|
|
|
|
|
{
|
|
|
|
|
var statusList = JSON.Deserialize<List<ServiceProjectStatusDto>>(JSON.Serialize(queryRlt.ext));
|
|
|
|
|
|
|
|
|
|
if (statusList != null)
|
|
|
|
|
{
|
|
|
|
|
var maxStatus = statusList.Where(a => a.IsYield)
|
|
|
|
|
.OrderByDescending(a => a.CalcSortNo).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
var model = _rep.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(a => a.Id == bookingId);
|
|
|
|
|
|
|
|
|
|
if (maxStatus != null)
|
|
|
|
|
{
|
|
|
|
|
model.BSSTATUSNAME = maxStatus.ShowName;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
model.BSSTATUSNAME = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.VERSION = IDGen.NextID().ToString().Replace("-", "");
|
|
|
|
|
|
|
|
|
|
//更新订舱
|
|
|
|
|
_rep.AsUpdateable(model)
|
|
|
|
|
.UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.BSSTATUSNAME,
|
|
|
|
|
it.VERSION
|
|
|
|
|
}).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
//推送东胜
|
|
|
|
|
await SendBookingOrder(new long[] { bookingId });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -8902,17 +9118,18 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
|
|
|
|
|
{
|
|
|
|
|
//订舱号(单号)
|
|
|
|
|
var mb = item.GetStringValue("bookingno"); //提单号
|
|
|
|
|
if (mb==order.MBLNO) {
|
|
|
|
|
|
|
|
|
|
var noApply= item.GetIntValue("noApply"); //未申请
|
|
|
|
|
var applyNoPrint = item.GetIntValue("applyNoPrint"); //已申请未打印
|
|
|
|
|
var print = item.GetIntValue("print"); //已打印
|
|
|
|
|
if (mb == order.MBLNO)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var noApply = item.GetIntValue("noApply"); //未申请
|
|
|
|
|
var applyNoPrint = item.GetIntValue("applyNoPrint"); //已申请未打印
|
|
|
|
|
var print = item.GetIntValue("print"); //已打印
|
|
|
|
|
await _repextendstate.InsertAsync(new BookingExtendState
|
|
|
|
|
{
|
|
|
|
|
bookingId=Id,
|
|
|
|
|
noApply= noApply,
|
|
|
|
|
applyNoPrint= applyNoPrint,
|
|
|
|
|
print= print
|
|
|
|
|
bookingId = Id,
|
|
|
|
|
noApply = noApply,
|
|
|
|
|
applyNoPrint = applyNoPrint,
|
|
|
|
|
print = print
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -8926,5 +9143,6 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|