diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs
index 97069118..2234530f 100644
--- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs
+++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs
@@ -1639,5 +1639,8 @@ public static class MultiLanguageConst
[Description("箱号不能为空")]
public const string CM_CntrnoNotNull = "Cntrno need value.";
+ [Description("已被退租引用")]
+ public const string CM_HaveBeenEndLease = "Cntrno CM_Have Been EndLease.";
+
#endregion
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentOutController.cs b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentOutController.cs
index 1ba95f22..d1ee31ec 100644
--- a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentOutController.cs
+++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_RentOutController.cs
@@ -156,7 +156,7 @@ public class CM_RentOutController : ApiController
///
[HttpPost]
[Route("CM_RentOut_NeedRent_View")]
- public Task>> CM_RentOut_NeedRent_View([FromBody] PageRequest request)
+ public Task>> CM_RentOut_NeedRent_View([FromBody] PageRequest request)
{
var res = _invokeService.CM_RentOut_NeedRent_View(request);
return res;
@@ -169,14 +169,14 @@ public class CM_RentOutController : ApiController
///
[HttpPost]
[Route("CM_RentOut_NeedEndLease_View")]
- public Task>> CM_RentOut_NeedEndLease_View([FromBody] PageRequest request)
+ public Task>> CM_RentOut_NeedEndLease_View([FromBody] PageRequest request)
{
var res = _invokeService.CM_RentOut_NeedEndLease_View(request);
return res;
}
///
- /// 租箱租出退租_添加
+ /// 租箱租出_添加
///
///
///
@@ -188,4 +188,17 @@ public class CM_RentOutController : ApiController
//return res;
}
+ ///
+ /// 租箱租出退租_添加
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("CM_RentOut_EndLease_AddCtn")]
+ public async Task CM_RentOut_EndLease_AddCtn([FromBody] IdModel model)
+ {
+ return await _invokeService.CM_RentOut_EndLease_AddCtn(long.Parse(model.Id), model.Ids);
+ //return res;
+ }
+
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOut_NeedEndLeaseRes.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOut_NeedEndLeaseRes.cs
new file mode 100644
index 00000000..8c033204
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOut_NeedEndLeaseRes.cs
@@ -0,0 +1,186 @@
+using DS.Module.Core;
+using DS.Module.Core.Enums;
+using DS.WMS.Core.Op.Entity;
+using FluentValidation;
+using Masuit.Tools.Systems;
+using SqlSugar;
+using System.ComponentModel;
+
+namespace DS.WMS.ContainerManagement.Info.Dtos;
+
+///
+/// 箱管_租箱租出 待退租明细视图 返回实体
+///
+public class VW_CM_RentOut_NeedEndLeaseRes
+{
+ ///
+ /// 租箱业务id
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// Desc:租箱业务号
+ ///
+ public string Billno { get; set; }
+
+ ///
+ /// Desc:箱号
+ ///
+ public string Cntrno { get; set; }
+ ///
+ /// 箱型代码
+ ///
+ public string CtnCode { get; set; }
+ ///
+ /// Desc:箱型
+ ///
+ public string Ctnall { get; set; }
+ ///
+ /// Desc:箱来源Id: 自有箱/短租租入/长租租入/买箱
+ ///
+ public CM_CtnSourceEnum? CtnSourceId { get; set; }
+ ///
+ /// Desc:箱业务状态id: 短租租出 长租租出 单程 卖箱
+ ///
+ public CM_CtnBizStateEnum? CtnBizStateId { get; set; }
+
+ ///
+ /// Desc:是否上线id(是否管理中)
+ ///
+ public CM_IsOnlineEnum? IsOnlineId { get; set; } = 0;
+ ///
+ ///
+ /// Desc:箱状态Id
+ ///
+ public CMCtnStateEnum? CtnStateId { get; set; }
+
+
+ ///
+ /// Desc:箱流转状态Id
+ ///
+ public CMCtnFlowStateEnum? CtnFlowStateId { get; set; }
+ ///
+ /// Desc:箱主Id
+ ///
+ public long? CtnOwnerId { get; set; }
+ ///
+ /// Desc:原箱主
+ ///
+ public string CtnOwner { get; set; }
+
+ ///
+ /// Desc:租箱客户Id
+ ///
+ public long RentCustomerId { get; set; }
+ ///
+ /// Desc:租箱客户
+ ///
+ public string RentCustomerName { get; set; }
+
+ ///
+ /// Desc:租箱业务 租入 租入退租 租出 租出退租 CMRentDirectEnum
+ ///
+ public CMRentDirectEnum? RentDirectId { get; set; }
+
+ ///
+ /// Desc:租箱类型 1长租 0短租 2单程 CMRentTypeEnum
+ ///
+ public CMRentTypeEnum? RentTypeId { get; set; }
+
+ ///
+ /// Desc:租入日期
+ ///
+ public DateTime? Bsdate { get; set; }
+
+ ///
+ /// Desc:开始计费日期
+ ///
+ public DateTime? FeeStartDate { get; set; }
+
+ ///
+ /// Desc:币别
+ ///
+ public string Currency { get; set; } = "USD";
+
+
+ ///
+ /// Desc:日租金
+ ///
+ public decimal? DailyRate { get; set; } = 0M;
+
+
+ ///
+ /// Desc:提箱费
+ ///
+ public decimal? PickupFee { get; set; } = 0M;
+
+
+ ///
+ /// Desc:提箱日期
+ ///
+ public DateTime? PickupDate { get; set; }
+
+ ///
+ /// Desc:还箱费
+ ///
+ public decimal? DropoffFee { get; set; } = 0M;
+
+
+ ///
+ /// Desc:还箱日期
+ ///
+ public DateTime? DropoffDate { get; set; }
+
+ ///
+ /// Desc:起租地点代码
+ ///
+ public string RentalPortid { get; set; }
+ ///
+ /// Desc:起租地点五字码
+ ///
+ public string RentalPortCode { get; set; }
+ ///
+ /// Desc:起租地点
+ ///
+ public string RentalPort { get; set; }
+
+ ///
+ /// Desc:提箱港口代码
+ ///
+ public long? PickupPortid { get; set; }
+
+ ///
+ /// Desc:提箱港口五字码
+ ///
+ public string PickupPortCode { get; set; }
+ ///
+ /// Desc:提箱港口
+ ///
+ public string PickupPort { get; set; }
+
+ ///
+ /// Desc:还箱港口代码
+ ///
+ public long? DropoffPortid { get; set; }
+ ///
+ /// Desc:还箱港口五字码
+ ///
+ public string DropoffPortCode { get; set; }
+ ///
+ /// Desc:还箱港口
+ ///
+ public string DropoffPort { get; set; }
+
+ ///
+ /// Desc:业务编号/提单号
+ ///
+ public string Mblno { get; set; }
+
+ ///
+ /// Desc:船名航次
+ ///
+ public string VesselVoyno { get; set; }
+
+
+
+}
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOut_NeedRentRes.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOut_NeedRentRes.cs
index 4de263b5..e4a39a51 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOut_NeedRentRes.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/VW_CM_RentOut_NeedRentRes.cs
@@ -9,7 +9,7 @@ using System.ComponentModel;
namespace DS.WMS.ContainerManagement.Info.Dtos;
///
-/// 箱管_待计算月结费用明细 请求实体
+/// 箱管_待计算月结费用明细 返回实体
///
public class VW_CM_RentOut_NeedRentRes
{
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentOutService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentOutService.cs
index 60ca2b8b..1e619ff9 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentOutService.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_RentOutService.cs
@@ -71,12 +71,22 @@ public interface ICM_RentOutService
///
///
///
- Task>> CM_RentOut_NeedEndLease_View(PageRequest request);
+ Task>> CM_RentOut_NeedEndLease_View(PageRequest request);
///
- /// 删除租出业务
+ /// 租出业务 添加租箱明细
///
- /// 租箱租出业务ID
+ /// 当前状态IDs
///
Task CM_RentOut_AddCtn(long id, params long[] ids);
+
+
+ ///
+ /// 租出业务 添加租箱退租明细
+ ///
+ /// 租箱租出业务明细ID
+ ///
+ Task CM_RentOut_EndLease_AddCtn(long id, params long[] ids);
+
+
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentIn_DetailService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentIn_DetailService.cs
index 45f5a4dd..f3234355 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentIn_DetailService.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentIn_DetailService.cs
@@ -102,8 +102,6 @@ public class CM_RentIn_DetailService : CMServiceBase, ICM_RentIn_DetailService
return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess);
}
- #region 删除
-
///
/// 删除
///
@@ -111,7 +109,7 @@ public class CM_RentIn_DetailService : CMServiceBase, ICM_RentIn_DetailService
///
public async Task DeleteCM_RentIn_DetailAsync(params long[] ids)
{
- var feeCount = await TenantDb.Queryable().Where(x => ids.Contains(x.BusinessId)).CountAsync();
+ //var feeCount = await TenantDb.Queryable().Where(x => ids.Contains(x.BusinessId)).CountAsync();
//foreach (var _id in ids) {
//if (await IsLockedAsync(_id, BusinessType.CM_RentIn))
@@ -120,6 +118,13 @@ public class CM_RentIn_DetailService : CMServiceBase, ICM_RentIn_DetailService
//if (await TenantDb.Queryable().AnyAsync(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission)))
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeRecordDelete));
+ var 退租detail = await TenantDb.Queryable().Where(x => ids.Contains(x.RentDetailId)).ToListAsync();
+
+ if (退租detail != null && 退租detail.Count > 0) {
+ return DataResult.FailedWithDesc(nameof(MultiLanguageConst.CM_HaveBeenEndLease));
+
+ }
+
int result = await TenantDb.Deleteable(x => ids.Contains(x.Id)).ExecuteCommandAsync();
//await WriteBackStatusAsync(model.BusinessId, model.BusinessType);
@@ -127,5 +132,4 @@ public class CM_RentIn_DetailService : CMServiceBase, ICM_RentIn_DetailService
return result > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
- #endregion
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs
index 4af5c73b..6bf83be9 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs
@@ -680,25 +680,55 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService
}
+
///
- /// 租箱租出明细视图_列表
+ /// 租箱租出 待租出 明细_视图
///
- ///
+ ///
///
- //public async Task>> CM_RentOut_Detail_View(PageRequest request)
- //{
- // var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
- // //序列化查询条件
- // var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
- // var data = tenantDb.Queryable()
- // .Where(whereList)
- // .Select().ToQueryPage(request.PageCondition);
- // return data;
- //}
+ public async Task>> CM_RentOut_NeedRent_View(PageRequest request)
+ {
+ var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+ //if (request.PageCondition.SortConditions == null || request.PageCondition.SortConditions.Count() == 0)
+ //{
+ // request.PageCondition.SortConditions = new SortCondition[]{new SortCondition
+ // {
+ // SortField = nameof(VW_CM_RentOut_NeedRentRes.StateTime),
+ // ListSortDirection = System.ComponentModel.ListSortDirection.Descending
+ // } };
+ //}
+
+ request.SetDefaultOrderField("StateTime");
+
+ //序列化查询条件
+ var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
+ var data = tenantDb.Queryable()
+ .Where(whereList)
+ .Select()
+ .ToQueryPage(request.PageCondition);
+ return data;
+ }
///
- /// 租箱租出退租_添加箱
+ /// 租箱租出 待退租 明细_视图
+ ///
+ ///
+ ///
+ public async Task>> CM_RentOut_NeedEndLease_View(PageRequest request)
+ {
+ var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+ //序列化查询条件
+ var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
+ var data = tenantDb.Queryable()
+ .Where(whereList)
+ .Select().ToQueryPage(request.PageCondition);
+ return data;
+ }
+
+
+ ///
+ /// 租箱租出_添加箱
///
/// 租出明细ID
///
@@ -717,14 +747,14 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService
var CurrentDetailList = TenantDb.Queryable()
.Where(a => a.Pid == id).ToList();
- var OnAddDetail = TenantDb.Queryable()
+ var AddCurrentStateList = TenantDb.Queryable()
.Where(a => ids.Contains(a.Id)).ToList();
var addList = new List();
- if (OnAddDetail != null && OnAddDetail.Count > 0)
+ if (AddCurrentStateList != null && AddCurrentStateList.Count > 0)
{
- foreach (var addrec in OnAddDetail)
+ foreach (var addrec in AddCurrentStateList)
{
if (CurrentDetailList.Exists(x => x.Cntrno == addrec.Cntrno))
{
@@ -736,9 +766,12 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService
newrec = addrec.Adapt();
newrec.Id = 0;
newrec.Pid = id;
- newrec.RentDirectId = CMRentDirectEnum.租出退租;
+ newrec.RentDirectId = CMRentDirectEnum.租出;
newrec.DropoffDate = head.Bsdate;
newrec.RentDetailId = addrec.Id;//
+ newrec.RentCustomerId = head.RentCustomerId;
+ newrec.RentCustomerName = head.RentCustomerName;
+ newrec.RentTypeId = head.RentTypeId;
addList.Add(newrec);
}
@@ -766,46 +799,74 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService
//return result > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
+
///
- /// 租箱租出 待租出 明细_视图
+ /// 租箱租出退租_添加箱
///
- ///
+ /// 租出明细ID
///
- public async Task>> CM_RentOut_NeedRent_View(PageRequest request) {
- var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+ public async Task CM_RentOut_EndLease_AddCtn(long id, params long[] ids)
+ {
- //if (request.PageCondition.SortConditions == null || request.PageCondition.SortConditions.Count() == 0)
+ //foreach (var _id in ids)
//{
- // request.PageCondition.SortConditions = new SortCondition[]{new SortCondition
- // {
- // SortField = nameof(VW_CM_RentOut_NeedRentRes.StateTime),
- // ListSortDirection = System.ComponentModel.ListSortDirection.Descending
- // } };
+ if (await IsLockedAsync(id, BusinessType.CM_RentOut))
+ return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeLocked));
//}
+ //
- request.SetDefaultOrderField("StateTime");
+ var head = TenantDb.Queryable().Where(a => a.Id == id).First();
- //序列化查询条件
- var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
- var data = tenantDb.Queryable()
- .Where(whereList)
- .Select ()
- .ToQueryPage(request.PageCondition);
- return data;
- }
+ var CurrentDetailList = TenantDb.Queryable()
+ .Where(a => a.Pid == id).ToList();
- ///
- /// 租箱租出 待退租 明细_视图
- ///
- ///
- ///
- public async Task>> CM_RentOut_NeedEndLease_View(PageRequest request) {
- var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
- //序列化查询条件
- var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
- var data = tenantDb.Queryable()
- .Where(whereList)
- .Select().ToQueryPage(request.PageCondition);
- return data;
+ var OnAddDetail = TenantDb.Queryable()
+ .Where(a => ids.Contains(a.Id)).ToList();
+
+ var addList = new List();
+
+ if (OnAddDetail != null && OnAddDetail.Count > 0)
+ {
+ foreach (var addrec in OnAddDetail)
+ {
+ if (CurrentDetailList.Exists(x => x.Cntrno == addrec.Cntrno))
+ {
+ //箱号已存在 就不添加
+ }
+ else
+ {
+ var newrec = new CM_RentOut_Detail();
+ newrec = addrec.Adapt();
+ newrec.Id = 0;
+ newrec.Pid = id;
+ newrec.RentDirectId = CMRentDirectEnum.租出退租;
+ newrec.DropoffDate = head.Bsdate;
+ newrec.RentDetailId = addrec.Id;//
+
+ addList.Add(newrec);
+ }
+
+ }
+
+ if (addList != null && addList.Count > 0)
+ {
+ await TenantDb.Insertable(addList).ExecuteCommandAsync();
+
+ return DataResult.Successed("添加成功!", id, MultiLanguageConst.DataCreateSuccess);
+ }
+ else
+ {
+ return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
+ }
+ }
+ else
+ {
+ return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
+ }
+
+ //await WriteBackStatusAsync(model.BusinessId, model.BusinessType);
+
+ //return result > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
+
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOut_DetailService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOut_DetailService.cs
index 3cc9f9c4..31b32083 100644
--- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOut_DetailService.cs
+++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOut_DetailService.cs
@@ -111,14 +111,15 @@ public class CM_RentOut_DetailService : CMServiceBase, ICM_RentOut_DetailService
///
public async Task DeleteCM_RentOut_DetailAsync(params long[] ids)
{
- var feeCount = await TenantDb.Queryable().Where(x => ids.Contains(x.BusinessId)).CountAsync();
-
- //foreach (var _id in ids) {
- //if (await IsLockedAsync(_id, BusinessType.CM_RentIn))
- // return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeLocked));
- //}
- //if (await TenantDb.Queryable().AnyAsync(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission)))
- // return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeRecordDelete));
+ //var feeCount = await TenantDb.Queryable().Where(x => ids.Contains(x.BusinessId)).CountAsync();
+
+ var 退租detail = await TenantDb.Queryable().Where(x => ids.Contains(x.RentDetailId)).ToListAsync();
+
+ if (退租detail != null && 退租detail.Count > 0)
+ {
+ return DataResult.FailedWithDesc(nameof(MultiLanguageConst.CM_HaveBeenEndLease));
+
+ }
int result = await TenantDb.Deleteable(x => ids.Contains(x.Id)).ExecuteCommandAsync();