diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonTypeService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonTypeService.cs index 26ac4ea8..51ed758a 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonTypeService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonTypeService.cs @@ -5,6 +5,7 @@ using JNPF.DynamicApiController; using JNPF.Systems.Entitys.Permission; using Microsoft.AspNetCore.Mvc; using SqlSugar; +using Tnb.BasicData; using Tnb.BasicData.Entities; using Tnb.EquipMgr.Interfaces; using Tnb.ProductionMgr.Entities; @@ -36,7 +37,7 @@ namespace Tnb.ProductionMgr { andon_type_id = a.id, andon_type_name = a.name, - record_count = SqlFunc.Subqueryable().Where(x=>x.andon_type_id==a.id).Count(), + record_count = SqlFunc.Subqueryable().Where(x=>x.andon_type_id==a.id && x.status==DictConst.AndonStatusHJZ).Count(), }).ToListAsync(); return result; } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index ece210a1..200f5dba 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -2225,6 +2225,78 @@ namespace Tnb.ProductionMgr } + /// + /// 获取组装包装生产排产甘特图信息 + /// + /// + [HttpPost] + public async Task GetGanntInfo1() + { + var db = _repository.AsSugarClient(); + Dictionary result = new Dictionary(); + var listRows = await db.Queryable() + .LeftJoin((a,b)=>a.equip_type_id==b.id) + .Where((a,b)=>b.code=="ZSJ" || b.code=="005") + .OrderBy((a,b)=>b.code) + .Select((a,b) => new + { + id = a.id, + expanded = true, + label = a.name, + parentId = "" + }).ToListAsync(); + + DateTime startTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year,DateTime.Now.Month,1).AddDays(-15).ToString("yyyy-MM-dd 00:00:00")); + DateTime endTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year,DateTime.Now.Month,1).AddMonths(1).AddDays(-1).AddDays(15).ToString("yyyy-MM-dd 23:59:59")); + var charItems = await db.Queryable() + .LeftJoin((a, b) => a.material_id == b.id) + .LeftJoin((a,b,c)=>c.DictionaryTypeId==DictConst.PrdTaskStatusTypeId && a.mo_task_status==c.EnCode) + .Where((a, b) => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.ToBeScheduledEncode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.InProgressEnCode) + .Where((a,b)=>a.schedule_type==1 && string.IsNullOrEmpty(a.parent_id)) + .Where((a,b)=>a.estimated_start_date!=null && a.estimated_end_date!=null) + .Where((a,b)=>a.estimated_start_date>=startTime && a.estimated_end_date<=endTime) + .Select((a, b,c) => new + { + id = a.id, + label = b.name, + material_name = b.name, + reported_work_qty = a.reported_work_qty==null ? 0 : a.reported_work_qty, + scheduled_qty = a.scheduled_qty, + mo_task_status = c.FullName, + // label = b.name +" " +(a.reported_work_qty==null?0:a.reported_work_qty)+"/"+a.scheduled_qty + " " +c.FullName, + rowId = a.eqp_id, + time = new GanntTime + { + start = a.estimated_start_date, + end = a.estimated_end_date + }, + //linkedWith = SqlFunc.Subqueryable().Where(x=>a.schedule_type==2 && string.IsNullOrEmpty(a.parent_id) && a.workline_id==x.workline_id && (x.mo_task_status==DictConst.ToBeStartedEnCode || x.mo_task_status==DictConst.MoStatusPauseCode || x.mo_task_status==DictConst.ToBeScheduledEncode)).ToList(x=>x.id), + tips = new GanntTimeTips + { + // material_code = b.code, + // material_name = b.name, + mo_task_code = a.mo_task_code, + // start_time = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"), + // end_time = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"), + start_time = a.estimated_start_date, + end_time = a.estimated_end_date, + } + }) + .ToListAsync(); + // DateTime min = (DateTime)charItems.Min(x => x.time.start); + TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks); + TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(startTime.ToString("yyyy-MM-dd")).Ticks); + TimeSpan ts3 = ts1.Subtract(ts2).Duration(); + + + result.Add("listRows",listRows); + result.Add("charItems",charItems); + result.Add("startTime",startTime); + result.Add("endTime",endTime); + result.Add("totalDays",ts3.TotalDays); + return result; + } + /// /// 获取组装包装生产排产甘特图信息 /// @@ -2296,6 +2368,49 @@ namespace Tnb.ProductionMgr return result; } + /// + /// 保存注塑挤出生产排产甘特图信息 + /// + /// + [HttpPost] + public async Task SaveData1(List input) + { + var db = _repository.AsSugarClient(); + DbResult result = await db.Ado.UseTranAsync(async () => + { + foreach (var item in input) + { + + // if(await db.Queryable().Where(x=>x.Id==item.row_id && x.Category==DictConst.RegionCategoryWorkshopCode).AnyAsync()) + // throw Oops.Bah("不能排在车间上"); + var prdMoTask = await db.Queryable().SingleAsync(x => x.id == item.id); + if (prdMoTask.eqp_id != item.row_id) + { + await db.Updateable() + .SetColumns(x=>x.workline_id == item.row_id) + .Where(x=>x.id==item.id).ExecuteCommandAsync(); + } + + if (prdMoTask.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm") != item.time.start.Value.ToString("yyyy-MM-dd HH:mm")) + { + await db.Updateable() + .SetColumns(x=>x.estimated_start_date==item.time.start) + .Where(x=>x.id==item.id).ExecuteCommandAsync(); + } + + if (prdMoTask.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm")!=item.time.end.Value.ToString("yyyy-MM-dd HH:mm")) + { + await db.Updateable() + .SetColumns(x=>x.estimated_end_date==item.time.end) + .Where(x=>x.id==item.id).ExecuteCommandAsync(); + } + } + }); + if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); + + return result.IsSuccess ? "排产成功" : result.ErrorMessage; + } + /// /// 保存组装包装生产排产甘特图信息 /// diff --git a/apihost/Tnb.API.Entry/Configurations/Tenant.json b/apihost/Tnb.API.Entry/Configurations/Tenant.json index a1df638e..f8ca747a 100644 --- a/apihost/Tnb.API.Entry/Configurations/Tenant.json +++ b/apihost/Tnb.API.Entry/Configurations/Tenant.json @@ -1,6 +1,7 @@ { "Tenant": { "MultiTenancy": false, - "MultiTenancyDBInterFace": "http://www.tuotong-tech.com/api/Saas/Tenant/DbContent/" + "MultiTenancyDBInterFace": "http://www.tuotong-tech.com/api/Saas/Tenant/DbContent/", + "MultiTenancyType": "" } } \ No newline at end of file