执行代码清理,修复warning
This commit is contained in:
@@ -29,11 +29,15 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
public async Task<dynamic> MESCarryQuery(MESCarryQueryInput input)
|
||||
{
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
var data = new List<CarryQueryOutput>();
|
||||
if (input.IsNull())
|
||||
{
|
||||
throw new ArgumentNullException("input");
|
||||
}
|
||||
|
||||
List<CarryQueryOutput> data = new();
|
||||
try
|
||||
{
|
||||
var carrys = await _db.Queryable<WmsCarryH>()
|
||||
List<WmsCarryH> carrys = await _db.Queryable<WmsCarryH>()
|
||||
.InnerJoin<WmsCollocationSchemeH>((a, b) => a.collocation_scheme_id == b.id)
|
||||
.Where((a, b) => a.carry_code.Contains(input.carry_code) || b.bill_name.Contains(input.collocation_scheme_name))
|
||||
.ToListAsync();
|
||||
@@ -56,18 +60,26 @@ namespace Tnb.WarehouseMgr
|
||||
//[NonUnify]
|
||||
public async Task<dynamic> MESCarryQueryResult(MESCarryQueryResultInput input)
|
||||
{
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
var data = new CarryQueryOutput();
|
||||
if (input.IsNull())
|
||||
{
|
||||
throw new ArgumentNullException("input");
|
||||
}
|
||||
|
||||
CarryQueryOutput data = new();
|
||||
try
|
||||
{
|
||||
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);
|
||||
WmsCarryH 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);
|
||||
}
|
||||
|
||||
Dictionary<string, object> mCarryIdDic = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carry.id).ToDictionaryAsync(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;
|
||||
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id).LeftJoin<WmsInstockH>((a, b, c) => a.carry_id == c.carry_id)
|
||||
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id).LeftJoin<WmsInstockH>((a, b, c) => a.carry_id == c.carry_id)
|
||||
.Where(whereExp)
|
||||
.Select((a, b, c) => new WmsCarryCode
|
||||
{
|
||||
@@ -78,9 +90,13 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic?.Count > 0)
|
||||
{
|
||||
if (carryCodes.Count < mCarryIdDic.Keys?.Count) throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500);
|
||||
var i = 0;
|
||||
foreach (var (_, v) in mCarryIdDic)
|
||||
if (carryCodes.Count < mCarryIdDic.Keys?.Count)
|
||||
{
|
||||
throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
foreach ((string _, object v) in mCarryIdDic)
|
||||
{
|
||||
carryCodes[i].member_carrycode = v?.ToString() ?? string.Empty;
|
||||
i++;
|
||||
|
||||
Reference in New Issue
Block a user