非采购上架接口

This commit is contained in:
tongfei
2023-11-09 14:07:49 +08:00
22 changed files with 507 additions and 150 deletions

View File

@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -7,6 +8,7 @@ using System.Linq;
using System.Threading.Tasks;
using WMS.Web.Core;
using WMS.Web.Core.Dto;
using WMS.Web.Core.Dto.Erp;
using WMS.Web.Core.Dto.SingleData;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Infrastructure;
@@ -123,22 +125,22 @@ namespace WMS.Web.Api.Controllers
/// <summary>
/// 根据仓库获取金蝶子仓库
/// </summary>
/// <param name="id">仓库id</param>
/// <param name="number">仓库编码</param>
/// <param name="name">模糊匹配</param>
/// <returns></returns>
[HttpGet]
[Route("GetErp_SubUcStock/{id}")]
public async Task<Result<List<UcStockResponse>>> GetErp_SubUcStock([FromRoute] int id)
[Route("GetErp_SubUcStock/{number}")]
public async Task<Result<List<UcStockResponse>>> GetErp_SubUcStock([FromRoute] string number, [FromQuery] string name)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return Result<List<UcStockResponse>>.ReFailure(ResultCodes.Token_Invalid_Error);
List<UcStockResponse> list = new List<UcStockResponse>();
var code = _singleDataService.GetSingleDataCode(SingleAction.Stocks, loginInfo.UserInfo.CompanyId, id);
if (code.Substring(0, 2).Equals("HD") || code.Substring(0, 2).Equals("GD"))
if (number.Substring(0, 2).Equals("HD") || number.Substring(0, 2).Equals("GD"))
{
var subs = await _erpService.BillQueryForSubStock(code);
foreach (var s in subs.Data)
var subs = await _erpService.BillQueryForSubStock(number);
foreach (var s in subs.Data.Where(w=> EF.Functions.Like(w.Name, "%" + name + "%")))
{
list.Add(new UcStockResponse()
{
@@ -152,6 +154,42 @@ namespace WMS.Web.Api.Controllers
return Result<List<UcStockResponse>>.ReSuccess(list);
}
/// <summary>
/// 获取出库单客户下拉列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetCustomers")]
public async Task<Result<List<PullDownStrResponse>>> GetCustomers()
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return Result<List<PullDownStrResponse>>.ReFailure(ResultCodes.Token_Invalid_Error);
var customers = await _erpService.BillQueryForCustomer();
var orgs = await _erpService.BillQueryForOrg();
List<PullDownStrResponse> pullList = new List<PullDownStrResponse>();
foreach (var c in customers.Data)
{
pullList.Add(new PullDownStrResponse()
{
Id = "c_" + c.Id,
Name = c.Name,
Code = c.Number
});
}
foreach (var o in orgs.Data)
{
pullList.Add(new PullDownStrResponse()
{
Id = "o_" + o.Id,
Name = o.Name,
Code = o.Number
});
}
return Result<List<PullDownStrResponse>>.ReSuccess(pullList);
}
/// <summary>
/// 获取仓位:模糊名称
/// </summary>