新增物料标签查询接口

This commit is contained in:
alex
2023-08-23 14:58:09 +08:00
parent 3583c520c2
commit 62e1cd910a
5 changed files with 132 additions and 3 deletions

View File

@@ -72,7 +72,6 @@ namespace Tnb.WarehouseMgr
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(a => a.carry_code == input.carry_code && a.status == 1);
if (carry.IsNull()) throw new AppFriendlyException($"编号{input.carry_code},对应载具不存在或被禁用", 500);
var mCarryIdDic = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carry.id).ToDictionaryAsync(x => x.membercarry_id, x => x.membercarry_code);
//var mCarryIdDic = carryDsLst.ToDictionary(x => x.membercarry_id, x => x.membercarry_code);
Expression<Func<WmsCarryCode, bool>> whereExp = carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic.Keys?.Count > 0
? a => mCarryIdDic.Keys.Contains(a.carry_id)
: a => a.carry_id == carry.id;

View File

@@ -7,6 +7,7 @@ using Aop.Api.Domain;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Extension;
using JNPF.Common.Filter;
using JNPF.Common.Security;
using JNPF.FriendlyException;
using JNPF.Logging;
@@ -26,6 +27,8 @@ using Tnb.WarehouseMgr.Entities.Attributes;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
using Tnb.WarehouseMgr.Entities.Dto.Queries;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
@@ -481,5 +484,31 @@ namespace Tnb.WarehouseMgr
}
return isSuccessFul;
}
/// <summary>
/// 物料标签查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> MesFetchInOutStockInfoByBarCode(MaterialLabelQuery input)
{
var pagedList = await _db.Queryable<WmsInstockH>().InnerJoin<WmsInstockCode>((a, b) => a.id == b.bill_id)
.LeftJoin<WmsOutstockCode>((a, b, c) => b.barcode == c.barcode)
.WhereIF(!string.IsNullOrEmpty(input.org_id), (a, b, c) => a.org_id == input.org_id)
.Where((a, b, c) => input.barcode.Contains(b.barcode))
.Select((a, b, c) => new MaterailLabelOutput
{
barcode_qty = b.codeqty,
in_bill_code = a.bill_code,
out_bill_code = SqlFunc.Subqueryable<WmsOutstockH>().Where(it => it.id == c.bill_id).Select(it => it.bill_code),
instock_time = a.create_time,
outstock_time = SqlFunc.Subqueryable<WmsOutstockH>().Where(it => it.id == c.bill_id).Select(it => it.create_time),
}, true)
.ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<MaterailLabelOutput>.SqlSugarPageResult(pagedList); ;
}
}
}