|
@@ -23,8 +23,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
private readonly SetDataRepository _setDataRepository;
|
|
|
private readonly UsersRepository _usersRepository;
|
|
|
|
|
|
- public DelegationInfoRepository(SqlSugarClient sqlSugar, SetDataRepository setDataRepository, UsersRepository usersRepository)
|
|
|
- : base(sqlSugar)
|
|
|
+ public DelegationInfoRepository(SqlSugarClient sqlSugar, SetDataRepository setDataRepository, UsersRepository usersRepository)
|
|
|
+ : base(sqlSugar)
|
|
|
{
|
|
|
this._setDataRepository = setDataRepository;
|
|
|
this._usersRepository = usersRepository;
|
|
@@ -37,7 +37,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
/// <returns></returns>
|
|
|
public async Task<Result> GetGroupList(GroupListDto dto)
|
|
|
{
|
|
|
- Result result = new Result() { Code = -2,Msg="未知错误" };
|
|
|
+ Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
|
|
|
if (dto.PortType == 1) //web
|
|
|
{
|
|
@@ -49,7 +49,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
Left Join Sys_Users su On gdi.JietuanOperator = su.Id
|
|
|
Where gdi.IsDel = 0
|
|
|
Order By VisitDate Desc");
|
|
|
-
|
|
|
+
|
|
|
var _DelegationList = await _sqlSugar.SqlQueryable<DelegationListView>(sql).ToListAsync();
|
|
|
if (_DelegationList.Count > 0)
|
|
|
{
|
|
@@ -63,13 +63,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 获取接团信息Info
|
|
|
/// </summary>
|
|
@@ -85,9 +83,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
ClientUnit,VisitCountry,VisitDate,VisitDays,VisitPNumber,TontractTime,
|
|
|
PayDay,PaymentMoney,VisitPurpose,SpecialNeeds,OtherNeeds,CGRWSPBMMC,CGRWSPWH,
|
|
|
ZZSCBMMC,ZZSCSPWH,Remark,TellPhone
|
|
|
- From Grp_DelegationInfo Where Id = {0} And IsDel=0",dto.Id);
|
|
|
+ From Grp_DelegationInfo Where Id = {0} And IsDel = 0", dto.Id);
|
|
|
|
|
|
- var _DelegationInfo = await _sqlSugar.SqlQueryable<DelegationInfoWebView>(sql).ToListAsync();
|
|
|
+ var _DelegationInfo = await _sqlSugar.SqlQueryable<DelegationInfoWebView>(sql).FirstAsync();
|
|
|
if (_DelegationInfo != null)
|
|
|
{
|
|
|
result.Code = 0;
|
|
@@ -110,7 +108,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<Result> GetGroupEditBasicSource(GroupListDto dto)
|
|
|
+ public async Task<Result> GroupEditBasicSource(GroupListDto dto)
|
|
|
{
|
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
|
|
@@ -142,7 +140,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
result.Code = 0;
|
|
|
result.Msg = "成功!";
|
|
|
- result.Data = new {
|
|
|
+ result.Data = new
|
|
|
+ {
|
|
|
teamTypeData = teamTypeData1,
|
|
|
teamLevData = teamLevData1,
|
|
|
userData = userData1
|
|
@@ -199,7 +198,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
And TeamName = '{1}'
|
|
|
And ClientName = '{2}'
|
|
|
And ClientUnit ='{3}'
|
|
|
- And VisitDate ='{4}'",dto.SalesQuoteNo,dto.TeamName,dto.ClientName,dto.ClientUnit,dto.VisitDate);
|
|
|
+ And VisitDate ='{4}'", dto.SalesQuoteNo, dto.TeamName, dto.ClientName, dto.ClientUnit, dto.VisitDate);
|
|
|
var selectGroupInfo = await _sqlSugar.SqlQueryable<Grp_DelegationInfo>(selectSql).FirstAsync();
|
|
|
if (selectGroupInfo != null)
|
|
|
{
|
|
@@ -208,13 +207,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
|
|
|
string teamCodeSql = string.Format("Select TourCode From Grp_DelegationInfo");
|
|
|
- var teamCodeItem = await _sqlSugar.SqlQueryable<TeamCodeView>(teamCodeSql).FirstAsync();
|
|
|
+ var teamCodeItem = await _sqlSugar.SqlQueryable<TeamCodeView>(teamCodeSql).ToListAsync();
|
|
|
|
|
|
string teamCode = "";
|
|
|
while (true)
|
|
|
{
|
|
|
teamCode = Tools.CommonFun.GetRandomAllStr(6);
|
|
|
-
|
|
|
+
|
|
|
if (!teamCodeItem.Equals(teamCode))
|
|
|
{
|
|
|
break;
|
|
@@ -249,10 +248,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
|
|
|
|
|
|
- }
|
|
|
- else if (dto.Status == 2) //修改
|
|
|
+ } //增加
|
|
|
+ else if (dto.Status == 2) //修改
|
|
|
{
|
|
|
- var updateStatus = await UpdateAsync(a => a.Id == dto.Id,a=> groupInfo);
|
|
|
+ var updateStatus = await UpdateAsync(a => a.Id == dto.Id, a => groupInfo);
|
|
|
|
|
|
if (updateStatus)
|
|
|
{
|
|
@@ -264,9 +263,85 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
result.Msg = "修改失败!";
|
|
|
}
|
|
|
}
|
|
|
+ else if (dto.Status == 3) //删除
|
|
|
+ {
|
|
|
+ var deleteStatus = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_DelegationInfo {
|
|
|
+ DeleteUserId = dto.UserId,
|
|
|
+ DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
+ IsDel = 1
|
|
|
+ });
|
|
|
+
|
|
|
+ if (deleteStatus)
|
|
|
+ {
|
|
|
+ result.Code = 0;
|
|
|
+ result.Msg = "删除成功!";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result.Msg = "删除失败!";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取销售报价号
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> GetGroupSalesQuoteNo()
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
+
|
|
|
+ string teamCodeSql = string.Format("Select TourCode From Grp_DelegationInfo");
|
|
|
+ var teamCodeItem = await _sqlSugar.SqlQueryable<TeamCodeView>(teamCodeSql).ToListAsync();
|
|
|
+
|
|
|
+ string teamCode = "";
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ teamCode = Tools.CommonFun.GetRandomAllStr(6);
|
|
|
+
|
|
|
+ if (!teamCodeItem.Equals(teamCode))
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ result.Code = 0;
|
|
|
+ result.Msg = "成功!";
|
|
|
+ result.Data = teamCode;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 团组删除
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> GroupDeleteById()
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
+
|
|
|
+ string teamCodeSql = string.Format("Select TourCode From Grp_DelegationInfo");
|
|
|
+ var teamCodeItem = await _sqlSugar.SqlQueryable<TeamCodeView>(teamCodeSql).ToListAsync();
|
|
|
+
|
|
|
+ string teamCode = "";
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ teamCode = Tools.CommonFun.GetRandomAllStr(6);
|
|
|
+
|
|
|
+ if (!teamCodeItem.Equals(teamCode))
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ result.Code = 0;
|
|
|
+ result.Msg = "成功!";
|
|
|
+ result.Data = teamCode;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|