Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -144,7 +144,7 @@ namespace Tnb.ProductionMgr
|
||||
item.erp_mo_pk = item.erp_mo_pk;
|
||||
item.erp_line_pk = item.erp_line_pk;
|
||||
item.erp_lineno = item.erp_lineno;
|
||||
item.unit_id = unitDic?.Id ?? item.unit_id;
|
||||
item.unit_id = unitDic?.EnCode ?? item.unit_id;
|
||||
|
||||
moList.Add(item);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Tnb.ProductionMgr
|
||||
SqlSugarPagedList<PrdMoListOuput> result = await db.Queryable<PrdMo>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => c.EnCode == DictConst.MeasurementUnit)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d) => c.Id == d.DictionaryTypeId && a.unit_id == d.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d) => c.Id == d.DictionaryTypeId && a.unit_id == d.EnCode)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => a.mo_status == e.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f) => a.mo_type == f.Id)
|
||||
.WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d, e) => a.mo_code.Contains(moCode))
|
||||
|
||||
@@ -2482,18 +2482,18 @@ namespace Tnb.ProductionMgr
|
||||
//来源erp需要调接口
|
||||
if (prdMo.mo_source == "1")
|
||||
{
|
||||
// List<DictionaryDataEntity> unitDatas = await db.Queryable<DictionaryTypeEntity>()
|
||||
// .LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||
// .Where((x, y) => x.EnCode == DictConst.MeasurementUnit && y.EnCode==report.unit_id)
|
||||
// .Select((x, y) => y)
|
||||
// .ToListAsync();
|
||||
List<DictionaryDataEntity> unitDatas = await db.Queryable<DictionaryTypeEntity>()
|
||||
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && y.EnCode==report.unit_id)
|
||||
.Select((x, y) => y)
|
||||
.ToListAsync();
|
||||
|
||||
List<string> erpExtendIds = new List<string>();
|
||||
erpExtendIds.Add(_userManager.UserId);
|
||||
erpExtendIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||
erpExtendIds.Add(report.material_id);
|
||||
erpExtendIds.Add(report.unit_id);
|
||||
// erpExtendIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
||||
// erpExtendIds.Add(report.unit_id);
|
||||
erpExtendIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
||||
|
||||
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x=>erpExtendIds.Contains(x.table_id)).ToListAsync();
|
||||
string erpCreateId = erpExtendFields.Find(x=>x.table_id==_userManager.UserId)?.user_id ?? "";
|
||||
@@ -2534,8 +2534,8 @@ namespace Tnb.ProductionMgr
|
||||
["cbmoid"] = prdMo.erp_mo_pk,
|
||||
// ["cbunitid"] = erpExtendFields.Find(x=>x.table_id==report.unit_id)?.cunitid ?? "",
|
||||
// ["cbastunitid"] = erpExtendFields.Find(x=>x.table_id==report.unit_id)?.cunitid ?? "",
|
||||
["cbunitid"] = erpExtendFields.Find(x => x.table_id == report.unit_id)?.cunitid ?? "",
|
||||
["cbastunitid"] = erpExtendFields.Find(x => x.table_id == report.unit_id)?.cunitid ?? "",
|
||||
["cbunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x=>x.EnCode==report.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["cbastunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x=>x.EnCode==report.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["nbplanwrnum"] = report.reported_qty,
|
||||
["nbwrnum"] = report.reported_qty,
|
||||
["tbendtime"] = nowStr,
|
||||
@@ -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 "入库任务下发成功";
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user