wet 1 year ago
commit 2fa004a581

@ -1,12 +1,63 @@
using System;
using Furion.DistributedIDGenerator;
using Myshipping.Application.Entity.TrackingSystem;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Entity
{
internal class ServiceWorkFlowBaseInfo
/// <summary>
/// 服务流程主表
/// </summary>
[SugarTable("service_workflow_base")]
[Description("服务流程主表")]
public class ServiceWorkFlowBaseInfo : TrackingSystemDbEntity
{
public ServiceWorkFlowBaseInfo()
{
PK_ID = IDGen.NextID().ToString();
CreatedTime = DateTime.Now;
}
/// <summary>
/// 服务流程代码
/// </summary>
public string SERVICE_WORKFLOW_CODE { get; set; }
/// <summary>
/// 服务流程名称
/// </summary>
public string SERVICE_PROJECT_NAME { get; set; }
/// <summary>
/// 服务流程说明
/// </summary>
public string SERVICE_WORKFLOW_NOTE { get; set; }
/// <summary>
/// 发布版本
/// </summary>
public string RELEASE_VERSION { get; set; }
/// <summary>
/// 是否启用 1-启用 0-未启用
/// </summary>
public int IS_ENABLE { get; set; } = 0;
/// <summary>
/// 所属租户ID
/// </summary>
public string BELONG_TENANT_ID { get; set; }
/// <summary>
/// 所属租户名称
/// </summary>
public string BELONG_TENANT_NAME { get; set; }
}
}

@ -1815,21 +1815,26 @@ namespace Myshipping.Application
bookingTruckSyncDto.OperType = "Delete";
var bookingOrder = _bookingOrderRepository.AsQueryable()
.First(a => a.Id == bookingTruckInfo.BookingId);
.First(a => a.Id == bookingTruckInfo.BookingId.Value);
if (bookingOrder != null)
{
_logger.LogInformation("判断回写需要更新去掉订舱的车队 id={id} truckid={truckid} truck={truck}",
bookingTruckInfo.BookingId, bookingOrder.TRUCKERID, bookingOrder.TRUCKER);
bookingTruckInfo.BookingId.Value, bookingOrder.TRUCKERID, bookingOrder.TRUCKER);
bookingOrder.TRUCKERID = null;
bookingOrder.TRUCKER = null;
bookingOrder.VERSION = IDGen.NextID().ToString().Replace("-", "");
await _bookingOrderRepository.AsUpdateable(bookingOrder).UpdateColumns(it => new
_bookingOrderRepository.AsUpdateable(bookingOrder).UpdateColumns(it => new
{
it.TRUCKERID,
it.TRUCKER
}).ExecuteCommandAsync();
}).ExecuteCommand();
var syncDongshengRlt = await _bookingOrderService.SendBookingOrder(new long[] { bookingTruckInfo.BookingId.Value });
_logger.LogInformation($"推送订舱同步东胜完毕id={bookingTruckInfo.BookingId.Value} rlt={JSON.Serialize(syncDongshengRlt)}");
_logger.LogInformation("判断回写需要更新去掉订舱的车队,更新完成");
}
@ -1842,20 +1847,25 @@ namespace Myshipping.Application
if (!string.IsNullOrWhiteSpace(info.TruckCode))
{
var bookingOrder = _bookingOrderRepository.AsQueryable()
.First(a => a.Id == bookingTruckInfo.BookingId);
.First(a => a.Id == bookingTruckInfo.BookingId.Value);
if (bookingOrder != null && string.IsNullOrWhiteSpace(bookingOrder.TRUCKERID))
if (bookingOrder != null)
{
_logger.LogInformation("判断回写需要更新订舱的车队 id={id} truck={truck}", bookingTruckInfo.BookingId, info.TruckName);
_logger.LogInformation("判断回写需要更新订舱的车队 id={id} truck={truck}", bookingTruckInfo.BookingId.Value, info.TruckName);
bookingOrder.TRUCKERID = info.TruckCode;
bookingOrder.TRUCKER = info.TruckName;
bookingOrder.VERSION = IDGen.NextID().ToString().Replace("-", "");
await _bookingOrderRepository.AsUpdateable(bookingOrder).UpdateColumns(it => new
_bookingOrderRepository.AsUpdateable(bookingOrder).UpdateColumns(it => new
{
it.TRUCKERID,
it.TRUCKER
}).ExecuteCommandAsync();
}).ExecuteCommand();
var syncDongshengRlt = await _bookingOrderService.SendBookingOrder(new long[] { bookingTruckInfo.BookingId.Value });
_logger.LogInformation($"推送订舱同步东胜完毕id={bookingTruckInfo.BookingId.Value} rlt={JSON.Serialize(syncDongshengRlt)}");
_logger.LogInformation("判断回写需要更新订舱的车队,更新完成");
}

@ -9,7 +9,26 @@ namespace Myshipping.Application
/// <summary>
/// 服务流程
/// </summary>
internal class ServiceWorkFlowBaseDto
public class ServiceWorkFlowBaseDto
{
/// <summary>
/// 主键
/// </summary>
public string PKId { get; set; }
/// <summary>
/// 服务流程代码
/// </summary>
public string ServiceWorkflowCode { get; set; }
/// <summary>
/// 服务流程名称
/// </summary>
public string ServiceWorkflowName { get; set; }
/// <summary>
/// 服务流程说明
/// </summary>
public string ServiceWorkflowNote { get; set; }
}
}

