海运出库删除 及业务锁定 费用锁定接口

master
ZR20090193-陈敬勇 7 months ago
parent 00a534fe3b
commit 07331a073c

@ -304,14 +304,34 @@ public static class MultiLanguageConst
public const string SeaExportExist = "Sea_Export_Exist";
[Description("海运出口信息不存在")]
public const string SeaExportNotExist = "Sea_Export_Not_Exist";
[Description("海运出口存在分票信息")]
public const string SeaExportPartExist = "Sea_Export_Part_Exist";
[Description("海运出口存在费用信息")]
public const string SeaExportFeeExist = "Sea_Export_Fee_Exist";
[Description("海运出口信息业务已锁定")]
public const string SeaExportBusinessLock = "Sea_Export_Business_Lock";
[Description("海运出口信息费用已锁定")]
public const string SeaExportFeeLock = "Sea_Export_Fee_Lock";
[Description("海运出口信息业务锁定已解锁")]
public const string SeaExportBusinessUnLock = "Sea_Export_Business_UnLock";
[Description("海运出口信息费用锁定已解锁")]
public const string SeaExportFeeUnLock = "Sea_Export_Fee_UnLock";
[Description("海运出口批量操作未勾选")]
public const string SeaExportBatchOpNoSelect = "Sea_Export_Batch_Op_No_Select";
[Description("海运出口批量编辑未勾选")]
public const string SeaExportBatchEditNoSelect = "Sea_Export_Batch_Edit_No_Select";
[Description("海运出口信息主提单号已存在")]
public const string SeaExportMBLNOExist = "Sea_Export_MBLNO_Exist";
[Description("海运出口信息分提单号已存在")]
public const string SeaExportHBLNOExist = "Sea_Export_HBLNO_Exist";
[Description("截港日期不允许小于开船日期")]
public const string SeaExportCloseDateLimit = "Sea_Export_CloseDate_Limit";
[Description("截单日期不允许小于开船日期")]
public const string SeaExportCloseDocDateLimit = "Sea_Export_CloseDocDate_Limit";
[Description("函电信息不存在")]
public const string LetterNotExist = "Letter_Not_Exist";

@ -5,7 +5,7 @@ namespace DS.Module.Core.Data;
/// <summary>
/// 实体类基类
/// </summary>
public abstract class BaseModel<TKey>
public abstract class BaseModel<TKey>: IDeleted
{
/// <summary>
/// 主键ID

@ -31,8 +31,48 @@ public interface ISeaExportService
/// <summary>
/// 批量编辑单据
/// </summary>
/// <param name="model"></param>
/// <param name="req"></param>
/// <returns></returns>
DataResult SeaExportBatchEdit(SeaExportBatchEditReq req);
/// <summary>
/// 业务单据删除
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult SeaExportDel(string id);
/// <summary>
/// 业务单据删除
/// </summary>
/// <param name="Ids">业务Ids</param>
/// <returns></returns>
public DataResult SeaExportBatchDel(List<long> Ids);
/// <summary>
/// 业务锁定
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult SeaExportBusinessLook(string id);
/// <summary>
/// 业务锁定解锁
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult SeaExportBusinessUnLook(string id);
/// <summary>
/// 费用锁定
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult SeaExportFeeLook(string id);
/// <summary>
/// 费用锁定解锁
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult SeaExportFeeUnLook(string id);
}

