待修改功能TODO
This commit is contained in:
@@ -247,6 +247,97 @@ namespace ZR.Service.mes.wms
|
||||
return response;*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询工艺路线-抛光 库存表列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public WmPolishInventoryTableDto GetListNew(WmPolishInventoryQueryDto parm)
|
||||
{
|
||||
var list = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.LeftJoin<WmPolishInventory>((m, p) => m.Partnumber == p.Partnumber)
|
||||
.Distinct()
|
||||
.WhereIF(
|
||||
!string.IsNullOrEmpty(parm.Description),
|
||||
(m, p) => m.Description.Contains(parm.Description)
|
||||
)
|
||||
.WhereIF(
|
||||
!string.IsNullOrEmpty(parm.Partnumber),
|
||||
(m, p) => m.Partnumber.Contains(parm.Partnumber)
|
||||
)
|
||||
.Where((m, p) => m.Status == 1)
|
||||
.Where((m, p) => m.Type == 1)
|
||||
//.WhereIF(string.IsNullOrEmpty(parm.Partnumber), (m, p) => p.Status == 1)
|
||||
.OrderBy((m, p) => m.Description)
|
||||
.Select(
|
||||
(m, p) =>
|
||||
new WmPolishInventoryDto
|
||||
{
|
||||
RealQuantity = 0,
|
||||
Partnumber = m.Partnumber,
|
||||
Color = m.Color,
|
||||
Specification = m.Specification,
|
||||
Description = m.Description,
|
||||
Id = p.Id ?? m.Id,
|
||||
BlankNum = p.BlankNum,
|
||||
Quantity = p.Quantity ?? 0,
|
||||
MaxNum = p.MaxNum,
|
||||
MinNum = p.MinNum,
|
||||
WarnNum = p.WarnNum,
|
||||
Type = p.Type ?? 1,
|
||||
Status = p.Status,
|
||||
Remark = p.Remark,
|
||||
CreatedBy = p.CreatedBy,
|
||||
// 盘点时间
|
||||
CreatedTime = p.CreatedTime,
|
||||
UpdatedBy = p.UpdatedBy,
|
||||
UpdatedTime = p.UpdatedTime,
|
||||
}
|
||||
)
|
||||
.ToList();
|
||||
//TODO 取出库存表 wm_polish_inventory 最小CreatedTime时间
|
||||
|
||||
//TODO 根据时间范围取出所有记录数据
|
||||
|
||||
|
||||
// TODO 匹配记录(partnumber零件号,时间范围)
|
||||
foreach (WmPolishInventoryDto item in list)
|
||||
{
|
||||
// TODO 获取实际库存 item.quantity(盘点开始数量) + recourd 记录的入库数量 - 出库数量(筛选条件是 时间区间【item.CreatedTime】 + partnumber[item.partnumber])
|
||||
item.RealQuantity = 0;
|
||||
/*List<string> partnumbers = new() { item.Partnumber };
|
||||
Dictionary<string, int> dict = GetBatchPolishRealPartNum(partnumbers);*/
|
||||
// item.RealQuantity = dict.TryGetValue(item.Partnumber, out int value) ? value : 0;
|
||||
}
|
||||
|
||||
list = list.Where(it => it.RealQuantity != 0 || it.Quantity != 0)
|
||||
.Where(it => !string.IsNullOrEmpty(it.Partnumber))
|
||||
.DistinctBy(it => it.Partnumber)
|
||||
.ToList();
|
||||
|
||||
int total = list.Count;
|
||||
// 仓库总盘点零件数
|
||||
int StocktakingTotal =
|
||||
Context.Queryable<WmPolishInventory>().Sum(it => it.Quantity) ?? 0;
|
||||
// 仓库当前查询盘点零件数
|
||||
int QuantitySum = list.Sum(it => it.Quantity) ?? 0;
|
||||
// 仓库当前查询实际零件数
|
||||
int RealQuantitySum = list.Sum(it => it.RealQuantity);
|
||||
WmPolishInventoryTableDto response =
|
||||
new()
|
||||
{
|
||||
Total = total,
|
||||
StocktakingTotal = StocktakingTotal,
|
||||
QuantitySum = QuantitySum,
|
||||
RealQuantitySum = RealQuantitySum,
|
||||
Result = list.Skip((parm.PageNum - 1) * parm.PageSize)
|
||||
.Take(parm.PageSize)
|
||||
.ToList(),
|
||||
};
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user