海运出口再次提交审核,更新货物状态及主单状态

dev
cjy 3 weeks ago
parent 222d16b786
commit 2019a6c444

@ -507,6 +507,8 @@ public static class MultiLanguageConst
[Description("订舱货物状态已存在")]
public const string BookingGoodsStatusConfigExist = "Booking_Goods_Status_Config_Exist";
[Description("海运出口服务项目不能为空")]
public const string SeaExportServiceItemNotExist = "Sea_Export_ServiceItem_Not_Exist";
[Description("舱单分票件数合计超出限制")]
public const string SeaExportPartCtnPKGSLimit = "Sea_Export_PartCtn_PKGS_Limit";

@ -20,9 +20,15 @@ using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using DS.WMS.Core.TaskInteraction.Dtos;
using DS.WMS.Core.TaskInteraction.Entity;
using DS.WMS.Core.TaskInteraction.Interface;
using DS.WMS.Core.TaskInteraction.Method;
using DS.WMS.Core.TaskPlat.Entity;
using DS.WMS.Core.TaskPlat.Interface;
using LanguageExt;
using Mapster;
using Masuit.Tools.Systems;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
@ -52,6 +58,8 @@ public partial class SeaExportService : ISeaExportService
private readonly IRedisService _redisBaseService;
private readonly IDJYChargeFeeService _dJYChargeFeeService;
private readonly ISeaExportTaskService _seaTaskService;
//private readonly IBookingSlotService _bookingSlotService;
private readonly Lazy<ITaskManageBaseService> _taskManageBaseService;
@ -92,7 +100,7 @@ public partial class SeaExportService : ISeaExportService
_redisBaseService = _serviceProvider.GetRequiredService<IRedisService>();
_dJYChargeFeeService = _serviceProvider.GetRequiredService<IDJYChargeFeeService>();
//_bookingSlotService = _serviceProvider.GetRequiredService<IBookingSlotService>();
_seaTaskService = _serviceProvider.GetRequiredService<ISeaExportTaskService>();
_taskManageBaseService = _serviceProvider.GetRequiredService<Lazy<ITaskManageBaseService>>();
}
@ -1597,4 +1605,46 @@ public partial class SeaExportService : ISeaExportService
return DataResult<SeaExportOrderExtension>.Success(model);
}
#endregion
///// <summary>
/////
///// </summary>
///// <param name="req"></param>
///// <returns></returns>
//public async Task<DataResult> CreateOrderAuditTaskAsync(IdModel req)
//{
// var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
// var id = long.Parse(req.Id);
// var info = await tenantDb.Queryable<SeaExport>().Where(x => x.Id == id).FirstAsync();
// if (info.IsNull())
// return await Task.FromResult(DataResult.Failed("不存在的海运出口信息!", MultiLanguageConst.SeaExportExist));
// if (string.IsNullOrEmpty(info.ServiceItem))
// return await Task.FromResult(DataResult.Failed("海运出口服务项目不能为空!", MultiLanguageConst.SeaExportServiceItemNotExist));
// var items = info.ServiceItem.Split(',');
// if (items.Contains("dingcang"))
// {
// var taskReq = new TaskCreationRequest()
// {
// BusinessId = id,
// BusinessType = BusinessType.OceanShippingExport,
// TaskTypeName = TaskBaseTypeEnum.WAIT_ORDER_AUDIT.ToString(),
// };
// var result = await _seaTaskService.CreateTaskAsync(taskReq, false);
// if (!result.Succeeded)
// return await Task.FromResult(DataResult.Failed(result.Message));
// return
// }
// else
// {
// return await Task.FromResult(DataResult.Failed("不存在的海运出口信息!"));
// }
//}
}

