jianghaiqing 3 weeks ago
commit 87da6de986

@ -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
{
/// <summary>
/// 服务项目返回
/// </summary>
public class ServiceProjectRes
{
/// <summary>
///
/// </summary>
public string ProjectPKId { get; set; }
/// <summary>
///
/// </summary>
public string ProjectCode { get; set; }
/// <summary>
/// 订舱
/// </summary>
public string ProjectName { get; set; }
/// <summary>
///
/// </summary>
public int SortNo { get; set; }
/// <summary>
///
/// </summary>
public bool IsYield { get; set; }
/// <summary>
///
/// </summary>
public DateTime ActDate { get; set; }
/// <summary>
///
/// </summary>
public int StatusNum { get; set; }
}
public class ServiceProjectRoot
{
/// <summary>
///
/// </summary>
public bool Succ { get; set; }
/// <summary>
///
/// </summary>
public int Status { get; set; }
/// <summary>
///
/// </summary>
public List<ServiceProjectRes> Ext { get; set; }
/// <summary>
///
/// </summary>
public bool IsTimeout { get; set; }
/// <summary>
///
/// </summary>
public DateTime ExecuteTime { get; set; }
}
}

@ -1565,4 +1565,9 @@ public class SeaExportRes
/// 提单确认人邮箱 /// 提单确认人邮箱
/// </summary> /// </summary>
public string BLConfirmationEmail { get; set; } public string BLConfirmationEmail { get; set; }
/// <summary>
/// 服务项目
/// </summary>
public string? ServiceItem { get; set; }
} }

@ -158,5 +158,13 @@ namespace DS.WMS.Core.Op.Interface
/// <param name="module">模块代码</param> /// <param name="module">模块代码</param>
/// <returns></returns> /// <returns></returns>
string GetDischargePortEDICode(long Id, string module = ""); string GetDischargePortEDICode(long Id, string module = "");
/// <summary>
/// 手动更新海运出口服务项目
/// </summary>
/// <param name="id"></param>
/// <param name="code"></param>
/// <param name="type">类型 true 勾选保存 false 勾选取消</param>
public void UpdateSeaExportServiceItem(long id, string code, bool type = true);
} }
} }

@ -280,4 +280,10 @@ public interface ISeaExportService
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <returns></returns>
public Task<DataResult> CreateOrderAuditTaskAsync(IdModel req); public Task<DataResult> CreateOrderAuditTaskAsync(IdModel req);
/// <summary>
/// 更新服务项目
/// </summary>
/// <returns></returns>
public Task<DataResult> UpdateSeaExportServiceItem();
} }

@ -40,6 +40,7 @@ using LanguageExt.Pretty;
using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Transform;
using System.Collections.Generic; using System.Collections.Generic;
using NPOI.XSSF.Streaming.Values; using NPOI.XSSF.Streaming.Values;
using AngleSharp.Text;
namespace DS.WMS.Core.Op.Method namespace DS.WMS.Core.Op.Method
{ {
@ -139,7 +140,63 @@ namespace DS.WMS.Core.Op.Method
} }
/// <summary>
/// 手动更新海运出口服务项目
/// </summary>
/// <param name="id"></param>
/// <param name="code"></param>
/// <param name="type">类型 true 勾选保存 false 勾选取消</param>
public async void UpdateSeaExportServiceItem(long id, string code, bool type = true)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var order = tenantDb.Queryable<SeaExport>().Filter(null, true).First(x => x.Id == id);
var oldOrder = order.Adapt<SeaExport>();
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 海运出口差异日志 #region 海运出口差异日志
/// <summary> /// <summary>
/// 忽略的字段 /// 忽略的字段

@ -102,6 +102,7 @@ public partial class SeaExportService : ISeaExportService
//_bookingSlotService = _serviceProvider.GetRequiredService<IBookingSlotService>(); //_bookingSlotService = _serviceProvider.GetRequiredService<IBookingSlotService>();
_seaTaskService = _serviceProvider.GetRequiredService<ISeaExportTaskService>(); _seaTaskService = _serviceProvider.GetRequiredService<ISeaExportTaskService>();
_taskManageBaseService = _serviceProvider.GetRequiredService<Lazy<ITaskManageBaseService>>(); _taskManageBaseService = _serviceProvider.GetRequiredService<Lazy<ITaskManageBaseService>>();
} }
@ -1652,4 +1653,38 @@ public partial class SeaExportService : ISeaExportService
return DataResult.Success; return DataResult.Success;
} }
} }
/// <summary>
/// 更新服务项目
/// </summary>
/// <returns></returns>
public async Task<DataResult> UpdateSeaExportServiceItem()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable<SeaExport>().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<ServiceProjectRoot>(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;
}
} }

@ -50,6 +50,8 @@ namespace DS.WMS.OpApi.Controllers
[Route("SaveServiceProject")] [Route("SaveServiceProject")]
public async Task<DjyResult> SaveServiceProject([FromBody] EmbedServiceProjectDto req) public async Task<DjyResult> SaveServiceProject([FromBody] EmbedServiceProjectDto req)
{ {
//手动更新海运出口服务项目
_seaComService.UpdateSeaExportServiceItem(long.Parse(req.BusinessId), req.ProjectCodes[0], true);
return await _invokeService.SaveServiceProject(req); return await _invokeService.SaveServiceProject(req);
} }
@ -62,6 +64,8 @@ namespace DS.WMS.OpApi.Controllers
[Route("CancelServiceProject")] [Route("CancelServiceProject")]
public async Task<DjyResult> CancelServiceProject([FromBody] EmbedServiceProjectDto req) public async Task<DjyResult> CancelServiceProject([FromBody] EmbedServiceProjectDto req)
{ {
//手动更新海运出口服务项目
_seaComService.UpdateSeaExportServiceItem(long.Parse(req.BusinessId), req.ProjectCodes[0], false);
return await _invokeService.CancelServiceProject(req); return await _invokeService.CancelServiceProject(req);
} }

@ -593,5 +593,15 @@ public class SeaExportController : ApiController
var res = await _invokeService.CreateOrderAuditTaskAsync(req); var res = await _invokeService.CreateOrderAuditTaskAsync(req);
return res; return res;
} }
/// <summary>
/// 更新服务项目
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("UpdateSeaExportServiceItem")]
public async Task<DataResult> UpdateSeaExportServiceItem()
{
var res = await _invokeService.UpdateSeaExportServiceItem();
return res;
}
} }

@ -56,6 +56,7 @@ public class Startup
services.AddSqlSugarInstall(); services.AddSqlSugarInstall();
services.AddSaasDbInstall(); services.AddSaasDbInstall();
services.AddPrintModuleInstall(); services.AddPrintModuleInstall();
services.AddDjyModuleInstall(); //djy服务
} }

Loading…
Cancel
Save