diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 1d8c1d95..0cba0aad 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -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 "入库任务下发成功"; diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs index 0994360f..743a6227 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs @@ -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> _dicWorkLine = new(); public PrdPackReportService(ISqlSugarRepository repository, IUserManager userManager, + IOrganizeService organizeService, IDictionaryDataService dictionaryDataService) { _db = repository.AsSugarClient(); _userManager = userManager; + _organizeService = organizeService; _dictionaryDataService = dictionaryDataService; } /// @@ -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().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DAYNIGHTWORKTIME); Dictionary dayNightWorkTime = JsonConvert.DeserializeObject>(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) diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs index 57a6ca24..c7aa2a83 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs @@ -14,6 +14,7 @@ using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; using Tnb.ProductionMgr.Entities; using Tnb.QcMgr.Entities; +using Tnb.BasicData; namespace Tnb.QcMgr { /// @@ -99,6 +100,8 @@ namespace Tnb.QcMgr { "await", "待检" }, { "temporarily", "暂控" } }; + + PositionEntity positionEntity = await db.Queryable().Where(x=>x.Id==_userManager.User.PositionId).FirstAsync(); Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : ""; string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : ""; @@ -117,6 +120,9 @@ namespace Tnb.QcMgr .LeftJoin((a, b, c, d, e) => a.execuser == e.Id) .LeftJoin((a,b,c,d,e,f)=>a.mo_task_code==f.mo_task_code) .LeftJoin((a,b,c,d,e,f,g)=>f.eqp_id==g.id) + .LeftJoin((a,b,c,d,e,f,g,h)=>d.OrganizeIdTree.Contains(h.Id) && h.Category == DictConst.RegionCategoryWorklineCode) + .LeftJoin((a,b,c,d,e,f,g,h,i)=>h.Id==i.OrganizeId) + .WhereIF(_userManager.LoginType=="app" && !_userManager.IsAdministrator,(a,b,c,d,e,f,g,h,i)=>i.EnCode==positionEntity.EnCode) .WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid) .WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype) .WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSterilizationInstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSterilizationInstockHService.cs index cd4c9543..b61eac0d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSterilizationInstockHService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSterilizationInstockHService.cs @@ -70,6 +70,7 @@ namespace Tnb.WarehouseMgr BasLocation endLocation = await _db.Queryable().Where(r => r.id == input.wmsDistaskH.endlocation_id).FirstAsync(); string outWhid = ""; + string inWhid = ""; string outDeptid = ""; string outDeptvid = ""; string inDeptid = ""; @@ -80,6 +81,7 @@ namespace Tnb.WarehouseMgr if (endLocation.wh_id == WmsWareHouseConst.WAREHOUSE_MJC_ID) { outWhid = WmsWareHouseConst.bipwarehouseid_bz; + inWhid = WmsWareHouseConst.bipwarehouseid_mj; outDeptid = WmsWareHouseConst.sichangqushengchanbu_id; outDeptvid = WmsWareHouseConst.sichangqushengchanbu_vid; inDeptid = WmsWareHouseConst.sichangqucangku_id; @@ -91,6 +93,7 @@ namespace Tnb.WarehouseMgr else if (endLocation.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID) { outWhid = WmsWareHouseConst.bipwarehouseid_mj; + inWhid = WmsWareHouseConst.bipwarehouseid_cp; outDeptid = WmsWareHouseConst.sichangqucangku_id; outDeptvid = WmsWareHouseConst.sichangqucangku_vid; inDeptid = WmsWareHouseConst.sichangqucangku_id; @@ -145,6 +148,7 @@ namespace Tnb.WarehouseMgr erpRequestData.Add("creationtime", nowStr); erpRequestData.Add("creator", erpCreateId); erpRequestData.Add("cwarehouseid", outWhid);//先写死 + erpRequestData.Add("cotherwhid", inWhid);//先写死 erpRequestData.Add("dbilldate", wmsRawmatTransferoutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")); erpRequestData.Add("dmakedate", nowStr); erpRequestData.Add("dshldarrivedate", nowStr);