@ -3,15 +3,23 @@ using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.DjyServiceStatus;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Op.Method;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.TaskInteraction.Dtos;
using DS.WMS.Core.TaskInteraction.Entity;
using DS.WMS.Core.TaskInteraction.Interface;
using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Entity;
using LanguageExt;
using Mapster;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
using SqlSugar;
namespace DS.WMS.Core.TaskInteraction.Method
@ -23,7 +31,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
{
const TaskBaseTypeEnum BL_CONFIRM_TASK = TaskBaseTypeEnum.WAIT_BILL_CONFIRM;
readonly Lazy<IDjyServiceStatusService> djyService;
readonly Lazy<ISeaExportCommonService> seaComService;
/// <summary>
/// 初始化
/// </summary>
@ -31,9 +39,10 @@ namespace DS.WMS.Core.TaskInteraction.Method
public SeaExportTaskService(IServiceProvider provider) : base(provider)
{
djyService = new Lazy<IDjyServiceStatusService>(provider.GetRequiredService<IDjyServiceStatusService>());
seaComService = new Lazy<ISeaExportCommonService>(provider.GetRequiredService<ISeaExportCommonService>());
}
public override Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true)
public override async Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true)
{
if (request.TaskType == TaskBaseTypeEnum.WAIT_BILL_CONFIRM)
{
@ -47,8 +56,92 @@ namespace DS.WMS.Core.TaskInteraction.Method
});
}
}
try
{
#region
//第二次提交判断
var check = await GetTasks(request.BusinessId, request.BusinessType, false, request.TaskType);
await TenantDb.Ado.BeginTranAsync();
if (check.Count>0)
{
//货物状态
var goodsStatus = TenantDb.Queryable<BookingGoodsStatus>().First(x => x.StatusCode == "TIJIAO" && x.BusinessId == request.BusinessId);
if (goodsStatus == null)
{
var gsCfg = TenantDb.Queryable<BookingGoodsStatusConfig>().First(x => x.SystemCode == "TIJIAO");
if (gsCfg != null)
{
var gs = new BookingGoodsStatus()
{
BusinessId = request.BusinessId,
ConfigId = gsCfg.Id,
FinishTime = DateTime.Now,
FinishUserName = User.UserId.IsNull() ? "超级管理员" : User.UserName,
FinishBy = User.UserId.IsNull() ? 0 : long.Parse(User.UserId),
StatusCode = gsCfg.SystemCode,
StatusName = gsCfg.StatusName,
};
await TenantDb.Insertable(gs).ExecuteCommandAsync();
}
}
//主单状态变更
var order = TenantDb.Queryable<SeaExport>().Filter(null, true).First(x => x.Id == request.BusinessId);
var oldOrder = order.Adapt<SeaExport>();
order.BusinessStatusName = "已提交";
order.BusinessStatus = "TIJIAO";
await TenantDb.Updateable(order).UpdateColumns(x => new
{
x.BusinessStatusName,
x.BusinessStatus
}).EnableDiffLogEvent().ExecuteCommandAsync();
// 记录日志
await seaComService.Value.SaveSeaExportLogAsync(new SeaExportSaveLog()
{
OperateType = "Update",
OldOrder = oldOrder,
NewOrder = order,
SourceCode = "CreateTaskAsync",
SourceName = "审单再次提交更新",
}, TenantDb);
}
#endregion
var res1 = await base.CreateTaskAsync(request, true);
if (res1.Succeeded)
{
await TenantDb.Ado.CommitTranAsync();
if (check.Count > 0) {
//更新大简云货物状态
var pushModel = new EmbedServiceProjectStatusDto
{
businessId = request.BusinessId.ToString(),
SourceType = 1,
StatusCodes = new List<EmbedServiceProjectStatusDetailDto> {
new EmbedServiceProjectStatusDetailDto{
StatusCode = "TIJIAO"
}
}
};
await djyStatusService.Value.SaveServiceStatus(pushModel);
}
return base.CreateTaskAsync(request, useTransaction);
return res1;
}
else
{
await TenantDb.Ado.RollbackTranAsync();
return res1;
}
}
catch (Exception)
{
await TenantDb.Ado.RollbackTranAsync();
throw;
}
}
/// <summary>

Loading…
Cancel
Save