|
|
|
@ -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,10 +185,11 @@ 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)
|
|
|
|
@ -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();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var partList= tenantDb.Queryable<SeaExport>().Where(x => x.ParentId == long.Parse(id)).ToList();
|
|
|
|
|
/// <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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|