@ -0,0 +1,246 @@
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/*
/// <summary>
/// 服务流程
/// </summary>
[ApiDescriptionSettings("Application", Name = "ServiceWorkFlowBase", Order = 10)]
public class ServiceWorkFlowBaseService : IServiceWorkFlowBaseService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<ServiceWorkFlowBaseInfo> _serviceWorkFlowBaseRepository;
private readonly SqlSugarRepository<ServiceWorkFlowActivitiesInfo> _serviceWorkFlowActivitiesInfoRepository;
private readonly ILogger<ServiceWorkFlowBaseService> _logger;
public ServiceWorkFlowBaseService(SqlSugarRepository<ServiceWorkFlowBaseInfo> serviceWorkFlowBaseRepository,
ILogger<StatusSkuBaseService> logger,
SqlSugarRepository<ServiceWorkFlowActivitiesInfo> serviceWorkFlowActivitiesInfoRepository)
{
_serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository;
_serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository;
}
/// <summary>
/// 保存
/// </summary>
/// <param name="info">服务流程详情</param>
/// <returns>返回回执</returns>
[HttpPost("/ServiceWorkFlowBase/Save")]
public async Task<TaskManageOrderResultDto> Save([FromBody] ServiceWorkFlowBaseDto info)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var id = await InnerSave(info);
result.succ = true;
result.msg = "保存成功";
result.ext = id;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"保存服务项目异常,原因:{ex.Message}";
}
return result;
}
#region 保存内部方法
/// <summary>
/// 保存内部方法
/// </summary>
/// <param name="info">服务项目详情</param>
/// <param name="isSetEnable">是否启用</param>
/// <returns>返回派车Id</returns>
[SqlSugarUnitOfWork]
private async Task<string> InnerSave(StatusSkuBaseDto info, bool isSetEnable = false)
{
StatusSkuBaseInfo entity = info.Adapt<StatusSkuBaseInfo>();
if (isSetEnable)
{
entity.IS_ENABLE = 1;
}
if (entity == null)
throw Oops.Oh($"服务项目不能为空", typeof(InvalidOperationException));
_logger.LogInformation($"服务项目保存 JSON={JSON.Serialize(entity)} user={UserManager.UserId}");
if (string.IsNullOrWhiteSpace(entity.PK_ID))
{
_statusSkuBaseInfoRepository.Insert(entity);
}
else
{
var model = InnerGetInfo(entity.PK_ID);
_logger.LogInformation($"更新状态前,获取原始记录 JSON={JSON.Serialize(model)}");
if (!entity.STATUS_SKU_CODE.Equals(model.STATUS_SKU_CODE, StringComparison.OrdinalIgnoreCase))
{
ValidateServiceProject(entity, true);
}
entity.UpdatedTime = DateTime.Now;
entity.UpdatedUserId = UserManager.UserId;
entity.UpdatedUserName = UserManager.Name;
await _statusSkuBaseInfoRepository.AsUpdateable(entity).IgnoreColumns(it => new
{
it.TenantId,
it.TenantName,
it.CreatedTime,
it.CreatedUserId,
it.CreatedUserName,
it.IsDeleted,
}).ExecuteCommandAsync();
}
return entity.PK_ID;
}
#endregion
#region 单票查询
/// <summary>
/// 单票查询
/// </summary>
/// <param name="pkId">状态主键</param>
private StatusSkuBaseInfo InnerGetInfo(string pkId)
{
if (string.IsNullOrWhiteSpace(pkId))
{
throw Oops.Oh($"状态主键不能为空", typeof(InvalidOperationException));
}
var model = _statusSkuBaseInfoRepository.AsQueryable().First(a => a.PK_ID == pkId);
if (model == null)
throw Oops.Oh($"状态获取失败,状态信息不存在或已作废", typeof(InvalidOperationException));
return model;
}
#endregion
/// <summary>
/// 保存并启用
/// </summary>
/// <param name="info">服务流程详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SaveAndEnable(ServiceWorkFlowBaseDto info)
{
}
/// <summary>
/// 启用
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SetEnable(string pkId)
{
}
/// <summary>
/// 取消启用
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SetUnEnable(string pkId)
{
}
/// <summary>
/// 删除
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> Delete(string pkId)
{
}
/// <summary>
/// 复制
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> Copy(string pkId)
{
}
/// <summary>
/// 获取服务流程详情
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetInfo(string pkId)
{
}
/// <summary>
/// 检索服务流程列表
/// </summary>
/// <param name="queryItem">检索值</param>
/// <param name="topNum">最大返回行数默认15</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> QueryList(string queryItem, int topNum = 15)
{
}
/// <summary>
/// 服务流程台账查询
/// </summary>
/// <param name="QuerySearch">服务流程台账查询请求</param>
/// <returns>返回结果</returns>
public async Task<SqlSugarPagedList<ServiceWorkFlowBasePageDto>> GetPageAsync(QueryServiceWorkFlowBaseDto QuerySearch)
{
}
/// <summary>
/// 发布服务流程
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> PublishRelease(string pkId)
{
}
/// <summary>
/// 获取展示服务流程时间轴列表
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetShowTimeLine(string pkId)
{
}
}*/
}
Loading…
Cancel
Save