Commit 3fcb3c64 authored by 吴春's avatar 吴春

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents ee4be693 6a883d3d
......@@ -298,5 +298,10 @@ namespace Edu.Model.Entity.Course
/// 目标订单编号
/// </summary>
public int TargetOrderId { get; set; }
/// <summary>
/// 最开始拆分订单的订单编号【最原始的订单编号】
/// </summary>
public int FirstOrderId { get; set; }
}
}
......@@ -868,15 +868,76 @@ namespace Edu.Module.EduTask
/// 回归原班上课
/// </summary>
/// <returns></returns>
public bool RegressSourceClassModule(int OrderId, int GuestId,int oldOrderId)
public bool RegressSourceClassModule(int OrderId, int GuestId,int oldOrderId,int oldGuestId)
{
bool flag = false;
var oldOrder = orderRepository.GetEntity(oldOrderId);
var order = orderRepository.GetEntity(OrderId);
var guest = guestRepository.GetEntity(GuestId);
var oldGuest = guestRepository.GetEntity(oldGuestId);
var classList = classRepository.GetClassListRepository(new RB_Class_ViewModel()
{
Q_ClassIds = oldOrder.ClassId + "," + order.ClassId
});
var oldClassModel = classList?.Where(qitem => qitem.ClassId == oldOrder.ClassId)?.FirstOrDefault() ?? new RB_Class_ViewModel();
var newClassModel = classList?.Where(qitem => qitem.ClassId == order.ClassId)?.FirstOrDefault() ?? new RB_Class_ViewModel();
//原业务员
var userInfo = UserReidsCache.GetUserLoginInfo(oldOrder.EnterID);
if (guest.TotalHours != guest.CompleteHours)
{
//生成收支相抵单据
//剩余课时
var surplus = guest.TotalHours - guest.CompleteHours;
//更新老订单学员课时
Dictionary<string, object> oldGuestFileds = new Dictionary<string, object>()
{
{nameof(RB_Order_Guest_Extend.TotalHours),oldGuest.TotalHours+surplus }
};
flag= guestRepository.Update(oldGuestFileds, new WhereHelper(nameof(RB_Order_Guest_Extend.Id), GuestId));
Dictionary<string, object> newGuestFileds = new Dictionary<string, object>()
{
{nameof(RB_Order_Guest_Extend.TotalHours),guest.CompleteHours }
};
//更新新订单学员课时
flag= guestRepository.Update(newGuestFileds, new WhereHelper(nameof(RB_Order_Guest_Extend.Id), oldGuestId));
var refundMoney = Math.Round(order.Unit_Price * surplus, 2);
var outlay = new OrderChangeFinace()
{
ChangeType = 2,
ClassId = order.ClassId,
GuestId = GuestId,
OrderId = order.OrderId,
GuestName = guest.GuestName,
InCome = refundMoney,
ClassName = newClassModel.ClassName,
Class_School_Id = newClassModel.School_Id,
ReFinanceId = 0,
SName = newClassModel.SchoolName,
UserInfo = userInfo
};
//生成支出财务单据
var RelevanceFrId = CreateExpenditure(outlay, out string msg2);
var income = new OrderChangeFinace()
{
ChangeType = 2,
ClassId = oldOrder.ClassId,
GuestId = GuestId,
OrderId = oldOrder.OrderId,
GuestName = guest.GuestName,
InCome = refundMoney,
ClassName = oldClassModel.ClassName,
Class_School_Id = oldClassModel.School_Id,
ReFinanceId = RelevanceFrId,
SName = oldClassModel.SchoolName,
UserInfo = userInfo
};
//生成收入财务单据
CreateInCome(income, out string msg);
}
......
......@@ -82,7 +82,9 @@ namespace Edu.WebApi.Controllers.Course
item.Status,
item.OtherCourseList,
item.ClassNo,
item.FinishTimeStr
item.FinishTimeStr,
item.UsePlanNum,
item.TotalPlanNum,
});
}
pageModel.Count = rowsCount;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment