|
|
|
@ -31,6 +31,7 @@ using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
|
using DS.WMS.Core.Fee.Method;
|
|
|
|
|
using Org.BouncyCastle.Ocsp;
|
|
|
|
|
using Masuit.Tools;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.ContainerManagement.Info.Method;
|
|
|
|
|
|
|
|
|
@ -113,10 +114,6 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService
|
|
|
|
|
|
|
|
|
|
填充明细空白字段(ref req);
|
|
|
|
|
|
|
|
|
|
req.Ctntotal = "";
|
|
|
|
|
|
|
|
|
|
var ch = new CtnTotalHelper();
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
if (req.Id == 0)
|
|
|
|
|
{
|
|
|
|
@ -129,18 +126,20 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService
|
|
|
|
|
}
|
|
|
|
|
data.Billno = sequence.Data;
|
|
|
|
|
|
|
|
|
|
if (req.BodyList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//var ctnList = await tenantDb.Queryable<CM_RentIn_Detail>().Where(x => x.pid == req.Id.ToString()).ToListAsync();
|
|
|
|
|
foreach (var item in req.BodyList)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ch.Add(item.Ctnall);
|
|
|
|
|
var ch = new CtnTotalHelper2<List<CM_RentIn_DetailReq>>(req.BodyList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
data.Ctntotal = ch.GetCtnTotalStr();
|
|
|
|
|
|
|
|
|
|
data.Ctntotal = ch.GetStr();
|
|
|
|
|
if (data.RentDirectId == CMRentDirectEnum.租入) {
|
|
|
|
|
data.PickupCtntotal = ch.Get已提箱Str();
|
|
|
|
|
data.PickupRemainCtntotal = ch.Get未提箱Str();
|
|
|
|
|
}
|
|
|
|
|
if (data.RentDirectId == CMRentDirectEnum.租入退租)
|
|
|
|
|
{
|
|
|
|
|
data.DropoffCtntotal = ch.Get已还箱Str();
|
|
|
|
|
data.DropoffRemainCtntotal = ch.Get未还箱Str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
|
|
|
|
|
var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync();
|
|
|
|
@ -171,18 +170,20 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService
|
|
|
|
|
|
|
|
|
|
info = req.Adapt(info);
|
|
|
|
|
|
|
|
|
|
if (req.BodyList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//var ctnList = await tenantDb.Queryable<CM_RentIn_Detail>().Where(x => x.pid == req.Id.ToString()).ToListAsync();
|
|
|
|
|
foreach (var item in req.BodyList)
|
|
|
|
|
{
|
|
|
|
|
var ch = new CtnTotalHelper2<List<CM_RentIn_DetailReq>>(req.BodyList);
|
|
|
|
|
|
|
|
|
|
ch.Add(item.Ctnall);
|
|
|
|
|
info.Ctntotal = ch.GetCtnTotalStr();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (info.RentDirectId == CMRentDirectEnum.租入)
|
|
|
|
|
{
|
|
|
|
|
info.PickupCtntotal = ch.Get已提箱Str();
|
|
|
|
|
info.PickupRemainCtntotal = ch.Get未提箱Str();
|
|
|
|
|
}
|
|
|
|
|
if (info.RentDirectId == CMRentDirectEnum.租入退租)
|
|
|
|
|
{
|
|
|
|
|
info.DropoffCtntotal = ch.Get已还箱Str();
|
|
|
|
|
info.DropoffRemainCtntotal = ch.Get未还箱Str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
info.Ctntotal = ch.GetStr();
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable(info).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
@ -347,47 +348,20 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService
|
|
|
|
|
|
|
|
|
|
var body = tenantDb.Queryable<CM_RentIn_Detail>().Where(a => a.Pid == data.Id).ToList();
|
|
|
|
|
|
|
|
|
|
//20240808 首先判断该箱号能否执行确认
|
|
|
|
|
var ch = new CtnTotalHelper2<List<CM_RentIn_Detail>>(body);
|
|
|
|
|
|
|
|
|
|
//if (!string.IsNullOrWhiteSpace(data.BillState))
|
|
|
|
|
//{
|
|
|
|
|
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
//}
|
|
|
|
|
data.Ctntotal = ch.GetCtnTotalStr();
|
|
|
|
|
|
|
|
|
|
var 已提箱 = new CtnTotalHelper();
|
|
|
|
|
var 未提箱 = new CtnTotalHelper();
|
|
|
|
|
//var 已还箱 = new CtnTotalHelper();
|
|
|
|
|
//var 未还箱 = new CtnTotalHelper();
|
|
|
|
|
if (body.Count > 0)
|
|
|
|
|
if (data.RentDirectId == CMRentDirectEnum.租入)
|
|
|
|
|
{
|
|
|
|
|
//var ctnList = await tenantDb.Queryable<CM_RentIn_Detail>().Where(x => x.pid == req.Id.ToString()).ToListAsync();
|
|
|
|
|
foreach (var item in body) {
|
|
|
|
|
|
|
|
|
|
if (item.PickupDate == null)
|
|
|
|
|
{
|
|
|
|
|
未提箱.Add(item.Ctnall);
|
|
|
|
|
}
|
|
|
|
|
if (item.PickupDate != null)
|
|
|
|
|
{
|
|
|
|
|
已提箱.Add(item.Ctnall);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (item.PickupDate != null && item.DropoffDate == null)
|
|
|
|
|
//{
|
|
|
|
|
// 未还箱.Add(item.Ctnall);
|
|
|
|
|
//}
|
|
|
|
|
//if (item.PickupDate != null && item.DropoffDate != null)
|
|
|
|
|
//{
|
|
|
|
|
// 已还箱.Add(item.Ctnall);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
data.PickupCtntotal = ch.Get已提箱Str();
|
|
|
|
|
data.PickupRemainCtntotal = ch.Get未提箱Str();
|
|
|
|
|
}
|
|
|
|
|
if (data.RentDirectId == CMRentDirectEnum.租入退租)
|
|
|
|
|
{
|
|
|
|
|
data.DropoffCtntotal = ch.Get已还箱Str();
|
|
|
|
|
data.DropoffRemainCtntotal = ch.Get未还箱Str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.PickupCtntotal = 已提箱.GetStr();
|
|
|
|
|
data.PickupRemainCtntotal = 未提箱.GetStr();
|
|
|
|
|
//data.DropoffCtntotal = 已还箱.GetStr();
|
|
|
|
|
//data.DropoffRemainCtntotal = 未还箱.GetStr();
|
|
|
|
|
|
|
|
|
|
data.BillState = "Confirm";
|
|
|
|
|
//data.IsBusinessLocking = true;
|
|
|
|
@ -547,6 +521,30 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService
|
|
|
|
|
|
|
|
|
|
//20240826 向原租入明细中写入提箱相关信息
|
|
|
|
|
await tenantDb.Updateable(RentInDetailList.First(x => x.Id == detail.RentDetailId)).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//20240829 向原租入业务中 更新已还箱未还箱数据
|
|
|
|
|
var headids = RentInDetailList.Where(x => x.DropoffDate != null).Select(x => x.Pid).Distinct().ToList();
|
|
|
|
|
var 原租入业务 = await tenantDb.Queryable<CM_RentIn>().Where(x => headids.Contains(x.Id)).ToListAsync();
|
|
|
|
|
|
|
|
|
|
foreach (var item in 原租入业务)
|
|
|
|
|
{
|
|
|
|
|
var _body= await tenantDb.Queryable<CM_RentIn_Detail>().Where(x => x.Pid == item.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var ch1 = new CtnTotalHelper2<List<CM_RentIn_Detail>>(_body);
|
|
|
|
|
|
|
|
|
|
item.Ctntotal = ch1.GetCtnTotalStr();
|
|
|
|
|
|
|
|
|
|
item.PickupCtntotal = ch1.Get已提箱Str();
|
|
|
|
|
item.PickupRemainCtntotal = ch1.Get未提箱Str();
|
|
|
|
|
|
|
|
|
|
item.DropoffCtntotal = ch1.Get已还箱Str();
|
|
|
|
|
item.DropoffRemainCtntotal = ch1.Get未还箱Str();
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable(item).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -619,20 +617,7 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService
|
|
|
|
|
return await Task.FromResult(DataResult.Failed("添加失败!", MultiLanguageConst.CM_CanNotMakeFee));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
//var newFee = new FeeRecord();
|
|
|
|
|
|
|
|
|
|
//newFee.Id = 0;
|
|
|
|
|
//newFee.FeeType = FeeType.Payable;
|
|
|
|
|
//newFee.FeeName = "提箱费";
|
|
|
|
|
//newFee.TaxUnitPrice = 10;
|
|
|
|
|
//newFee.Amount = 10;
|
|
|
|
|
//newFee.TaxRate = 0;
|
|
|
|
|
//newFee.Quantity = 1;
|
|
|
|
|
|
|
|
|
|
//var feeDetail = new List<FeeRecord>();
|
|
|
|
|
//feeDetail.Add(newFee);
|
|
|
|
|
|
|
|
|
|
//return await _feeService.SaveAsync(feeDetail);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//租入生成提箱费
|
|
|
|
|
//退租生成还箱费
|
|
|
|
@ -866,6 +851,16 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService
|
|
|
|
|
if (addList != null && addList.Count > 0) {
|
|
|
|
|
await TenantDb.Insertable(addList).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var _body = await TenantDb.Queryable<CM_RentIn_Detail>().Where(a => a.Pid == id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var ch = new CtnTotalHelper2<List<CM_RentIn_Detail>>(_body);
|
|
|
|
|
|
|
|
|
|
head.Ctntotal = ch.GetCtnTotalStr();
|
|
|
|
|
head.DropoffCtntotal = ch.Get已还箱Str();
|
|
|
|
|
head.DropoffRemainCtntotal = ch.Get未还箱Str();
|
|
|
|
|
|
|
|
|
|
await TenantDb.Updateable(head).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("添加成功!", id, MultiLanguageConst.DataCreateSuccess);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|