|
@@ -587,38 +587,32 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task LogAverageOrder(string userId, Scheduling scheduling, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- //1.获取默认派单员所属的工单
|
|
|
- //2.获取今天上班的人员
|
|
|
- //3.给当前这个用户平均派单
|
|
|
-
|
|
|
- var steps = await _workflowDomainService.GetStepsBelongsToAsync(AppDefaults.SendPoolId,
|
|
|
- cancellationToken);
|
|
|
- var roleId = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue[0];
|
|
|
-
|
|
|
- var user = await _userRepository.Queryable()
|
|
|
- .Includes(d => d.Organization)
|
|
|
- .FirstAsync(d => d.Id == userId, cancellationToken);
|
|
|
- var time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
- var schedulings = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
- .Where(x => x.SchedulingTime == time).CountAsync(cancellationToken);
|
|
|
- if (schedulings > 0)
|
|
|
- {
|
|
|
+ //1.获取默认派单员所属的工单
|
|
|
+ //2.获取今天上班的人员
|
|
|
+ //3.给当前这个用户平均派单
|
|
|
+
|
|
|
+ var steps = await _workflowDomainService.GetStepsBelongsToAsync(AppDefaults.SendPoolId,
|
|
|
+ cancellationToken);
|
|
|
+ var roleId = _systemSettingCacheManager.GetSetting(SettingConstants.RolePaiDan)?.SettingValue[0];
|
|
|
+
|
|
|
+ var user = await _userRepository.Queryable()
|
|
|
+ .Includes(d => d.Organization)
|
|
|
+ .FirstAsync(d => d.Id == userId, cancellationToken);
|
|
|
+ var time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
+ var schedulings = await _schedulingRepository.Queryable().Includes(x => x.SchedulingUser)
|
|
|
+ .Where(x => x.SchedulingTime == time).CountAsync(cancellationToken);
|
|
|
+ if (schedulings > 0)
|
|
|
+ {
|
|
|
var sendNum = steps.Count / schedulings;
|
|
|
- scheduling.SendOrderNum += sendNum;
|
|
|
if (!scheduling.LoginSendOrderNum.HasValue)
|
|
|
{
|
|
|
scheduling.LoginSendOrderNum = scheduling.LoginSendOrderNum.HasValue && scheduling.LoginSendOrderNum > sendNum ? scheduling.LoginSendOrderNum : sendNum;
|
|
|
- await _schedulingRepository.Updateable()
|
|
|
- .SetColumns(s => new Scheduling() { LoginSendOrderNum = scheduling.LoginSendOrderNum })
|
|
|
- .Where(s => s.SchedulingTime == scheduling.SchedulingTime).ExecuteCommandAsync(cancellationToken);
|
|
|
+ await _schedulingRepository.Updateable().SetColumns(s => new Scheduling() { LoginSendOrderNum = scheduling.LoginSendOrderNum }).Where(s => s.SchedulingTime == scheduling.SchedulingTime).ExecuteCommandAsync(cancellationToken);
|
|
|
}
|
|
|
sendNum = scheduling.LoginSendOrderNum.Value;
|
|
|
- await _schedulingRepository.Updateable()
|
|
|
- .SetColumns(s => new Scheduling() { SendOrderNum = scheduling.SendOrderNum, AtWork = scheduling.AtWork })
|
|
|
- .Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
-
|
|
|
if (sendNum <= 0) return;
|
|
|
var sendSteps = steps.Take(sendNum).ToList();
|
|
|
+ await _schedulingRepository.Updateable().SetColumns(s => new Scheduling() { AtWork = scheduling.AtWork }).Where(s => s.Id == scheduling.Id).ExecuteCommandAsync(cancellationToken);
|
|
|
await _orderRepository.Updateable().SetColumns(o => new Order()
|
|
|
{
|
|
|
CenterToOrgHandlerId = user.OrgId,
|
|
@@ -631,7 +625,7 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
|
|
|
}, cancellationToken);
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 触发平均派单
|