|
@@ -3341,6 +3341,84 @@ FROM
|
|
|
return _jv;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 物品领用 批量 List
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="currUserId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<JsonView> GoodsReceiveBatchListAsync(GoodsReceiveBatchListDto dto)
|
|
|
+ {
|
|
|
+ int currUserId = dto.CurrUserId;
|
|
|
+ string goodsName = dto.GoodsName;
|
|
|
+
|
|
|
+
|
|
|
+ var showAllPeopleIds = new List<int>() {
|
|
|
+ 374, // 罗颖
|
|
|
+ 233, // 刘华举
|
|
|
+ 208, // 雷怡
|
|
|
+ 343, // 陈湘
|
|
|
+ };
|
|
|
+ var isShowAllPeople = showAllPeopleIds.Any(x => x == currUserId);
|
|
|
+
|
|
|
+ RefAsync<int> total = 0;
|
|
|
+ var receiveList = await _sqlSugar.Queryable<Pm_GoodsReceive>()
|
|
|
+ .LeftJoin<Sys_Users>((x,y) => x.CreateUserId == y.Id)
|
|
|
+ .Where((x, y) => x.IsDel == 0 && x.GoodsId == 0 )
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(goodsName), (x,y) => x.GoodsName.Contains(goodsName))
|
|
|
+ .WhereIF(!isShowAllPeople,(x,y) => x.CreateUserId == currUserId)
|
|
|
+ .Select((x,y) => new GoodsReceiveBatchListView() {
|
|
|
+ Id = x.Id,
|
|
|
+ GoodsName = x.GoodsName,
|
|
|
+ AccumQty = SqlFunc.Subqueryable<Pm_GoodsReceiveDetails>().Where(z => z.IsDel == 0 && z.GoodsReceiveId == x.Id).Sum(z => z.Quantity),
|
|
|
+ Reason = x.Reason,
|
|
|
+ Remark = x.Remark,
|
|
|
+ Status = x.AuditStatus,
|
|
|
+ Applicant = y.CnName,
|
|
|
+ ApplyTime = x.CreateTime,
|
|
|
+ })
|
|
|
+ .ToPageListAsync(dto.PageIndex,dto.PageSize,total);
|
|
|
+
|
|
|
+ foreach (var item in receiveList)
|
|
|
+ {
|
|
|
+ var detailsText = new StringBuilder();
|
|
|
+ if (item.AccumQty > 0)
|
|
|
+ {
|
|
|
+ var goodsInfos = await _sqlSugar.Queryable<Pm_GoodsReceiveDetails>()
|
|
|
+ .InnerJoin<Pm_GoodsInfo>((x, y) => x.GoodsId == y.Id)
|
|
|
+ .LeftJoin<Sys_SetData>((x, y, z) => y.Type == z.Id)
|
|
|
+ .Where((x, y, z) => x.IsDel == 0 && x.GoodsReceiveId == item.Id)
|
|
|
+ .Select((x, y, z) => new
|
|
|
+ {
|
|
|
+ goodsId = x.GoodsId,
|
|
|
+ goodsName = y.Name,
|
|
|
+ goodsType = z.Name,
|
|
|
+ quantity = x.Quantity,
|
|
|
+ remark = x.Remark,
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ if (goodsInfos.Any())
|
|
|
+ {
|
|
|
+ int index = 1;
|
|
|
+ goodsInfos.ForEach(x =>
|
|
|
+ {
|
|
|
+ detailsText.Append($"{index}.{x.goodsName}({x.goodsType}) 数量:{x.quantity:#0.00} 备注:{x.remark ?? "-"} <br/>");
|
|
|
+ index++;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else detailsText.Append($"暂无数据!");
|
|
|
+ item.GoodsDetails = detailsText.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ _jv.Code = StatusCodes.Status200OK;
|
|
|
+ _jv.Msg = $"操作成功!";
|
|
|
+ _jv.Data = receiveList;
|
|
|
+ _jv.Count = total;
|
|
|
+ return _jv;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 物品领用 批量 详情
|