From 20cbe0a1a78a1dc76a118cd2de7d59a8c3a32fda Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 4 Jul 2023 08:58:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B4=BE=E8=BD=A6?= =?UTF-8?q?=E5=9B=9E=E5=86=99=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=AE=A2=E8=88=B1=E8=BD=A6=E9=98=9F=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingTruck/BookingTruckService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index 87fe7d20..ffccbb2d 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -1824,6 +1824,7 @@ namespace Myshipping.Application bookingOrder.TRUCKERID = null; bookingOrder.TRUCKER = null; + bookingOrder.VERSION = IDGen.NextID().ToString().Replace("-", ""); await _bookingOrderRepository.AsUpdateable(bookingOrder).UpdateColumns(it => new { @@ -1850,6 +1851,7 @@ namespace Myshipping.Application bookingOrder.TRUCKERID = info.TruckCode; bookingOrder.TRUCKER = info.TruckName; + bookingOrder.VERSION = IDGen.NextID().ToString().Replace("-", ""); await _bookingOrderRepository.AsUpdateable(bookingOrder).UpdateColumns(it => new { From 4ca27ad8c2d8ebdf90abefbb6f46a699778bdda6 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 4 Jul 2023 10:08:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B4=BE=E8=BD=A6?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=89=88=E6=9C=AC=E5=8F=B7=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E6=8E=A8=E9=80=81=E4=B8=9C?= =?UTF-8?q?=E8=83=9C=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackingSystem/ServiceWorkFlowBaseInfo.cs | 55 +++- .../BookingTruck/BookingTruckService.cs | 18 +- .../Dtos/ServiceWorkFlowBaseDto.cs | 21 +- .../ServiceWorkFlowBaseService.cs | 246 ++++++++++++++++++ 4 files changed, 332 insertions(+), 8 deletions(-) create mode 100644 Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowBaseInfo.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowBaseInfo.cs index de958b51..b0cec0a9 100644 --- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowBaseInfo.cs +++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowBaseInfo.cs @@ -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 + /// + /// 服务流程主表 + /// + [SugarTable("service_workflow_base")] + [Description("服务流程主表")] + public class ServiceWorkFlowBaseInfo : TrackingSystemDbEntity { + public ServiceWorkFlowBaseInfo() + { + PK_ID = IDGen.NextID().ToString(); + + CreatedTime = DateTime.Now; + + } + + /// + /// 服务流程代码 + /// + public string SERVICE_WORKFLOW_CODE { get; set; } + + /// + /// 服务流程名称 + /// + public string SERVICE_PROJECT_NAME { get; set; } + + /// + /// 服务流程说明 + /// + public string SERVICE_WORKFLOW_NOTE { get; set; } + + /// + /// 发布版本 + /// + public string RELEASE_VERSION { get; set; } + + /// + /// 是否启用 1-启用 0-未启用 + /// + public int IS_ENABLE { get; set; } = 0; + + /// + /// 所属租户ID + /// + public string BELONG_TENANT_ID { get; set; } + + /// + /// 所属租户名称 + /// + public string BELONG_TENANT_NAME { get; set; } } } diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index ffccbb2d..8ce7af3f 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -1815,12 +1815,12 @@ 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; @@ -1832,6 +1832,10 @@ namespace Myshipping.Application it.TRUCKER }).ExecuteCommandAsync(); + var syncDongshengRlt = await _bookingOrderService.SendBookingOrder(new long[] { bookingTruckInfo.BookingId.Value }); + + _logger.LogInformation($"推送订舱同步东胜完毕,id={bookingTruckInfo.BookingId.Value} rlt={JSON.Serialize(syncDongshengRlt)}"); + _logger.LogInformation("判断回写需要更新去掉订舱的车队,更新完成"); } } @@ -1843,11 +1847,11 @@ 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; @@ -1859,6 +1863,10 @@ namespace Myshipping.Application it.TRUCKER }).ExecuteCommandAsync(); + var syncDongshengRlt = await _bookingOrderService.SendBookingOrder(new long[] { bookingTruckInfo.BookingId.Value }); + + _logger.LogInformation($"推送订舱同步东胜完毕,id={bookingTruckInfo.BookingId.Value} rlt={JSON.Serialize(syncDongshengRlt)}"); + _logger.LogInformation("判断回写需要更新订舱的车队,更新完成"); } } diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowBaseDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowBaseDto.cs index 2b789bc2..0cb3be25 100644 --- a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowBaseDto.cs +++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceWorkFlowBaseDto.cs @@ -9,7 +9,26 @@ namespace Myshipping.Application /// /// 服务流程 /// - internal class ServiceWorkFlowBaseDto + public class ServiceWorkFlowBaseDto { + /// + /// 主键 + /// + public string PKId { get; set; } + + /// + /// 服务流程代码 + /// + public string ServiceWorkflowCode { get; set; } + + /// + /// 服务流程名称 + /// + public string ServiceWorkflowName { get; set; } + + /// + /// 服务流程说明 + /// + public string ServiceWorkflowNote { get; set; } } } diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs new file mode 100644 index 00000000..7c56f2da --- /dev/null +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs @@ -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 +{ + /* + /// + /// 服务流程 + /// + [ApiDescriptionSettings("Application", Name = "ServiceWorkFlowBase", Order = 10)] + public class ServiceWorkFlowBaseService : IServiceWorkFlowBaseService, IDynamicApiController, ITransient + { + private readonly SqlSugarRepository _serviceWorkFlowBaseRepository; + private readonly SqlSugarRepository _serviceWorkFlowActivitiesInfoRepository; + + private readonly ILogger _logger; + public ServiceWorkFlowBaseService(SqlSugarRepository serviceWorkFlowBaseRepository, + ILogger logger, + SqlSugarRepository serviceWorkFlowActivitiesInfoRepository) + { + _serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository; + _serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository; + } + + /// + /// 保存 + /// + /// 服务流程详情 + /// 返回回执 + [HttpPost("/ServiceWorkFlowBase/Save")] + public async Task 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 保存内部方法 + /// + /// 保存内部方法 + /// + /// 服务项目详情 + /// 是否启用 + /// 返回派车Id + [SqlSugarUnitOfWork] + private async Task InnerSave(StatusSkuBaseDto info, bool isSetEnable = false) + { + StatusSkuBaseInfo entity = info.Adapt(); + + 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 单票查询 + /// + /// 单票查询 + /// + /// 状态主键 + 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 + + /// + /// 保存并启用 + /// + /// 服务流程详情 + /// 返回回执 + public async Task SaveAndEnable(ServiceWorkFlowBaseDto info) + { + + } + + /// + /// 启用 + /// + /// 服务流程主键 + /// 返回回执 + public async Task SetEnable(string pkId) + { + + } + + /// + /// 取消启用 + /// + /// 服务流程主键 + /// 返回回执 + public async Task SetUnEnable(string pkId) + { + + } + + /// + /// 删除 + /// + /// 服务流程主键 + /// 返回回执 + public async Task Delete(string pkId) + { + + } + + /// + /// 复制 + /// + /// 服务流程主键 + /// 返回回执 + public async Task Copy(string pkId) + { + + } + + /// + /// 获取服务流程详情 + /// + /// 服务流程主键 + /// 返回回执 + public async Task GetInfo(string pkId) + { + + } + + /// + /// 检索服务流程列表 + /// + /// 检索值 + /// 最大返回行数(默认15) + /// 返回回执 + public async Task QueryList(string queryItem, int topNum = 15) + { + + } + + /// + /// 服务流程台账查询 + /// + /// 服务流程台账查询请求 + /// 返回结果 + public async Task> GetPageAsync(QueryServiceWorkFlowBaseDto QuerySearch) + { + + } + + + /// + /// 发布服务流程 + /// + /// 服务流程主键 + /// 返回回执 + public async Task PublishRelease(string pkId) + { + + } + + + /// + /// 获取展示服务流程时间轴列表 + /// + /// 服务流程主键 + /// 返回回执 + public async Task GetShowTimeLine(string pkId) + { + + } + + }*/ +} From 4ba45edcb621bee2dc50c755c7d1fd4664121bb3 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 4 Jul 2023 10:28:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B4=BE=E8=BD=A6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A2=E8=88=B1=E8=BD=A6=E9=98=9F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=B8=BA=E5=90=8C=E6=AD=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingTruck/BookingTruckService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index 8ce7af3f..755c7d77 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -1826,11 +1826,11 @@ namespace Myshipping.Application 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 }); @@ -1857,11 +1857,11 @@ namespace Myshipping.Application 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 });