租出和租出退租完成

usertest
dengyu 3 months ago
parent 1ceca6013b
commit 8bc1a40fa2

@ -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
}

@ -156,7 +156,7 @@ public class CM_RentOutController : ApiController
/// <returns></returns>
[HttpPost]
[Route("CM_RentOut_NeedRent_View")]
public Task<DataResult<List<VW_CM_NeedEndLease_DetailRes>>> CM_RentOut_NeedRent_View([FromBody] PageRequest request)
public Task<DataResult<List<VW_CM_RentOut_NeedRentRes>>> 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
/// <returns></returns>
[HttpPost]
[Route("CM_RentOut_NeedEndLease_View")]
public Task<DataResult<List<VW_CM_NeedEndLease_DetailRes>>> CM_RentOut_NeedEndLease_View([FromBody] PageRequest request)
public Task<DataResult<List<VW_CM_RentOut_NeedEndLeaseRes>>> CM_RentOut_NeedEndLease_View([FromBody] PageRequest request)
{
var res = _invokeService.CM_RentOut_NeedEndLease_View(request);
return res;
}
/// <summary>
/// 租箱租出退租_添加
/// 租箱租出_添加
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
@ -188,4 +188,17 @@ public class CM_RentOutController : ApiController
//return res;
}
/// <summary>
/// 租箱租出退租_添加
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost]
[Route("CM_RentOut_EndLease_AddCtn")]
public async Task<DataResult> CM_RentOut_EndLease_AddCtn([FromBody] IdModel model)
{
return await _invokeService.CM_RentOut_EndLease_AddCtn(long.Parse(model.Id), model.Ids);
//return res;
}
}

@ -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;
/// <summary>
/// 箱管_租箱租出 待退租明细视图 返回实体
/// </summary>
public class VW_CM_RentOut_NeedEndLeaseRes
{
/// <summary>
/// 租箱业务id
/// </summary>
public long Id { get; set; }
/// <summary>
/// Desc:租箱业务号
/// </summary>
public string Billno { get; set; }
/// <summary>
/// Desc:箱号
/// </summary>
public string Cntrno { get; set; }
/// <summary>
/// 箱型代码
/// </summary>
public string CtnCode { get; set; }
/// <summary>
/// Desc:箱型
/// </summary>
public string Ctnall { get; set; }
/// <summary>
/// Desc:箱来源Id: 自有箱/短租租入/长租租入/买箱
/// </summary>
public CM_CtnSourceEnum? CtnSourceId { get; set; }
/// <summary>
/// Desc:箱业务状态id: 短租租出 长租租出 单程 卖箱
/// </summary>
public CM_CtnBizStateEnum? CtnBizStateId { get; set; }
/// <summary>
/// Desc:是否上线id(是否管理中)
/// </summary>
public CM_IsOnlineEnum? IsOnlineId { get; set; } = 0;
/// <summary>
/// <summary>
/// Desc:箱状态Id
/// </summary>
public CMCtnStateEnum? CtnStateId { get; set; }
/// <summary>
/// Desc:箱流转状态Id
/// </summary>
public CMCtnFlowStateEnum? CtnFlowStateId { get; set; }
/// <summary>
/// Desc:箱主Id
/// </summary>
public long? CtnOwnerId { get; set; }
/// <summary>
/// Desc:原箱主
/// </summary>
public string CtnOwner { get; set; }
/// <summary>
/// Desc:租箱客户Id
/// </summary>
public long RentCustomerId { get; set; }
/// <summary>
/// Desc:租箱客户
/// </summary>
public string RentCustomerName { get; set; }
/// <summary>
/// Desc:租箱业务 租入 租入退租 租出 租出退租 CMRentDirectEnum
/// </summary>
public CMRentDirectEnum? RentDirectId { get; set; }
/// <summary>
/// Desc:租箱类型 1长租 0短租 2单程 CMRentTypeEnum
/// </summary>
public CMRentTypeEnum? RentTypeId { get; set; }
/// <summary>
/// Desc:租入日期
/// </summary>
public DateTime? Bsdate { get; set; }
/// <summary>
/// Desc:开始计费日期
/// </summary>
public DateTime? FeeStartDate { get; set; }
/// <summary>
/// Desc:币别
/// </summary>
public string Currency { get; set; } = "USD";
/// <summary>
/// Desc:日租金
/// </summary>
public decimal? DailyRate { get; set; } = 0M;
/// <summary>
/// Desc:提箱费
/// </summary>
public decimal? PickupFee { get; set; } = 0M;
/// <summary>
/// Desc:提箱日期
/// </summary>
public DateTime? PickupDate { get; set; }
/// <summary>
/// Desc:还箱费
/// </summary>
public decimal? DropoffFee { get; set; } = 0M;
/// <summary>
/// Desc:还箱日期
/// </summary>
public DateTime? DropoffDate { get; set; }
/// <summary>
/// Desc:起租地点代码
/// </summary>
public string RentalPortid { get; set; }
/// <summary>
/// Desc:起租地点五字码
/// </summary>
public string RentalPortCode { get; set; }
/// <summary>
/// Desc:起租地点
/// </summary>
public string RentalPort { get; set; }
/// <summary>
/// Desc:提箱港口代码
/// </summary>
public long? PickupPortid { get; set; }
/// <summary>
/// Desc:提箱港口五字码
/// </summary>
public string PickupPortCode { get; set; }
/// <summary>
/// Desc:提箱港口
/// </summary>
public string PickupPort { get; set; }
/// <summary>
/// Desc:还箱港口代码
/// </summary>
public long? DropoffPortid { get; set; }
/// <summary>
/// Desc:还箱港口五字码
/// </summary>
public string DropoffPortCode { get; set; }
/// <summary>
/// Desc:还箱港口
/// </summary>
public string DropoffPort { get; set; }
/// <summary>
/// Desc:业务编号/提单号
/// </summary>
public string Mblno { get; set; }
/// <summary>
/// Desc:船名航次
/// </summary>
public string VesselVoyno { get; set; }
}

