Commit f4f5718b authored by liudong1993's avatar liudong1993

报价单 创建订单

parent 3bad3bbb
......@@ -148,5 +148,10 @@ namespace Edu.Model.Entity.Course
/// 续费订单号
/// </summary>
public int RenewOrderId { get; set; }
/// <summary>
/// 报价单id
/// </summary>
public int OfferId { get; set; }
}
}
using Edu.AOP.CustomerAttribute;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course;
using Edu.Repository.Course;
using Edu.Repository.Log;
using Edu.Repository.User;
using System;
using System.Collections.Generic;
using System.Linq;
using VT.FW.DB;
......@@ -35,6 +38,10 @@ namespace Edu.Module.Course
/// 用户日志
/// </summary>
private readonly RB_User_ChangeLogRepository changeLogRepository = new RB_User_ChangeLogRepository();
/// <summary>
/// 账号
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// 课程处理类对象
/// </summary>
......@@ -247,14 +254,75 @@ namespace Edu.Module.Course
/// <param name="offerId"></param>
/// <param name="detailList"></param>
/// <returns></returns>
public bool SetOfferCreateOrder(int offerId, List<RB_Course_OfferDetails_ViewModel> detailList) {
public bool SetOfferCreateOrder(int offerId, List<RB_Course_OfferDetails_ViewModel> detailList, int createBy) {
var emModel = accountRepository.GetEmployeeInfo(createBy);
foreach (var item in detailList) {
//decimal uPrice = item.OriginalPrice/item
int OrderId = orderRepository.Insert(new Model.Entity.Course.RB_Order()
try
{
decimal uPrice = item.OriginalPrice / item.JoinNum;
int OrderId = orderRepository.Insert(new Model.Entity.Course.RB_Order()
{
ClassId = item.ClassId,
Class_Price = uPrice,
CommissionMoney = -1,
CreateBy = createBy,
CreateTime = DateTime.Now,
Dept_Id = emModel?.Dept_Id ?? 0,
School_Id = emModel?.School_Id ?? 0,
Group_Id = emModel?.Group_Id ?? 0,
DirectorRemark = "",
DiscountMoney = item.DiscountPrice,
EnterID = createBy,
ExtraDeductMoney = 0,
ExtraRewardMoney = 0,
GuestNum = item.JoinNum,
Income = 0,
IsCommissionGive = 0,
OrderForm = Common.Enum.Course.OrderFormEnum.Computer,
OrderId = 0,
OrderSource = Common.Enum.Course.OrderSourceEnum.Employee,
OrderState = Common.Enum.Course.OrderStateEnum.Normal,
PlatformTax = 0,
PreferPrice = item.OriginalPrice,
RectorRemark = "",
Refund = 0,
RenewOrderId = 0,
SaleRemark = item.Remark,
TeacherRemark = "",
TradeWay = Common.Enum.Course.TradeWayEnum.OnLine,
Unit_Price = uPrice,
UpdateBy = createBy,
UpdateTime = DateTime.Now,
OfferId = offerId
});
if (OrderId > 0) {
order_RemarkRepository.Insert(new Model.Entity.Course.RB_Order_Remark()
{
Id = 0,
OrderId = OrderId,
Type = 1,
Content = item.Remark,
CreateBy = createBy,
CreateTime = DateTime.Now
});
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
AccountType = emModel?.AccountType ?? 0,
Type = 2,
SourceId = OrderId,
LogContent = "由报价单自动创建订单",
School_Id = emModel?.School_Id ?? 0,
Group_Id = emModel?.Group_Id ?? 0,
CreateBy = createBy,
CreateTime = DateTime.Now
});
}
}
catch (Exception ex)
{
ClassId=item.ClassId,
Class_Price=1
});
LogHelper.Write(ex, "报价单创建订单失败,offerId:" + offerId + ",DetailsId:" + item.DetailsId + ",ClassId:" + item.ClassId);
}
}
return true;
}
......
......@@ -488,7 +488,7 @@ WHERE 1=1 {4}
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.Id,A.Account,A.Group_Id,A.School_Id,A.EmployeeName,A.UserIcon
SELECT A.Id,A.Account,A.Group_Id,A.School_Id,A.EmployeeName,A.UserIcon,A.AccountType
,IFNULL(G.GroupName,'') AS GroupName,IFNULL(s.SName,'') AS SchoolName
,IFNULL(d.DeptId,0) AS Dept_Id,IFNULL(d.DeptName,'') AS DeptName,IFNULL(p.PostId,0) AS Post_Id, IFNULL(p.PostName,'') AS PostName
FROM
......
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