diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmFgentryInspectController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmFgentryInspectController.cs index d30693b5..3cdf1b8a 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WmFgentryInspectController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmFgentryInspectController.cs @@ -201,6 +201,24 @@ namespace ZR.Admin.WebApi.Controllers } + /// + /// 设置全部不合格 + /// + /// + /// + [HttpGet("setAllUnQualified")] + public IActionResult SetAllUnQualified(string workorder_selected) + { + if (string.IsNullOrEmpty(workorder_selected)) + { + return SUCCESS(null); + } + + var response = _WmFgentryInspectService.SetAllUnQualified(workorder_selected, HttpContext.GetName()); + + return ToResponse(response); + + } diff --git a/ZR.Model/MES/wms/Dto/WmFgentryInspectDto.cs b/ZR.Model/MES/wms/Dto/WmFgentryInspectDto.cs index 122959fb..ae77ac76 100644 --- a/ZR.Model/MES/wms/Dto/WmFgentryInspectDto.cs +++ b/ZR.Model/MES/wms/Dto/WmFgentryInspectDto.cs @@ -55,6 +55,24 @@ namespace ZR.Model.MES.wms.Dto public int? Result_null { get; set; } + + /// + /// 产品描述 + /// + public string ProductDescription { get; set; } + + /// + /// 规格 + /// + public string Specifications { get; set; } + + /// + /// 颜色 + /// + /// + public string Colour { get; set; } + + } /// @@ -90,5 +108,22 @@ namespace ZR.Model.MES.wms.Dto + /// + /// 产品描述 + /// + public string ProductDescription { get; set; } + + /// + /// 规格 + /// + public string Specifications { get; set; } + + /// + /// 颜色 + /// + /// + public string Colour { get; set; } + + } } \ No newline at end of file diff --git a/ZR.Service/mes/wms/IService/IWmFgentryInspectService.cs b/ZR.Service/mes/wms/IService/IWmFgentryInspectService.cs index 5966b155..2f5de6aa 100644 --- a/ZR.Service/mes/wms/IService/IWmFgentryInspectService.cs +++ b/ZR.Service/mes/wms/IService/IWmFgentryInspectService.cs @@ -29,6 +29,7 @@ namespace ZR.Service.mes.wms.IService int BatchQualified(string[] packcode_select,string updateby); int SetAllQualified(string workorder_selected, string updateby); + int SetAllUnQualified(string workorder_selected, string updateby); int BatchUnQualified(string[] packcode_select,string updateby); } diff --git a/ZR.Service/mes/wms/WmFgentryInspectService.cs b/ZR.Service/mes/wms/WmFgentryInspectService.cs index 436a492b..ed0ee939 100644 --- a/ZR.Service/mes/wms/WmFgentryInspectService.cs +++ b/ZR.Service/mes/wms/WmFgentryInspectService.cs @@ -13,6 +13,8 @@ using ZR.Model.MES.wms.Dto; using Mapster; using System.Reflection.PortableExecutable; using Microsoft.AspNetCore.Http.HttpResults; +using ZR.Model.MES.pro; +using System.Drawing; namespace ZR.Service.mes.wms { @@ -101,13 +103,26 @@ namespace ZR.Service.mes.wms ProductionNum = SqlFunc.AggregateSum(it.ProductionNum ?? 0), // Result= SqlFunc.AggregateSum(it.Result??0), Partnumber = SqlFunc.AggregateMax(it.Partnumber) - }).ToList(); + }) + .LeftJoin((s, w) => s.Workorder==w.ClientWorkorder) + .Select((s,w)=>new WmFgentryInspect_parentDto + { + Workorder= s.Workorder, + ProductionNum=s.ProductionNum, + Partnumber=s.Partnumber, + ProductDescription=w.ProductDescription, + Specifications=w.Specifications, + Colour = w.Colour + }) + .ToList(); foreach (var inspect in inspects) { inspect.Result_good = Queryable().Where(it => it.Workorder == inspect.Workorder).Where(it => it.Result == 1).Count(); inspect.Result_bad = Queryable().Where(it => it.Workorder == inspect.Workorder).Where(it => it.Result == 2).Count(); inspect.Result_null = Queryable().Where(it => it.Workorder == inspect.Workorder).Where(it => it.Result == 0 || it.Result == null).Count(); + + } @@ -133,16 +148,26 @@ namespace ZR.Service.mes.wms public PagedInfo GetList_second(WmFgentryInspectQueryDto parm) { var predicate = Expressionable.Create() - .AndIF(!string.IsNullOrEmpty(parm.Workorder), it => it.Workorder.Contains(parm.Workorder)) - .AndIF(!string.IsNullOrEmpty(parm.Packcode), it => it.Packcode.Contains(parm.Packcode)) - .AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber)) - .AndIF(parm.starttime != null && parm.starttime > new DateTime(1999, 1, 1), it => it.CreatedTime > parm.starttime) - .AndIF(parm.endtime != null && parm.endtime > new DateTime(1999, 1, 1), it => it.CreatedTime < parm.endtime) + .AndIF(!string.IsNullOrEmpty(parm.Workorder), s => s.Workorder.Contains(parm.Workorder)) + .AndIF(!string.IsNullOrEmpty(parm.Packcode), s => s.Packcode.Contains(parm.Packcode)) + .AndIF(!string.IsNullOrEmpty(parm.Partnumber), s=> s.Partnumber.Contains(parm.Partnumber)) + .AndIF(parm.starttime != null && parm.starttime > new DateTime(1999, 1, 1), s => s.CreatedTime > parm.starttime) + .AndIF(parm.endtime != null && parm.endtime > new DateTime(1999, 1, 1), s => s.CreatedTime < parm.endtime) ; var response = Queryable() - .Where(it => it.Bitwm == 0) + .LeftJoin((s, w) => s.Workorder == w.ClientWorkorder) + .Where(s => s.Bitwm == 0) .Where(predicate.ToExpression()) - .ToPage(parm); + .Select((s, w) => new WmFgentryInspectDto + { + Workorder = s.Workorder, + ProductionNum = s.ProductionNum, + Partnumber = s.Partnumber, + ProductDescription = w.ProductDescription, + Specifications = w.Specifications, + Colour = w.Colour + }) + .ToPage(parm); return response; } @@ -227,6 +252,20 @@ namespace ZR.Service.mes.wms .ExecuteCommand(); } + /// + /// 设置全部批量不合格 + /// + /// + /// + /// + public int SetAllUnQualified(string workorder_selected, string updateby) + { + return Context.Updateable() + .SetColumns(it => it.Result == 2) + .Where(it => it.Workorder == workorder_selected) + .ExecuteCommand(); + } + ///