调整箱信息接口

This commit is contained in:
18942506660
2023-11-01 16:29:30 +08:00
parent 57b4116031
commit 0f66efa9e2
10 changed files with 110 additions and 55 deletions

View File

@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -115,20 +116,23 @@ namespace WMS.Web.Api.Controllers
/// <summary>
/// 根据箱号获取箱信息
/// </summary>
/// <param name="billNo">必填</param>
/// <param name="billNos">必填</param>
/// <returns></returns>
[HttpGet]
[Route("GetBox")]
public async Task<Result<BoxResponse>> GetBox([FromQuery] string billNo)
public async Task<ResultList<BoxResponse>> GetBox([FromQuery] List<string> billNos)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return Result<BoxResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
if (string.IsNullOrEmpty(billNo))
return Result<BoxResponse>.ReSuccess(null);
return ResultList<BoxResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
var r = await _boxRepositories.GetBox(billNo);
return Result<BoxResponse>.ReSuccess(r);
var res = await _boxRepositories.GetBox(billNos);
var bStrList = res.Select(s => s.BoxBillNo).ToList();
var ex = billNos.Except(bStrList).ToList();
if (ex.Count() > 0)
return ResultList<BoxResponse>.ReFailure("箱号" + JsonConvert.SerializeObject(ex) + "不存在", 800000);
return ResultList<BoxResponse>.ReSuccess(res);
}
}
}