@ -9,7 +9,7 @@ using System.ComponentModel;
namespace DS.WMS.ContainerManagement.Info.Dtos;
/// <summary>
/// 箱管_待计算月结费用明细 请求实体
/// 箱管_待计算月结费用明细 返回实体
/// </summary>
public class VW_CM_RentOut_NeedRentRes
{

@ -71,12 +71,22 @@ public interface ICM_RentOutService
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<DataResult<List<VW_CM_NeedEndLease_DetailRes>>> CM_RentOut_NeedEndLease_View(PageRequest request);
Task<DataResult<List<VW_CM_RentOut_NeedEndLeaseRes>>> CM_RentOut_NeedEndLease_View(PageRequest request);
/// <summary>
/// 删除租出业务
/// 租出业务 添加租箱明细
/// </summary>
/// <param name="ids">租箱租出业务ID</param>
/// <param name="ids">当前状态IDs</param>
/// <returns></returns>
Task<DataResult> CM_RentOut_AddCtn(long id, params long[] ids);
/// <summary>
/// 租出业务 添加租箱退租明细
/// </summary>
/// <param name="ids">租箱租出业务明细ID</param>
/// <returns></returns>
Task<DataResult> CM_RentOut_EndLease_AddCtn(long id, params long[] ids);
}

@ -102,8 +102,6 @@ public class CM_RentIn_DetailService : CMServiceBase, ICM_RentIn_DetailService
return DataResult<CM_RentIn_DetailRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
#region 删除
/// <summary>
/// 删除
/// </summary>
@ -111,7 +109,7 @@ public class CM_RentIn_DetailService : CMServiceBase, ICM_RentIn_DetailService
/// <returns></returns>
public async Task<DataResult> DeleteCM_RentIn_DetailAsync(params long[] ids)
{
var feeCount = await TenantDb.Queryable<FeeRecord>().Where(x => ids.Contains(x.BusinessId)).CountAsync();
//var feeCount = await TenantDb.Queryable<FeeRecord>().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<FeeRecord>().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<CM_RentIn_Detail>().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<CM_RentIn_Detail>(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
}

