diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ZlBiOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ZlBiOutput.cs new file mode 100644 index 00000000..a1f83e57 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ZlBiOutput.cs @@ -0,0 +1,46 @@ +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +{ + public class ZlBiOutput + { + public int mo_task_count { get; set; } + public int qc_all_count { get; set; } + public int qc_complete_count { get; set; } + public int qc_ok_count { get; set; } + public List qc_task_list { get; set; } + public List qc_sj_task_list { get; set; } + public List qc_xj_task_list { get; set; } + public List qc_mj_task_list { get; set; } + public List qc_lbjj_task_list { get; set; } + } + + public class ZlBiQcTaskListOutput + { + public string mo_task_code { get; set; } + public string equip_workline_name { get; set; } + public string checktype { get; set; } + public string material_name { get; set; } + /// + /// 物料规格 + /// + public string material_specification { get; set; } + + /// + /// 物料型号(箱号) + /// + public string material_standard { get; set; } + public int? qty { get; set; } + public int? rqty { get; set; } + public string result { get; set; } + public string execuser { get; set; } + public string exectime{ get; set; } + } + + public class ZlBiQcTaskDetailListOutput + { + public string mo_task_code { get; set; } + public string equip_workline_name { get; set; } + public string execuser { get; set; } + public string create_time{ get; set; } + public string checktype{ get; set; } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/BiService.cs b/ProductionMgr/Tnb.ProductionMgr/BiService.cs index f70c918f..c75f9699 100644 --- a/ProductionMgr/Tnb.ProductionMgr/BiService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/BiService.cs @@ -4,6 +4,7 @@ using JNPF.Common.Extension; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev.Engine.Enum.VisualDevModelData; using Microsoft.AspNetCore.Authorization; @@ -15,6 +16,8 @@ using Tnb.EquipMgr.Entities; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto.PrdManage; using Tnb.Common.Redis; +using Tnb.QcMgr.Entities; +using Tnb.WarehouseMgr.Entities.Consts; namespace Tnb.ProductionMgr { @@ -149,5 +152,67 @@ namespace Tnb.ProductionMgr return output; } + + [HttpPost] + [AllowAnonymous] + public async Task GetZlBiData() + { + ZlBiOutput result = new ZlBiOutput(); + int mo_task_count = await _db.Queryable().Where(x=>x.mo_task_status==DictConst.InProgressEnCode && (x.schedule_type==1 || (x.schedule_type==2 && x.parent_id!=null))).CountAsync(); + int qc_all_count = await _db.Queryable().Where(x=>x.status=="26745591857941").CountAsync(); + int qc_complete_count = await _db.Queryable().Where(x=>x.status=="26745885292053").CountAsync(); + int qc_ok_count = await _db.Queryable().Where(x=>x.result=="ok" || x.result=="barelyOk").CountAsync(); + + List list = await _db.Queryable() + .LeftJoin((a, b) => a.mo_task_code == b.mo_task_code) + .LeftJoin((a, b, c) => b.eqp_id == c.id) + .LeftJoin((a, b, c, d) => b.workline_id == d.Id) + .LeftJoin((a, b, c, d, e) => a.materialid == e.id) + .LeftJoin((a, b, c, d, e, f) => a.execuser == f.Id) + .LeftJoin((a,b,c,d,e,f,g)=>a.checktype==g.Id) + .Where((a) => a.status == "26745885292053") + .Select((a, b, c, d, e, f,g) => new ZlBiQcTaskListOutput + { + mo_task_code = a.mo_task_code, + equip_workline_name = c.name!=null ? c.name : d.FullName, + checktype = g.FullName, + material_name = e.name, + material_specification = e.material_specification, + material_standard = e.material_standard, + qty = a.qty, + rqty = a.rqty, + result = a.result, + execuser = f.RealName, + exectime = a.exectime + }).OrderByDescending(a => a.exectime).Take(10).ToListAsync(); + + List detailList = await _db.Queryable() + .LeftJoin((a, b) => a.mo_task_code == b.mo_task_code) + .LeftJoin((a, b, c) => b.eqp_id == c.id) + .LeftJoin((a, b, c, d) => b.workline_id == d.Id) + .LeftJoin((a, b, c, d, e) => a.materialid == e.id) + .LeftJoin((a, b, c, d, e, f) => a.execuser == f.Id) + .LeftJoin((a,b,c,d,e,f,g)=>a.checktype==g.Id) + .Where((a) => a.status == "26745591857941") + .Select((a, b, c, d, e, f,g) => new ZlBiQcTaskDetailListOutput + { + mo_task_code = a.mo_task_code, + equip_workline_name = c.name!=null ? c.name : d.FullName, + checktype = a.checktype, + create_time = a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"), + execuser = f.RealName, + }).OrderBy(a => a.create_time).ToListAsync(); + + result.mo_task_count = mo_task_count; + result.qc_all_count = qc_all_count; + result.qc_complete_count = qc_complete_count; + result.qc_ok_count = qc_ok_count; + result.qc_task_list = list; + result.qc_sj_task_list = detailList.Where(x=>x.checktype==WmsWareHouseConst.SHOUJIAN_ID).ToList(); + result.qc_xj_task_list = detailList.Where(x=>x.checktype==WmsWareHouseConst.XUNJIAN_ID).ToList(); + result.qc_mj_task_list = detailList.Where(x=>x.checktype==WmsWareHouseConst.MOJIAN_ID).ToList(); + result.qc_lbjj_task_list = detailList.Where(x=>x.checktype==WmsWareHouseConst.LINGBUJIANZUIZHONGJIANYAN_ID).ToList(); + return result; + } } } \ No newline at end of file diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs index a059242c..6bf361f5 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs @@ -280,7 +280,7 @@ namespace Tnb.QcMgr QcCheckExecH.status = DictionaryData.Id; QcCheckExecH.result = CheckTaskInput.result; QcCheckExecH.execuser = _userManager.UserId; - QcCheckExecH.exectime = DateTime.Now.ToString(); + QcCheckExecH.exectime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); QcCheckExecH.check_type = CheckTaskInput.check_type; QcCheckExecH.remark = CheckTaskInput.remark; QcCheckExecH.attachment = CheckTaskInput.attachment;