This commit is contained in:
2024-09-05 16:53:51 +08:00
parent 28173f6759
commit 2a3a8aff11
4 changed files with 20 additions and 3 deletions

View File

@@ -2632,8 +2632,8 @@ namespace Tnb.ProductionMgr
}
catch (Exception e)
{
Log.Error("提报入库任务下发失败", e);
throw new Exception("提报入库任务下发失败");
Log.Error("提报入库任务下发失败:"+e.Message, e);
throw new Exception("提报入库任务下发失败:"+e.Message);
}
return "入库任务下发成功";

View File

@@ -8,6 +8,7 @@ using JNPF.DynamicApiController;
using JNPF.FriendlyException;
using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Entitys.System;
using JNPF.Systems.Interfaces.Permission;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Mvc;
@@ -38,13 +39,16 @@ namespace Tnb.ProductionMgr
private readonly ISqlSugarClient _db;
private readonly IDictionaryDataService _dictionaryDataService;
private readonly IUserManager _userManager;
private readonly IOrganizeService _organizeService;
private static Dictionary<string, Tuple<string, string>> _dicWorkLine = new();
public PrdPackReportService(ISqlSugarRepository<PrdMoTask> repository,
IUserManager userManager,
IOrganizeService organizeService,
IDictionaryDataService dictionaryDataService)
{
_db = repository.AsSugarClient();
_userManager = userManager;
_organizeService = organizeService;
_dictionaryDataService = dictionaryDataService;
}
/// <summary>
@@ -417,6 +421,8 @@ namespace Tnb.ProductionMgr
}
string userId = _userManager.UserId;
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(_userManager.User.OrganizeId,DictConst.RegionCategoryWorklineCode);
string userWorklineId = workline?.Id ?? "";
string nowTime = DateTime.Now.ToString("HH:mm");
BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DAYNIGHTWORKTIME);
Dictionary<string,string> dayNightWorkTime = JsonConvert.DeserializeObject<Dictionary<string, string>>(config.value);
@@ -464,7 +470,8 @@ namespace Tnb.ProductionMgr
.WhereIF(statusList.Count > 0, a => statusList.Contains(a.mo_task_status))
.WhereIF(status == "3" && start_time != null, a => a.act_end_date >= start_time)
.WhereIF(status == "3" && end_time != null, a => a.act_end_date <= end_time)
.Where((a, b, c, d, e, f, g, h, j, k, l,m)=>(m.ManagerId==userId)
.WhereIF(!_userManager.IsAdministrator,(a, b, c, d, e, f, g, h, j, k, l,m)=>(m.ManagerId==userId)
|| (j.mo_type==DictConst.PrdMoTypeBZ && !SqlFunc.IsNullOrEmpty(userWorklineId) && a.workline_id==userWorklineId)
|| (a.schedule_type==1 && a.mo_task_status==DictConst.ToBeStartedEnCode && moldUserIds.Contains(userId))
|| (a.scheduling_class_type=="1" && twoDayFlag && a.dayshift_worker_id==userId)
|| (a.scheduling_class_type=="1" && twoNightFlag && a.nightshift_worker_id==userId)