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)

View File

@@ -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
{ /// <summary>
@@ -99,6 +100,8 @@ namespace Tnb.QcMgr
{ "await", "待检" },
{ "temporarily", "暂控" }
};
PositionEntity positionEntity = await db.Queryable<PositionEntity>().Where(x=>x.Id==_userManager.User.PositionId).FirstAsync();
Dictionary<string, string>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : "";
string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : "";
@@ -117,6 +120,9 @@ namespace Tnb.QcMgr
.LeftJoin<UserEntity>((a, b, c, d, e) => a.execuser == e.Id)
.LeftJoin<PrdMoTask>((a,b,c,d,e,f)=>a.mo_task_code==f.mo_task_code)
.LeftJoin<EqpEquipment>((a,b,c,d,e,f,g)=>f.eqp_id==g.id)
.LeftJoin<OrganizeEntity>((a,b,c,d,e,f,g,h)=>d.OrganizeIdTree.Contains(h.Id) && h.Category == DictConst.RegionCategoryWorklineCode)
.LeftJoin<PositionEntity>((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)

View File

@@ -70,6 +70,7 @@ namespace Tnb.WarehouseMgr
BasLocation endLocation = await _db.Queryable<BasLocation>().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);