|
@@ -292,8 +292,6 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
|
|
|
gs.BatchNo,
|
|
|
GoodsName = gi.Name,
|
|
|
gs.Quantity,
|
|
|
- gs.ReceiveQuantity,
|
|
|
- QuantityStatusText = gs.Quantity - gs.ReceiveQuantity == 0 ? "已领用完" : "-",
|
|
|
gs.UnitPrice,
|
|
|
gs.TotalPrice,
|
|
|
gs.SupplierName,
|
|
@@ -518,20 +516,54 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
|
|
|
/// <returns></returns>
|
|
|
public async Task<JsonView> GoodsReceiveList(GoodsReceiveListDTO dto)
|
|
|
{
|
|
|
+ //参数处理
|
|
|
+ int[] typeLabel = new int[] { },
|
|
|
+ userLabel = new int[] { };
|
|
|
+ if (!string.IsNullOrEmpty(dto.TypeLabel))
|
|
|
+ {
|
|
|
+ typeLabel = dto.TypeLabel
|
|
|
+ .Split(',')
|
|
|
+ .Select(x =>
|
|
|
+ {
|
|
|
+ if (int.TryParse(x, out var id)) return id;
|
|
|
+ return id;
|
|
|
+ })
|
|
|
+ .ToArray();
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(dto.UserLabel))
|
|
|
+ {
|
|
|
+ userLabel = dto.UserLabel
|
|
|
+ .Split(',')
|
|
|
+ .Select(x =>
|
|
|
+ {
|
|
|
+ if (int.TryParse(x, out var id)) return id;
|
|
|
+ return id;
|
|
|
+ })
|
|
|
+ .ToArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ //物品ID和物品名称只能传一个
|
|
|
+ if (dto.GoodsId > 0) dto.GoodsName = string.Empty;
|
|
|
+ if (!string.IsNullOrEmpty(dto.GoodsName)) dto.GoodsId = 0;
|
|
|
+
|
|
|
RefAsync<int> total = 0;
|
|
|
var data = await _sqlSugar.Queryable<Pm_GoodsReceive>()
|
|
|
.LeftJoin<Pm_GoodsInfo>((gr, gi) => gr.GoodsId == gi.Id)
|
|
|
- .LeftJoin<Sys_Users>((gr, gi, u1) => gr.AuditUserId == u1.Id)
|
|
|
- .LeftJoin<Sys_Users>((gr, gi, u1, u2) => gr.CreateUserId == u2.Id)
|
|
|
- .Where((gr, gi, u1, u2) => gr.IsDel == 0)
|
|
|
- .WhereIF(dto.GoodsId > 0, (gr, gi, u1, u2) => gr.GoodsId == dto.GoodsId)
|
|
|
- .WhereIF(dto.CurrUserId > 0, (gr, gi, u1, u2) => gr.CreateUserId == dto.CurrUserId)
|
|
|
- .Select((gr, gi, u1, u2) => new GoodsReceiveListView
|
|
|
+ .LeftJoin<Sys_SetData>((gr, gi,sd) => gi.Type == sd.Id)
|
|
|
+ .LeftJoin<Sys_Users>((gr, gi,sd,u1) => gr.AuditUserId == u1.Id)
|
|
|
+ .LeftJoin<Sys_Users>((gr, gi,sd, u1, u2) => gr.CreateUserId == u2.Id)
|
|
|
+ .Where((gr, gi, sd, u1, u2) => gr.IsDel == 0)
|
|
|
+ .WhereIF(dto.GoodsId > 0, (gr, gi, sd, u1, u2) => gr.GoodsId == dto.GoodsId)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.GoodsName), (gr, gi, sd, u1, u2) => gi.Name.Contains(dto.GoodsName))
|
|
|
+ .WhereIF(typeLabel.Length > 0, (gr, gi, sd, u1, u2) => typeLabel.Contains(gi.Type))
|
|
|
+ .WhereIF(userLabel.Length > 0, (gr, gi, sd, u1, u2) => userLabel.Contains(gr.CreateUserId))
|
|
|
+ .Select((gr, gi, sd, u1, u2) => new GoodsReceiveListView
|
|
|
{
|
|
|
Id = gr.Id,
|
|
|
GroupId = gr.GroupId,
|
|
|
GoodsId = gr.GoodsId,
|
|
|
GoodsName = gi.Name,
|
|
|
+ GoodsType = sd.Name,
|
|
|
Quantity = gr.Quantity,
|
|
|
Reason = gr.Reason,
|
|
|
Remark = gr.Remark,
|
|
@@ -594,6 +626,7 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
|
|
|
var subData1 = JsonConvert.DeserializeObject<List<GoodsReceiveLinkStorageView>>(data.GoodsStorageInfo);
|
|
|
if (subData1.Count > 0)
|
|
|
{
|
|
|
+ string quantityInfosStr = string.Empty;
|
|
|
var storageIds = subData1.Select(x => x.StorageId).ToList();
|
|
|
var storages = await _sqlSugar.Queryable<Pm_GoodsStorage>().Where(x => x.IsDel == 0 && storageIds.Contains(x.Id)).ToListAsync();
|
|
|
foreach (var item in subData1)
|
|
@@ -607,9 +640,11 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
|
|
|
BatchNo = storageInfo.BatchNo,
|
|
|
RecsiveQuantity = item.Quantity
|
|
|
});
|
|
|
+ quantityInfosStr += $"物品名称:{data.GoodsName} 批次号:{storageInfo.BatchNo} 领用数量:{item.Quantity} \r\n";
|
|
|
}
|
|
|
}
|
|
|
data.QuantityInfos = subData;
|
|
|
+ data.QuantityInfosStr = quantityInfosStr;
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e)
|