diff --git a/ds-wms-service/DS.Module.DjyServiceStatus/ServiceProjectRes.cs b/ds-wms-service/DS.Module.DjyServiceStatus/ServiceProjectRes.cs new file mode 100644 index 00000000..15c984be --- /dev/null +++ b/ds-wms-service/DS.Module.DjyServiceStatus/ServiceProjectRes.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static System.Net.Mime.MediaTypeNames; + +namespace DS.Module.DjyServiceStatus +{ + /// + /// 服务项目返回 + /// + public class ServiceProjectRes + { + /// + /// + /// + public string ProjectPKId { get; set; } + /// + /// + /// + public string ProjectCode { get; set; } + /// + /// 订舱 + /// + public string ProjectName { get; set; } + /// + /// + /// + public int SortNo { get; set; } + /// + /// + /// + public bool IsYield { get; set; } + /// + /// + /// + public DateTime ActDate { get; set; } + /// + /// + /// + public int StatusNum { get; set; } + } + + public class ServiceProjectRoot + { + /// + /// + /// + public bool Succ { get; set; } + /// + /// + /// + public int Status { get; set; } + /// + /// + /// + public List Ext { get; set; } + /// + /// + /// + public bool IsTimeout { get; set; } + /// + /// + /// + public DateTime ExecuteTime { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs index 28b5ec1c..d86e34c3 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs @@ -1565,4 +1565,9 @@ public class SeaExportRes /// 提单确认人邮箱 /// public string BLConfirmationEmail { get; set; } + + /// + /// 服务项目 + /// + public string? ServiceItem { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportCommonService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportCommonService.cs index 4b48ff2f..362a1bc5 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportCommonService.cs @@ -158,5 +158,13 @@ namespace DS.WMS.Core.Op.Interface /// 模块代码 /// string GetDischargePortEDICode(long Id, string module = ""); + + /// + /// 手动更新海运出口服务项目 + /// + /// + /// + /// 类型 true 勾选保存 false 勾选取消 + public void UpdateSeaExportServiceItem(long id, string code, bool type = true); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportService.cs index 8ba1596a..ca7824ad 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportService.cs @@ -280,4 +280,10 @@ public interface ISeaExportService /// /// public Task CreateOrderAuditTaskAsync(IdModel req); + + /// + /// 更新服务项目 + /// + /// + public Task UpdateSeaExportServiceItem(); } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs index c47e447c..23f12702 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs @@ -40,6 +40,7 @@ using LanguageExt.Pretty; using Amazon.Runtime.Internal.Transform; using System.Collections.Generic; using NPOI.XSSF.Streaming.Values; +using AngleSharp.Text; namespace DS.WMS.Core.Op.Method { @@ -139,7 +140,63 @@ namespace DS.WMS.Core.Op.Method } + /// + /// 手动更新海运出口服务项目 + /// + /// + /// + /// 类型 true 勾选保存 false 勾选取消 + public async void UpdateSeaExportServiceItem(long id, string code, bool type = true) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var order = tenantDb.Queryable().Filter(null, true).First(x => x.Id == id); + var oldOrder = order.Adapt(); + var items = order.ServiceItem.Split(',').ToList(); + var codeStr = String.Empty; + var isUpdate = false; + if (type) + { + if (!items.Contains(code)) + { + items.Add(code); + codeStr = String.Join(",", items.ToArray()); + isUpdate = true; + } + else + { + isUpdate = false; + } + } + else + { + if (items.Contains(code)) + { + items.RemoveAll(x => x == code); + codeStr = String.Join(",", items.ToArray()); + isUpdate = true; + } + else + { + isUpdate = false; + } + } + if (isUpdate && !codeStr.Equals(order.ServiceItem)) + { + order.ServiceItem = codeStr; + await tenantDb.Updateable(order).UpdateColumns(x => new { x.ServiceItem }) + .EnableDiffLogEvent().ExecuteCommandAsync(); + // 记录日志 + await SaveSeaExportLogAsync(new SeaExportSaveLog() + { + OperateType = "Update", + OldOrder = oldOrder, + NewOrder = order, + SourceCode = "UpdateSeaExportServiceItem", + SourceName = "手动更新海运出口服务项目", + }, tenantDb); + } + } #region 海运出口差异日志 /// /// 忽略的字段 diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index 95052b6c..bbea8402 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -102,6 +102,7 @@ public partial class SeaExportService : ISeaExportService //_bookingSlotService = _serviceProvider.GetRequiredService(); _seaTaskService = _serviceProvider.GetRequiredService(); + _taskManageBaseService = _serviceProvider.GetRequiredService>(); } @@ -1652,4 +1653,38 @@ public partial class SeaExportService : ISeaExportService return DataResult.Success; } } + + + /// + /// 更新服务项目 + /// + /// + public async Task UpdateSeaExportServiceItem() + { + + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var list = await tenantDb.Queryable().Where(x => x.ServiceItem == null || x.ServiceItem == "").ToListAsync();//.Where(x => x.IsRefund == false && x.IsChangeETD == false) + + foreach (var item in list) + { + var res = await _djyServiceStatusService.GetServiceProjectList(new EmbedQueryServiceProjectWithStatus() + { + BusinessId = item.Id.ToString(), + QueryType = 0, + }); + + var data = JsonConvert.DeserializeObject(res.data.ToString()); + var res1 = data.Ext; + if (res1 != null && res1.Count>0) { + + var codes = res1.Where(x=>x.IsYield == true).Select(x=> x.ProjectCode.ToLower()).ToList(); + var codeStr = String.Join(",", codes); + item.ServiceItem = codeStr; + await tenantDb.Updateable(item).UpdateColumns(x=>new { x.ServiceItem}).ExecuteCommandAsync(); + } + Console.WriteLine(res.data); + } + + return DataResult.Success; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs index 3b825188..392794c9 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs @@ -50,6 +50,8 @@ namespace DS.WMS.OpApi.Controllers [Route("SaveServiceProject")] public async Task SaveServiceProject([FromBody] EmbedServiceProjectDto req) { + //手动更新海运出口服务项目 + _seaComService.UpdateSeaExportServiceItem(long.Parse(req.BusinessId), req.ProjectCodes[0], true); return await _invokeService.SaveServiceProject(req); } @@ -62,6 +64,8 @@ namespace DS.WMS.OpApi.Controllers [Route("CancelServiceProject")] public async Task CancelServiceProject([FromBody] EmbedServiceProjectDto req) { + //手动更新海运出口服务项目 + _seaComService.UpdateSeaExportServiceItem(long.Parse(req.BusinessId), req.ProjectCodes[0], false); return await _invokeService.CancelServiceProject(req); } diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportController.cs index 41cdcb8c..18266968 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportController.cs @@ -593,5 +593,15 @@ public class SeaExportController : ApiController var res = await _invokeService.CreateOrderAuditTaskAsync(req); return res; } - + /// + /// 更新服务项目 + /// + /// + [HttpGet] + [Route("UpdateSeaExportServiceItem")] + public async Task UpdateSeaExportServiceItem() + { + var res = await _invokeService.UpdateSeaExportServiceItem(); + return res; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Test/Startup.cs b/ds-wms-service/DS.WMS.Test/Startup.cs index 3905d24f..437f5f7a 100644 --- a/ds-wms-service/DS.WMS.Test/Startup.cs +++ b/ds-wms-service/DS.WMS.Test/Startup.cs @@ -56,7 +56,8 @@ public class Startup services.AddSqlSugarInstall(); services.AddSaasDbInstall(); services.AddPrintModuleInstall(); - + services.AddDjyModuleInstall(); //djy服务 + } ///