入库检验
This commit is contained in:
parent
59dd7307d8
commit
20a0bca353
@ -129,6 +129,41 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量修改合适数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("batchQualified")]
|
||||
public IActionResult BatchQualified([FromBody]string[] packcode_select)
|
||||
{
|
||||
if (packcode_select == null || packcode_select.Length <= 0)
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
|
||||
var response = _WmFgentryInspectService.BatchQualified(packcode_select, HttpContext.GetName());
|
||||
|
||||
return ToResponse(response);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 批量修改合适数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("batchUnQualified")]
|
||||
public IActionResult BatchUnQualified([FromBody] string[] packcode_select)
|
||||
{
|
||||
if (packcode_select == null || packcode_select.Length <= 0)
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
|
||||
var response = _WmFgentryInspectService.BatchUnQualified(packcode_select, HttpContext.GetName());
|
||||
|
||||
return ToResponse(response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -20,6 +20,41 @@ namespace ZR.Model.MES.wms.Dto
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 成品入库检验 父节点 加入 检验合格数量 和检验不合格数量
|
||||
/// </summary>
|
||||
public class WmFgentryInspect_parentDto
|
||||
{
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Workorder { get; set; }
|
||||
|
||||
|
||||
public string Packcode { get; set; }
|
||||
|
||||
public string Machine { get; set; }
|
||||
|
||||
public int? ProductionNum { get; set; }
|
||||
|
||||
public string Partnumber { get; set; }
|
||||
|
||||
public int? Bfilled { get; set; }
|
||||
/// <summary>
|
||||
/// 已经检查不合格数量
|
||||
/// </summary>
|
||||
public int? Result_good { get; set; }
|
||||
/// <summary>
|
||||
/// 已经检查合格数量
|
||||
/// </summary>
|
||||
public int? Result_bad { get; set; }
|
||||
/// <summary>
|
||||
/// 未检查数量
|
||||
/// </summary>
|
||||
public int? Result_null { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -4,6 +4,7 @@ using ZR.Model.Dto;
|
||||
using ZR.Model.MES.wms;
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
@ -13,7 +14,7 @@ namespace ZR.Service.mes.wms.IService
|
||||
public interface IWmFgentryInspectService : IBaseService<WmFgentryInspect>
|
||||
{
|
||||
PagedInfo<WmFgentryInspectDto> GetList(WmFgentryInspectQueryDto parm);
|
||||
PagedInfo<WmFgentryInspectDto> GetList_first(WmFgentryInspectQueryDto parm);
|
||||
PagedInfo<WmFgentryInspect_parentDto> GetList_first(WmFgentryInspectQueryDto parm);
|
||||
PagedInfo<WmFgentryInspectDto> GetList_second(WmFgentryInspectQueryDto parm);
|
||||
|
||||
|
||||
@ -23,5 +24,8 @@ namespace ZR.Service.mes.wms.IService
|
||||
|
||||
int UpdateWmFgentryInspect(WmFgentryInspect parm);
|
||||
|
||||
int BatchQualified(string[] packcode_select,string updateby);
|
||||
int BatchUnQualified(string[] packcode_select,string updateby);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ namespace ZR.Service.mes.wms
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmFgentryInspectDto> GetList_first(WmFgentryInspectQueryDto parm)
|
||||
public PagedInfo<WmFgentryInspect_parentDto> GetList_first(WmFgentryInspectQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmFgentryInspect>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Workorder), it => it.Workorder.Contains(parm.Workorder))
|
||||
@ -52,23 +52,35 @@ namespace ZR.Service.mes.wms
|
||||
;
|
||||
|
||||
|
||||
List<WmFgentryInspect> inspects = Queryable()
|
||||
.Where(predicate.ToExpression()).GroupBy(it => it.Workorder)
|
||||
.Select(it => new WmFgentryInspect()
|
||||
List<WmFgentryInspect_parentDto> inspects = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.GroupBy(it => it.Workorder)
|
||||
.Select(it => new WmFgentryInspect_parentDto()
|
||||
{
|
||||
Workorder = it.Workorder,
|
||||
ProductionNum = SqlFunc.AggregateSum(it.ProductionNum ?? 0),
|
||||
// Result= SqlFunc.AggregateSum(it.Result??0),
|
||||
Partnumber = SqlFunc.AggregateMax(it.Partnumber)
|
||||
}).ToList();
|
||||
int totalPages = (int)Math.Ceiling((double)inspects.Count / parm.PageSize);
|
||||
var pageProducts = inspects.Skip((parm.PageNum - 1) * parm.PageSize).Take(parm.PageSize);
|
||||
|
||||
PagedInfo<WmFgentryInspectDto> response = new PagedInfo<WmFgentryInspectDto>()
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
int totalPages = (int)Math.Ceiling((double)inspects.Count / parm.PageSize);
|
||||
|
||||
var pageProducts = inspects.Skip((parm.PageNum - 1) * parm.PageSize).Take(parm.PageSize).ToList();
|
||||
|
||||
PagedInfo<WmFgentryInspect_parentDto> response = new PagedInfo<WmFgentryInspect_parentDto>()
|
||||
{
|
||||
PageSize = parm.PageSize,
|
||||
PageIndex = parm.PageNum,
|
||||
TotalPage = totalPages,
|
||||
Result= pageProducts.Adapt<List<WmFgentryInspectDto>>()
|
||||
Result= pageProducts
|
||||
};
|
||||
|
||||
return response;
|
||||
@ -141,6 +153,42 @@ namespace ZR.Service.mes.wms
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
/// <summary>
|
||||
/// 批量修改合格
|
||||
/// </summary>
|
||||
/// <param name="packcode_select"></param>
|
||||
/// <returns></returns>
|
||||
public int BatchQualified(string[] packcode_select,string updateby)
|
||||
{
|
||||
int sum = 0;
|
||||
foreach (string packcode in packcode_select)
|
||||
{
|
||||
sum= sum+ Context.Updateable<WmFgentryInspect>()
|
||||
.Where(it=>it.Packcode == packcode)
|
||||
.SetColumns(it=>it.Result==1)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
return sum;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量修改合格
|
||||
/// </summary>
|
||||
/// <param name="packcode_select"></param>
|
||||
/// <returns></returns>
|
||||
public int BatchUnQualified(string[] packcode_select, string updateby)
|
||||
{
|
||||
int sum = 0;
|
||||
foreach (string packcode in packcode_select)
|
||||
{
|
||||
sum = sum + Context.Updateable<WmFgentryInspect>()
|
||||
.Where(it => it.Packcode == packcode)
|
||||
.SetColumns(it => it.Result == 2)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
return sum;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user