质量看板的倒车雷达去除,抛光,一次仓库数据优化
This commit is contained in:
@@ -76,6 +76,18 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.FQC
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取 首检 倒车雷达数量
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("getParkingSensorTotal")]
|
||||||
|
public IActionResult GetParkingSensorTotal(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize)
|
||||||
|
{
|
||||||
|
int result = qcStatistics.GetParkingSensorTotal(starttime, endTime, workorderid, partnumber, product_description, team, pageNum, pageSize);
|
||||||
|
|
||||||
|
return SUCCESS(result);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 导出对应报表
|
/// 导出对应报表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -68,6 +68,17 @@ namespace ZR.Service.mes.qc.IService
|
|||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public int GetParkingSensorTotal(
|
||||||
|
DateTime starttime,
|
||||||
|
DateTime endTime,
|
||||||
|
string workorderid,
|
||||||
|
string partnumber,
|
||||||
|
string product_description,
|
||||||
|
string team,
|
||||||
|
int pageNum,
|
||||||
|
int pageSize
|
||||||
|
);
|
||||||
|
|
||||||
public int DeleteStatisticsTable(string workorderid);
|
public int DeleteStatisticsTable(string workorderid);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ namespace ZR.Service.mes.qc
|
|||||||
List<QcQualityStatisticsFirst> data = Context
|
List<QcQualityStatisticsFirst> data = Context
|
||||||
.Queryable<QcQualityStatisticsFirst>()
|
.Queryable<QcQualityStatisticsFirst>()
|
||||||
.Where(predicate)
|
.Where(predicate)
|
||||||
|
|
||||||
.OrderByIF(sortType == 1, it => it.QualifiedRate, OrderByType.Desc)
|
.OrderByIF(sortType == 1, it => it.QualifiedRate, OrderByType.Desc)
|
||||||
.OrderByIF(sortType == 2, it => it.ProductDescription, OrderByType.Asc)
|
.OrderByIF(sortType == 2, it => it.ProductDescription, OrderByType.Asc)
|
||||||
.OrderByIF(sortType == 0 || sortType == 2, it => it.StartTime, OrderByType.Asc)
|
.OrderByIF(sortType == 0 || sortType == 2, it => it.StartTime, OrderByType.Asc)
|
||||||
@@ -815,5 +814,70 @@ namespace ZR.Service.mes.qc
|
|||||||
return "获取描述异常!";
|
return "获取描述异常!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取首检倒车雷达数量
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="starttime"></param>
|
||||||
|
/// <param name="endTime"></param>
|
||||||
|
/// <param name="workorderid"></param>
|
||||||
|
/// <param name="partnumber"></param>
|
||||||
|
/// <param name="product_description"></param>
|
||||||
|
/// <param name="team"></param>
|
||||||
|
/// <param name="pageNum"></param>
|
||||||
|
/// <param name="pageSize"></param>
|
||||||
|
/// <param name="sortType"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int GetParkingSensorTotal(
|
||||||
|
DateTime starttime,
|
||||||
|
DateTime endTime,
|
||||||
|
string workorderid,
|
||||||
|
string partnumber,
|
||||||
|
string product_description,
|
||||||
|
string team,
|
||||||
|
int pageNum,
|
||||||
|
int pageSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 倒车雷达提取
|
||||||
|
string[] checkStrArray2 = { "倒车雷达" };
|
||||||
|
var ParkingSensorPartNumberCheck = Expressionable.Create<WmMaterial>();
|
||||||
|
foreach (string checkStr in checkStrArray2)
|
||||||
|
{
|
||||||
|
ParkingSensorPartNumberCheck.Or(it => it.Description.Contains(checkStr));
|
||||||
|
}
|
||||||
|
;
|
||||||
|
ParkingSensorPartNumberCheck.And(it => it.Type == 1).And(it => it.Status == 1);
|
||||||
|
List<string> ParkingSensorPartNumberList = Context
|
||||||
|
.Queryable<WmMaterial>()
|
||||||
|
.Where(ParkingSensorPartNumberCheck.ToExpression())
|
||||||
|
.Select(it => it.Partnumber)
|
||||||
|
.ToList();
|
||||||
|
var predicateParkingSensor = Expressionable
|
||||||
|
.Create<QcQualityStatisticsFirst>()
|
||||||
|
.And(it => ParkingSensorPartNumberList.Contains(it.FinishedPartNumber))
|
||||||
|
.AndIF(!string.IsNullOrEmpty(workorderid), it => it.WorkorderId == workorderid)
|
||||||
|
.AndIF(!string.IsNullOrEmpty(partnumber), it => it.FinishedPartNumber == partnumber)
|
||||||
|
.AndIF(
|
||||||
|
!string.IsNullOrEmpty(product_description),
|
||||||
|
it => it.ProductDescription == product_description
|
||||||
|
)
|
||||||
|
.AndIF(!string.IsNullOrEmpty(team), it => it.Team == team)
|
||||||
|
.AndIF(starttime > DateTime.MinValue, it => it.StartTime >= starttime.ToLocalTime())
|
||||||
|
.AndIF(endTime > DateTime.MinValue, it => it.StartTime <= endTime.ToLocalTime())
|
||||||
|
.ToExpression();
|
||||||
|
return (Context
|
||||||
|
.Queryable<QcQualityStatisticsFirst>()
|
||||||
|
.Where(predicateParkingSensor)
|
||||||
|
.Sum(it => it.QualifiedNumber) ?? 0) / 3;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new Exception(e.Message ?? string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,25 +44,24 @@ namespace ZR.Service.mes.wms
|
|||||||
)
|
)
|
||||||
.Where((m, p) => m.Status == 1)
|
.Where((m, p) => m.Status == 1)
|
||||||
.Where((m, p) => m.Type == 1)
|
.Where((m, p) => m.Type == 1)
|
||||||
.WhereIF(parm.Status > -1, (m, p) => p.Status == parm.Status)
|
.WhereIF(string.IsNullOrEmpty(parm.Partnumber), (m, p) => p.Status == 1)
|
||||||
.WhereIF(parm.Type > 0, (m, p) => p.Type == parm.Type)
|
|
||||||
.OrderBy((m, p) => m.Description)
|
.OrderBy((m, p) => m.Description)
|
||||||
.Select(
|
.Select(
|
||||||
(m, p) =>
|
(m, p) =>
|
||||||
new WmOneTimeInventoryDto
|
new WmOneTimeInventoryDto
|
||||||
{
|
{
|
||||||
RealQuantity = 0,
|
RealQuantity = 0,
|
||||||
|
Partnumber = m.Partnumber,
|
||||||
Color = m.Color,
|
Color = m.Color,
|
||||||
Specification = m.Specification,
|
Specification = m.Specification,
|
||||||
Description = m.Description,
|
Description = m.Description,
|
||||||
Id = p.Id,
|
Id = p.Id ?? m.Id,
|
||||||
BlankNum = p.BlankNum,
|
BlankNum = p.BlankNum,
|
||||||
Partnumber = p.Partnumber,
|
Quantity = p.Quantity ?? 0,
|
||||||
Quantity = p.Quantity,
|
|
||||||
MaxNum = p.MaxNum,
|
MaxNum = p.MaxNum,
|
||||||
MinNum = p.MinNum,
|
MinNum = p.MinNum,
|
||||||
WarnNum = p.WarnNum,
|
WarnNum = p.WarnNum,
|
||||||
Type = p.Type,
|
Type = p.Type ?? 1,
|
||||||
Status = p.Status,
|
Status = p.Status,
|
||||||
Remark = p.Remark,
|
Remark = p.Remark,
|
||||||
CreatedBy = p.CreatedBy,
|
CreatedBy = p.CreatedBy,
|
||||||
@@ -75,10 +74,7 @@ namespace ZR.Service.mes.wms
|
|||||||
foreach (WmOneTimeInventoryDto item in list)
|
foreach (WmOneTimeInventoryDto item in list)
|
||||||
{
|
{
|
||||||
// 获取实际库存
|
// 获取实际库存
|
||||||
List<string> partnumbers = new()
|
List<string> partnumbers = new() { item.Partnumber };
|
||||||
{
|
|
||||||
item.Partnumber
|
|
||||||
};
|
|
||||||
Dictionary<string, int> dict = GetBatchOneTimeRealPartNum(partnumbers);
|
Dictionary<string, int> dict = GetBatchOneTimeRealPartNum(partnumbers);
|
||||||
item.RealQuantity = dict.TryGetValue(item.Partnumber, out int value) ? value : 0;
|
item.RealQuantity = dict.TryGetValue(item.Partnumber, out int value) ? value : 0;
|
||||||
}
|
}
|
||||||
@@ -96,14 +92,17 @@ namespace ZR.Service.mes.wms
|
|||||||
int QuantitySum = list.Sum(it => it.Quantity) ?? 0;
|
int QuantitySum = list.Sum(it => it.Quantity) ?? 0;
|
||||||
// 仓库当前查询实际零件数
|
// 仓库当前查询实际零件数
|
||||||
int RealQuantitySum = list.Sum(it => it.RealQuantity);
|
int RealQuantitySum = list.Sum(it => it.RealQuantity);
|
||||||
WmOneTimeInventoryTableDto response = new()
|
WmOneTimeInventoryTableDto response =
|
||||||
{
|
new()
|
||||||
Total = total,
|
{
|
||||||
StocktakingTotal = StocktakingTotal,
|
Total = total,
|
||||||
QuantitySum = QuantitySum,
|
StocktakingTotal = StocktakingTotal,
|
||||||
RealQuantitySum = RealQuantitySum,
|
QuantitySum = QuantitySum,
|
||||||
Result = list.Skip((parm.PageNum - 1) * parm.PageSize).Take(parm.PageSize).ToList(),
|
RealQuantitySum = RealQuantitySum,
|
||||||
};
|
Result = list.Skip((parm.PageNum - 1) * parm.PageSize)
|
||||||
|
.Take(parm.PageSize)
|
||||||
|
.ToList(),
|
||||||
|
};
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
/*List<string> partnumberByDescription = new();
|
/*List<string> partnumberByDescription = new();
|
||||||
|
|||||||
@@ -57,25 +57,24 @@ namespace ZR.Service.mes.wms
|
|||||||
)
|
)
|
||||||
.Where((m, p) => m.Status == 1)
|
.Where((m, p) => m.Status == 1)
|
||||||
.Where((m, p) => m.Type == 1)
|
.Where((m, p) => m.Type == 1)
|
||||||
.WhereIF(parm.Status > -1, (m, p) => p.Status == parm.Status)
|
.WhereIF(string.IsNullOrEmpty(parm.Partnumber), (m, p) => p.Status == 1)
|
||||||
.WhereIF(parm.Type > 0, (m, p) => p.Type == parm.Type)
|
|
||||||
.OrderBy((m, p) => m.Description)
|
.OrderBy((m, p) => m.Description)
|
||||||
.Select(
|
.Select(
|
||||||
(m, p) =>
|
(m, p) =>
|
||||||
new WmPolishInventoryDto
|
new WmPolishInventoryDto
|
||||||
{
|
{
|
||||||
RealQuantity = 0,
|
RealQuantity = 0,
|
||||||
|
Partnumber = m.Partnumber,
|
||||||
Color = m.Color,
|
Color = m.Color,
|
||||||
Specification = m.Specification,
|
Specification = m.Specification,
|
||||||
Description = m.Description,
|
Description = m.Description,
|
||||||
Id = p.Id,
|
Id = p.Id ?? m.Id,
|
||||||
BlankNum = p.BlankNum,
|
BlankNum = p.BlankNum,
|
||||||
Partnumber = p.Partnumber,
|
Quantity = p.Quantity ?? 0,
|
||||||
Quantity = p.Quantity,
|
|
||||||
MaxNum = p.MaxNum,
|
MaxNum = p.MaxNum,
|
||||||
MinNum = p.MinNum,
|
MinNum = p.MinNum,
|
||||||
WarnNum = p.WarnNum,
|
WarnNum = p.WarnNum,
|
||||||
Type = p.Type,
|
Type = p.Type ?? 1,
|
||||||
Status = p.Status,
|
Status = p.Status,
|
||||||
Remark = p.Remark,
|
Remark = p.Remark,
|
||||||
CreatedBy = p.CreatedBy,
|
CreatedBy = p.CreatedBy,
|
||||||
@@ -88,14 +87,11 @@ namespace ZR.Service.mes.wms
|
|||||||
foreach (WmPolishInventoryDto item in list)
|
foreach (WmPolishInventoryDto item in list)
|
||||||
{
|
{
|
||||||
// 获取实际库存
|
// 获取实际库存
|
||||||
List<string> partnumbers = new()
|
List<string> partnumbers = new() { item.Partnumber };
|
||||||
{
|
|
||||||
item.Partnumber
|
|
||||||
};
|
|
||||||
Dictionary<string, int> dict = GetBatchPolishRealPartNum(partnumbers);
|
Dictionary<string, int> dict = GetBatchPolishRealPartNum(partnumbers);
|
||||||
item.RealQuantity = dict.TryGetValue(item.Partnumber, out int value) ? value : 0;
|
item.RealQuantity = dict.TryGetValue(item.Partnumber, out int value) ? value : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
list = list.Where(it => it.RealQuantity != 0 || it.Quantity != 0)
|
list = list.Where(it => it.RealQuantity != 0 || it.Quantity != 0)
|
||||||
.Where(it => !string.IsNullOrEmpty(it.Partnumber))
|
.Where(it => !string.IsNullOrEmpty(it.Partnumber))
|
||||||
.DistinctBy(it => it.Partnumber)
|
.DistinctBy(it => it.Partnumber)
|
||||||
@@ -109,14 +105,17 @@ namespace ZR.Service.mes.wms
|
|||||||
int QuantitySum = list.Sum(it => it.Quantity) ?? 0;
|
int QuantitySum = list.Sum(it => it.Quantity) ?? 0;
|
||||||
// 仓库当前查询实际零件数
|
// 仓库当前查询实际零件数
|
||||||
int RealQuantitySum = list.Sum(it => it.RealQuantity);
|
int RealQuantitySum = list.Sum(it => it.RealQuantity);
|
||||||
WmPolishInventoryTableDto response = new()
|
WmPolishInventoryTableDto response =
|
||||||
{
|
new()
|
||||||
Total = total,
|
{
|
||||||
StocktakingTotal = StocktakingTotal,
|
Total = total,
|
||||||
QuantitySum = QuantitySum,
|
StocktakingTotal = StocktakingTotal,
|
||||||
RealQuantitySum = RealQuantitySum,
|
QuantitySum = QuantitySum,
|
||||||
Result = list.Skip((parm.PageNum - 1)* parm.PageSize).Take(parm.PageSize).ToList(),
|
RealQuantitySum = RealQuantitySum,
|
||||||
};
|
Result = list.Skip((parm.PageNum - 1) * parm.PageSize)
|
||||||
|
.Take(parm.PageSize)
|
||||||
|
.ToList(),
|
||||||
|
};
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
//TODO 历史查询
|
//TODO 历史查询
|
||||||
|
|||||||
Reference in New Issue
Block a user