费用模板 批量删除、保存业务修改

master
ZR20090193-陈敬勇 7 months ago
parent 9d31a2c4e4
commit 984730989e

@ -349,6 +349,9 @@ public static class MultiLanguageConst
public const string SeaExportCloseDateLimit = "Sea_Export_CloseDate_Limit";
[Description("截单日期不允许小于开船日期")]
public const string SeaExportCloseDocDateLimit = "Sea_Export_CloseDocDate_Limit";
[Description("箱信息不存在")]
public const string OpCtnNotExist = "OpCtn_Not_Exist";
[Description("函电信息不存在")]
public const string LetterNotExist = "Letter_Not_Exist";
@ -370,6 +373,8 @@ public static class MultiLanguageConst
public const string FeeTemplateExist = "Fee_Template_Exist";
[Description("费用模板明细已存在")]
public const string FeeTemplateDetailExist = "Fee_Template_Detail_Exist";
[Description("费用模板明细不存在")]
public const string FeeTemplateDetailNotExist = "Fee_Template_Detail_Not_Exist";
[Description("往来单位固定费用已存在")]
public const string FeeCustTemplateDetailExist = "Fee_Cust_Template_Detail_Exist";
[Description("费用代码已存在")]

@ -0,0 +1,33 @@
using DS.Module.UserModule;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DS.Module.SqlSugar;
namespace DS.Module.CrawlerData
{
public class CrawlerDataService: ICrawlerDataService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly ISaasDbService saasService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="serviceProvider"></param>
public CrawlerDataService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
}
}

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DS.Module.Core\DS.Module.Core.csproj" />
<ProjectReference Include="..\DS.Module.Nuget\DS.Module.Nuget.csproj" />
<ProjectReference Include="..\DS.Module.UserModule\DS.Module.UserModule.csproj" />
<ProjectReference Include="..\DS.WMS.Core\DS.WMS.Core.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.Module.CrawlerData
{
public interface ICrawlerDataService
{
}
}

@ -46,7 +46,10 @@ public class FeeTemplateReq
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 明细
/// </summary>
public List<FeeTemplateDetailReq> Detail { get; set; }
}
/// <summary>

@ -27,4 +27,17 @@ public interface IFeeTemplateDetailService
/// <param name="id"></param>
/// <returns></returns>
DataResult<FeeTemplateDetailRes> GetFeeTemplateDetailInfo(string id);
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult DelFeeTemplateDetail(string id);
/// <summary>
/// 批量删除
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public DataResult BatchDelFeeTemplateDetail(List<long> Ids);
}

@ -10,6 +10,7 @@ using SqlSugar;
using Mapster;
using DS.Module.Core.Extensions;
using Masuit.Tools.Strings;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Method
{
@ -95,5 +96,42 @@ namespace DS.WMS.Core.Fee.Method
.First();
return DataResult<FeeTemplateDetailRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult DelFeeTemplateDetail(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<FeeTemplateDetail>().Where(x => x.Id == long.Parse(id)).First();
if (info == null)
{
return DataResult.Failed("费用模板明细不存在!", MultiLanguageConst.FeeTemplateDetailNotExist);
}
tenantDb.Deleteable(info).ExecuteCommand();
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public DataResult BatchDelFeeTemplateDetail(List<long> Ids)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = tenantDb.Queryable<FeeTemplateDetail>().Where(x => Ids.Contains(x.Id)).ToList();
;
if (list.Count>0)
{
tenantDb.Deleteable(list).ExecuteCommand();
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
}
}

@ -9,6 +9,8 @@ using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using Mapster;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Op.Entity;
using AngleSharp.Dom;
namespace DS.WMS.Core.Fee.Method
{
@ -67,6 +69,16 @@ namespace DS.WMS.Core.Fee.Method
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
if (req.Detail.Count > 0)
{
foreach (var item in req.Detail)
{
var detail = item.Adapt<FeeTemplateDetail>();
detail.TemplateId = entity.Id;
tenantDb.Insertable(detail).ExecuteCommand();
}
}
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
@ -76,6 +88,28 @@ namespace DS.WMS.Core.Fee.Method
info = req.Adapt(info);
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
if (req.Detail.Count > 0)
{
var detailList = tenantDb.Queryable<FeeTemplateDetail>().Where(x => x.TemplateId == req.Id).ToList();
foreach (var item in req.Detail)
{
if (item.Id == 0)
{
var detail = item.Adapt<FeeTemplateDetail>();
detail.TemplateId = info.Id;
tenantDb.Insertable(detail).ExecuteCommand();
}
else
{
var detail = detailList.First(x => x.Id == item.Id);
detail = item.Adapt(detail);
tenantDb.Updateable(detail).ExecuteCommand();
}
}
}
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}

@ -35,5 +35,18 @@ namespace DS.WMS.Core.Op.Interface
/// <param name="id"></param>
/// <returns></returns>
DataResult<OpCtnRes> GetOpCtnInfo(string id);
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult DelOpCtn(string id);
/// <summary>
/// 批量删除
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public DataResult BatchDelOpCtn(List<long> Ids);
}
}