@ -680,25 +680,55 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService
}
/// <summary>
/// 租箱租出明细视图_列表
/// 租箱租出 待租出 明细_视图
/// </summary>
/// <param name="request"></param>
/// <param name="id"></param>
/// <returns></returns>
//public async Task<DataResult<List<VW_CM_NeedEndLease_DetailRes>>> 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<VW_CM_NeedEndLease_Detail>()
// .Where(whereList)
// .Select<VW_CM_NeedEndLease_DetailRes>().ToQueryPage(request.PageCondition);
// return data;
//}
public async Task<DataResult<List<VW_CM_RentOut_NeedRentRes>>> 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<VW_CM_RentOut_NeedRent>()
.Where(whereList)
.Select<VW_CM_RentOut_NeedRentRes>()
.ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
/// 租箱租出退租_添加箱
/// 租箱租出 待退租 明细_视图
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<DataResult<List<VW_CM_RentOut_NeedEndLeaseRes>>> 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<VW_CM_RentOut_NeedEndLease>()
.Where(whereList)
.Select<VW_CM_RentOut_NeedEndLeaseRes>().ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
/// 租箱租出_添加箱
/// </summary>
/// <param name="ids">租出明细ID</param>
/// <returns></returns>
@ -717,14 +747,14 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService
var CurrentDetailList = TenantDb.Queryable<CM_RentOut_Detail>()
.Where(a => a.Pid == id).ToList();
var OnAddDetail = TenantDb.Queryable<CM_RentOut_Detail>()
var AddCurrentStateList = TenantDb.Queryable<CM_CurrentState>()
.Where(a => ids.Contains(a.Id)).ToList();
var addList = new List<CM_RentOut_Detail>();
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<CM_RentOut_Detail>();
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));
}
/// <summary>
/// 租箱租出 待租出 明细_视图
/// 租箱租出退租_添加箱
/// </summary>
/// <param name="id"></param>
/// <param name="ids">租出明细ID</param>
/// <returns></returns>
public async Task<DataResult<List<VW_CM_RentOut_NeedRentRes>>> CM_RentOut_NeedRent_View(PageRequest request) {
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
public async Task<DataResult> 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<CM_RentOut>().Where(a => a.Id == id).First();
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = tenantDb.Queryable<VW_CM_RentOut_NeedRent>()
.Where(whereList)
.Select<VW_CM_RentOut_NeedRentRes > ()
.ToQueryPage(request.PageCondition);
return data;
}
var CurrentDetailList = TenantDb.Queryable<CM_RentOut_Detail>()
.Where(a => a.Pid == id).ToList();
/// <summary>
/// 租箱租出 待退租 明细_视图
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<DataResult<List<VW_CM_NeedEndLease_DetailRes>>> 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<VW_CM_NeedEndLease_Detail>()
.Where(whereList)
.Select<VW_CM_NeedEndLease_DetailRes>().ToQueryPage(request.PageCondition);
return data;
var OnAddDetail = TenantDb.Queryable<CM_RentOut_Detail>()
.Where(a => ids.Contains(a.Id)).ToList();
var addList = new List<CM_RentOut_Detail>();
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<CM_RentOut_Detail>();
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));
}
}

@ -111,14 +111,15 @@ public class CM_RentOut_DetailService : CMServiceBase, ICM_RentOut_DetailService
/// <returns></returns>
public async Task<DataResult> DeleteCM_RentOut_DetailAsync(params long[] ids)
{
var feeCount = await TenantDb.Queryable<FeeRecord>().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<FeeRecord>().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<FeeRecord>().Where(x => ids.Contains(x.BusinessId)).CountAsync();
var 退detail = await TenantDb.Queryable<CM_RentIn_Detail>().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<CM_RentOut_Detail>(x => ids.Contains(x.Id)).ExecuteCommandAsync();

Loading…
Cancel
Save