@ -3,6 +3,7 @@ using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface;
@ -61,10 +62,22 @@ public class SeaExportService : ISeaExportService
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (req.Id == 0)
{
if (tenantDb.Queryable<SeaExport>().Where(x => x.CustomerNo == req.CustomerNo.Trim()).Any())
if (req.BLType != "拼箱分票" && tenantDb.Queryable<SeaExport>().Where(x => x.MBLNO == req.MBLNO.Trim()).Any())
{
return DataResult.Failed("海运出口信息主提单号已存在!", MultiLanguageConst.SeaExportMBLNOExist);
}
if (tenantDb.Queryable<SeaExport>().Where(x => x.HBLNO == req.HBLNO.Trim()).Any())
{
return DataResult.Failed("海运出口信息分提单号已存在!", MultiLanguageConst.SeaExportHBLNOExist);
}
//TODO 会计期间不允许小于已结转期间
if (req.CloseDocDate.IsNotNull()&& req.CloseDocDate < req.ETD)
{
return DataResult.Failed("海运出口信息已存在!", MultiLanguageConst.SeaExportExist);
return DataResult.Failed("截单日期不允许小于开船日期!", MultiLanguageConst.SeaExportCloseDocDateLimit);
}
if (req.ClosingDate.IsNotNull() && req.ClosingDate < req.ETD)
{
return DataResult.Failed("截港日期不允许小于开船日期!", MultiLanguageConst.SeaExportCloseDateLimit);
}
var sequence = commonService.GetSequenceNext<SeaExport>();
if (!sequence.Succeeded)
@ -82,8 +95,21 @@ public class SeaExportService : ISeaExportService
{
var info = tenantDb.Queryable<SeaExport>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
if ((bool)info.IsBusinessLocking)
{
return DataResult.Failed("海运出口信息业务已锁定!", MultiLanguageConst.SeaExportBusinessLock);
}
info = req.Adapt(info);
//TODO 会计期间不允许小于已结转期间
if (info.CloseDocDate.IsNotNull() && info.CloseDocDate < info.ETD)
{
return DataResult.Failed("截单日期不允许小于开船日期!", MultiLanguageConst.SeaExportCloseDocDateLimit);
}
if (info.ClosingDate.IsNotNull() && info.ClosingDate < info.ETD)
{
return DataResult.Failed("截港日期不允许小于开船日期!", MultiLanguageConst.SeaExportCloseDateLimit);
}
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
@ -114,7 +140,7 @@ public class SeaExportService : ISeaExportService
{
return DataResult.Failed("海运出口批量编辑未勾选!", MultiLanguageConst.SeaExportBatchEditNoSelect);
}
if (tenantDb.Queryable<SeaExport>().Where(x => !req.Ids.Contains(x.Id)).Any())
if (tenantDb.Queryable<SeaExport>().Where(x => !req.Ids.Contains(x.Id)).Any().IsNull())
{
return DataResult.Failed("不存在的海运出口信息!", MultiLanguageConst.SeaExportExist);
}
@ -159,16 +185,17 @@ public class SeaExportService : ISeaExportService
return DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist);
}
//获取表单复制模板
var template = tenantDb.Queryable<CodeFormCopy>().Where(x=>x.PermissionId == 1772509201441099776).First();
var template = tenantDb.Queryable<CodeFormCopy>().Where(x => x.PermissionId == 1772509201441099776).First();
var entity = new SeaExport();
if (template.IsNullOrEmpty()) {
if (template.IsNullOrEmpty())
{
var sequence = commonService.GetSequenceNext<SeaExport>();
if (!sequence.Succeeded)
{
return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist);
}
}
entity = info.Adapt(entity);
entity.Id = 0;
@ -176,7 +203,7 @@ public class SeaExportService : ISeaExportService
entity.IsBusinessLocking = false;
entity.IsFeeLocking = false;
entity.CustomerNo = sequence.Data;
}
}
info.IsFeeLocking = true;
@ -184,6 +211,127 @@ public class SeaExportService : ISeaExportService
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
#region 删除
/// <summary>
/// 业务单据删除
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult SeaExportDel(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<SeaExport>().Where(x => x.Id == long.Parse(id)).First();
if (info.IsNullOrEmpty())
{
return DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist);
}
if (tenantDb.Queryable<SeaExport>().Where(x => x.ParentId == long.Parse(id)).Any())
{
return DataResult.Failed("海运出口存在分票信息,不能删除!", MultiLanguageConst.SeaExportPartExist);
}
if (tenantDb.Queryable<FeeRecord>().Where(x => x.BusinessId == long.Parse(id)).Any())
{
return DataResult.Failed("海运出口存在费用信息,不能删除!", MultiLanguageConst.SeaExportFeeExist);
}
if ((bool)info.IsBusinessLocking)
{
return DataResult.Failed("海运出口信息业务已锁定!", MultiLanguageConst.SeaExportBusinessLock);
}
if ((bool)info.IsFeeLocking)
{
return DataResult.Failed("海运出口信息费用已锁定!", MultiLanguageConst.SeaExportFeeLock);
}
info.Deleted = true;
info.DeleteTime = DateTime.Now;
info.DeleteBy = long.Parse(user.UserId);
tenantDb.Updateable(info).ExecuteCommand();
//tenantDb.Deleteable(info).IsLogic().ExecuteCommand("Deleted");
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
/// <summary>
/// 业务单据删除
/// </summary>
/// <param name="Ids">业务Ids</param>
/// <returns></returns>
public DataResult SeaExportBatchDel(List<long> Ids)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (Ids.Count == 0)
{
return DataResult.Failed("海运出口批量操作未勾选!", MultiLanguageConst.SeaExportBatchOpNoSelect);
}
if (tenantDb.Queryable<SeaExport>().Where(x => Ids.Contains(x.Id)).Any().IsNull())
{
return DataResult.Failed("不存在的海运出口信息!", MultiLanguageConst.SeaExportExist);
}
if (tenantDb.Queryable<SeaExport>().Where(x => Ids.Contains(x.Id) && x.IsBusinessLocking == true).Any())
{
return DataResult.Failed("海运出口信息业务已锁定!", MultiLanguageConst.SeaExportBusinessLock);
}
if (tenantDb.Queryable<SeaExport>().Where(x => Ids.Contains(x.Id) && x.IsFeeLocking == true).Any())
{
return DataResult.Failed("海运出口信息费用已锁定!", MultiLanguageConst.SeaExportFeeLock);
}
if (tenantDb.Queryable<SeaExport>().Where(x => Ids.Contains(x.ParentId)).Any())
{
return DataResult.Failed("海运出口存在分票信息,不能删除!", MultiLanguageConst.SeaExportPartExist);
}
if (tenantDb.Queryable<FeeRecord>().Where(x => Ids.Contains(x.BusinessId)).Any())
{
return DataResult.Failed("海运出口存在费用信息,不能删除!", MultiLanguageConst.SeaExportFeeExist);
}
var list = tenantDb.Queryable<SeaExport>().Where(x => Ids.Contains(x.Id)).ToList();
//tenantDb.Deleteable(list).IsLogic().ExecuteCommand("Deleted");
//tenantDb.Deleteable<SeaExport>(list).IsLogic().ExecuteCommand("Deleted");
foreach (var item in list)
{
item.Deleted = true;
item.DeleteTime = DateTime.Now;
item.DeleteBy = long.Parse(user.UserId);
tenantDb.Updateable(item).ExecuteCommand();
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
#endregion
#region 费用锁定 业务锁定
/// <summary>
/// 业务锁定
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult SeaExportBusinessLook(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<SeaExport>().Where(x => x.Id == long.Parse(id)).First();
if (info.IsNullOrEmpty())
{
return DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist);
}
if ((bool)info.IsBusinessLocking)
{
return DataResult.Failed("海运出口信息业务已锁定!", MultiLanguageConst.SeaExportBusinessLock);
}
info.IsBusinessLocking = true;
tenantDb.Updateable(info).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
/// <summary>
@ -195,21 +343,71 @@ public class SeaExportService : ISeaExportService
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<SeaExport>().Where(x => x.Id == long.Parse(id)).First();
if (info.IsNullOrEmpty()) {
if (info.IsNullOrEmpty())
{
return DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist);
}
if ((bool)info.IsFeeLocking) {
if ((bool)info.IsFeeLocking)
{
return DataResult.Failed("海运出口信息费用已锁定!", MultiLanguageConst.SeaExportFeeLock);
}
info.IsFeeLocking = true;
tenantDb.Updateable(info).ExecuteCommand();
var partList= tenantDb.Queryable<SeaExport>().Where(x => x.ParentId == long.Parse(id)).ToList();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
/// <summary>
/// 业务解锁
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult SeaExportBusinessUnLook(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<SeaExport>().Where(x => x.Id == long.Parse(id)).First();
if (info.IsNullOrEmpty())
{
return DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist);
}
if (!(bool)info.IsBusinessLocking)
{
return DataResult.Failed("海运出口信息业务锁定已解锁!", MultiLanguageConst.SeaExportBusinessUnLock);
}
info.IsBusinessLocking = false;
tenantDb.Updateable(info).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
/// <summary>
/// 费用解锁
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult SeaExportFeeUnLook(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<SeaExport>().Where(x => x.Id == long.Parse(id)).First();
if (info.IsNullOrEmpty())
{
return DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist);
}
if (!(bool)info.IsFeeLocking)
{
return DataResult.Failed("海运出口信息费用锁定已解锁!", MultiLanguageConst.SeaExportFeeUnLock);
}
info.IsFeeLocking = false;
tenantDb.Updateable(info).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
#endregion

@ -688,7 +688,7 @@ public class CommonService : ICommonService
var list = db.Queryable<SysRolePermission>().Where(a => roleList.Contains(a.RoleId) && a.IsPermission == 1)
.InnerJoin<SysPermission>((a,b)=>a.PermissionId == b.Id)
.Where((a, b) => b.MenuType == 3)
.Select((a, b) => a.PermissionId.ToString()
.Select((a, b) => b.PermissionCode
).ToArray();

@ -1244,3 +1244,10 @@
2024-04-24 15:39:08.8660 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-04-24 15:39:08.8743 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-24 15:39:08.8882 Info Configuration initialized.
2024-04-24 16:11:01.6567 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-04-24 16:11:01.6855 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-04-24 16:11:01.6953 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-04-24 16:11:01.7206 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-04-24 16:11:01.7409 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-04-24 16:11:01.7496 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-24 16:11:01.7621 Info Configuration initialized.

@ -76,4 +76,79 @@ public class SeaExportController : ApiController
var res = _invokeService.SeaExportBatchEdit(req);
return res;
}
/// <summary>
/// 业务单据删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("SeaExportDel")]
public DataResult SeaExportDel([FromQuery] string id)
{
var res = _invokeService.SeaExportDel(id);
return res;
}
/// <summary>
/// 业务单据批量删除
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
[HttpGet]
[Route("SeaExportBatchDel")]
public DataResult SeaExportBatchDel([FromQuery] List<long> Ids)
{
var res = _invokeService.SeaExportBatchDel(Ids);
return res;
}
/// <summary>
/// 业务锁定
/// </summary>
/// <param name="id">主键id</param>
/// <returns></returns>
[HttpGet]
[Route("SeaExportBusinessLook")]
public DataResult SeaExportBusinessLook([FromQuery] string id)
{
var res = _invokeService.SeaExportBusinessLook(id);
return res;
}
/// <summary>
/// 业务锁定解锁
/// </summary>
/// <param name="id">主键id</param>
/// <returns></returns>
[HttpGet]
[Route("SeaExportBusinessUnLook")]
public DataResult SeaExportBusinessUnLook([FromQuery] string id)
{
var res = _invokeService.SeaExportBusinessUnLook(id);
return res;
}
/// <summary>
/// 费用锁定
/// </summary>
/// <param name="id">主键id</param>
/// <returns></returns>
[HttpGet]
[Route("SeaExportFeeLook")]
public DataResult SeaExportFeeLook([FromQuery] string id)
{
var res = _invokeService.SeaExportFeeLook(id);
return res;
}
/// <summary>
/// 费用锁定解锁
/// </summary>
/// <param name="id">主键id</param>
/// <returns></returns>
[HttpGet]
[Route("SeaExportFeeUnLook")]
public DataResult SeaExportFeeUnLook([FromQuery] string id)
{
var res = _invokeService.SeaExportFeeUnLook(id);
return res;
}
}

@ -40,3 +40,24 @@
2024-04-22 15:45:41.1512 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-04-22 15:45:41.1789 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-22 15:45:41.2096 Info Configuration initialized.
2024-04-25 11:52:12.8989 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-04-25 11:52:12.9416 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-04-25 11:52:12.9562 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-04-25 11:52:12.9944 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-04-25 11:52:13.0239 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-04-25 11:52:13.0379 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-25 11:52:13.0611 Info Configuration initialized.
2024-04-25 16:18:45.1294 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-04-25 16:18:45.1533 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-04-25 16:18:45.1608 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-04-25 16:18:45.1821 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-04-25 16:18:45.1967 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-04-25 16:18:45.2035 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-25 16:18:45.2035 Info Configuration initialized.
2024-04-25 16:26:37.5355 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-04-25 16:26:37.5567 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-04-25 16:26:37.5648 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-04-25 16:26:37.5829 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-04-25 16:26:37.5966 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
2024-04-25 16:26:37.5966 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-25 16:26:37.6146 Info Configuration initialized.

Loading…
Cancel
Save