@ -2,6 +2,7 @@
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface;
@ -85,5 +86,40 @@ namespace DS.WMS.Core.Op.Method
.First();
return DataResult<OpCtnRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult DelOpCtn(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<OpCtn>().Where(x => x.Id == long.Parse(id)).First();
if (info == null)
{
return DataResult.Failed("箱信息不存在!", MultiLanguageConst.OpCtnNotExist);
}
tenantDb.Deleteable(info).ExecuteCommand();
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
public DataResult BatchDelOpCtn(List<long> Ids)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = tenantDb.Queryable<OpCtn>().Where(x => Ids.Contains(x.Id)).ToList();
;
if (list.Count > 0)
{
tenantDb.Deleteable(list).ExecuteCommand();
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
}
}

@ -133,10 +133,19 @@ public class SeaExportService : ISeaExportService
var ctnList = tenantDb.Queryable<OpCtn>().Where(x => x.BSNO == req.Id.ToString()).ToList();
foreach (var item in req.CtnInfo)
{
var ctn = ctnList.First(x => x.Id == item.Id);
ctn = item.Adapt(ctn);
tenantDb.Updateable(ctn).ExecuteCommand();
if (item.Id == 0)
{
var ctn = item.Adapt<OpCtn>();
ctn.BSNO = info.Id.ToString();
tenantDb.Insertable(ctn).ExecuteCommand();
}
else
{
var ctn = ctnList.First(x => x.Id == item.Id);
ctn = item.Adapt(ctn);
tenantDb.Updateable(ctn).ExecuteCommand();
}
}
}

@ -62,5 +62,32 @@ namespace DS.WMS.FeeApi.Controllers
var res = _invokeService.GetFeeTemplateDetailInfo(id);
return res;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("DelFeeTemplateDetail")]
public DataResult DelFeeTemplateDetail([FromQuery] string id)
{
var res = _invokeService.DelFeeTemplateDetail(id);
return res;
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
[HttpGet]
[Route("BatchDelFeeTemplateDetail")]
public DataResult BatchDelFeeTemplateDetail([FromQuery] List<long> Ids)
{
var res = _invokeService.BatchDelFeeTemplateDetail(Ids);
return res;
}
}
}

@ -62,6 +62,28 @@ public class OpCtnController : ApiController
var res = _invokeService.GetOpCtnInfo(id);
return res;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("DelOpCtn")]
public DataResult DelOpCtn([FromQuery] string id)
{
var res = _invokeService.DelOpCtn(id);
return res;
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
[HttpGet]
[Route("BatchDelOpCtn")]
public DataResult BatchDelOpCtn([FromQuery] List<long> Ids)
{
var res = _invokeService.BatchDelOpCtn(Ids);
return res;
}
}

@ -71,9 +71,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.PrintModule", "DS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.ExcelModule", "DS.Module.ExcelModule\DS.Module.ExcelModule.csproj", "{B4F32D53-749E-4019-BB41-DE64FC803C86}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.WMS.OpApi", "DS.WMS.OpApi\DS.WMS.OpApi.csproj", "{28C691B0-6891-4407-9A8F-03E6035FB963}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.OpApi", "DS.WMS.OpApi\DS.WMS.OpApi.csproj", "{28C691B0-6891-4407-9A8F-03E6035FB963}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.WMS.FeeApi", "DS.WMS.FeeApi\DS.WMS.FeeApi.csproj", "{4A810D08-AB29-4758-BA37-9BEDBEA97B3A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.FeeApi", "DS.WMS.FeeApi\DS.WMS.FeeApi.csproj", "{4A810D08-AB29-4758-BA37-9BEDBEA97B3A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.Module.CrawlerData", "DS.Module.CrawlerData\DS.Module.CrawlerData.csproj", "{AB3034D8-91F4-42A6-BFE9-497B238D65AD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -209,6 +211,10 @@ Global
{4A810D08-AB29-4758-BA37-9BEDBEA97B3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A810D08-AB29-4758-BA37-9BEDBEA97B3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A810D08-AB29-4758-BA37-9BEDBEA97B3A}.Release|Any CPU.Build.0 = Release|Any CPU
{AB3034D8-91F4-42A6-BFE9-497B238D65AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB3034D8-91F4-42A6-BFE9-497B238D65AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB3034D8-91F4-42A6-BFE9-497B238D65AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB3034D8-91F4-42A6-BFE9-497B238D65AD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -246,6 +252,7 @@ Global
{B4F32D53-749E-4019-BB41-DE64FC803C86} = {518DB9B5-80A8-4B2C-8570-52BD406458DE}
{28C691B0-6891-4407-9A8F-03E6035FB963} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4}
{4A810D08-AB29-4758-BA37-9BEDBEA97B3A} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4}
{AB3034D8-91F4-42A6-BFE9-497B238D65AD} = {518DB9B5-80A8-4B2C-8570-52BD406458DE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {66115F23-94B4-43C0-838E-33B5CF77F788}

Loading…
Cancel
Save