This commit is contained in:
tongfei
2023-11-13 16:07:22 +08:00
5 changed files with 20 additions and 9 deletions

View File

@@ -100,7 +100,7 @@ namespace WMS.Web.Api.Controllers
return ResultList<GetOutStockTaskByNoResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
var res = await _repositories.GetOutStockTaskListByNo(billNo);
if (res == null) return ResultList<GetOutStockTaskByNoResponse>.ReFailure(ResultCodes.OutStockTaskNoData);
if (res == null || res.Count() == 0) return ResultList<GetOutStockTaskByNoResponse>.ReFailure(ResultCodes.OutStockTaskNoData);
return ResultList<GetOutStockTaskByNoResponse>.ReSuccess(res);
}

View File

@@ -60,6 +60,11 @@ namespace WMS.Web.Domain.Services
//nos.Add(outStockTask.SourceBillNo);
//var res = await _outStockTaskService.Ssyn(nos);
//if (!res.IsSuccess) return Result.ReSuccess();
//上传的物料在任务单里没有找到不能出库
var ex = dto.Details.Select(s=>s.MaterialId).Except(outStockTask.Details.Select(s=>s.MaterialId)).ToList();
if (ex.Count() > 0)
return Result.ReFailure(ResultCodes.OutStockMaterialError);
OutStock entity = new OutStock();
entity.Create(loginInfo.UserInfo.StaffId, outStockTask);

View File

@@ -298,7 +298,7 @@ namespace WMS.Web.Domain.Services
public async Task<Result> InStock(InStock inStock, LoginInDto loginInfo, bool isTransaction = true)
{
//获取序列号信息
var serialNumbers = new List<string>();// inStock.Details.SelectMany(s => s.SerialNumbers).ToList();
var serialNumbers = inStock.Details.SelectMany(s => s.SerialNumbers).ToList();
var entityList = await _serialNumbersRepositories.GetEntityList(serialNumbers);
var boxIds = entityList.Select(s => s.BoxId).ToList();
var boxList = await _boxRepositories.GetEntityList(boxIds);

View File

@@ -26,6 +26,7 @@ namespace WMS.Web.Domain.Values
public static ValueTuple<int, string> MergeStatusError = (70000, "所选单据数据不一致,不能合并");
public static ValueTuple<int, string> OutStockQtyError = (70001, "可出库数量不足");
public static ValueTuple<int, string> OutStockTaskNoData = (70002, "出库任务数据不存在");
public static ValueTuple<int, string> OutStockMaterialError = (70003, "出库物料在任务单中不存在");
public static ValueTuple<int, string> BoxNoData = (80000, "箱信息不存在");
public static ValueTuple<int, string> BoxMateriaNoData = (800010, "箱对应物料信息不存在");

View File

@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMS.Web.Core;
using WMS.Web.Core.Dto.Erp;
using WMS.Web.Core.Dto.OutStockTask;
using WMS.Web.Core.Help;
using WMS.Web.Domain.Entitys;
@@ -38,6 +39,7 @@ namespace WMS.Web.Repositories
_singleDataService = singleDataService;
_loginRepositories = loginRepositories;
_erpService = erpService;
_erpBasicDataExtendService = erpBasicDataExtendService;
}
/// <summary>
/// 新增
@@ -342,10 +344,13 @@ namespace WMS.Web.Repositories
return new GetOutStockTaskByNoResponse();
var materials = materials_result.Data.ToList();
var list = await _context.OutStockTask.Include(x => x.Details)
.Where(f => f.BillNo.Equals(billNo) &&
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait)).ToListAsync();
var response = _mapper.Map<GetOutStockTaskByNoResponse>(list);
var entity = await _context.OutStockTask.Include(x => x.Details)
.FirstOrDefaultAsync(f => f.BillNo.Equals(billNo) &&
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait));
if (entity == null) return new GetOutStockTaskByNoResponse();
var response = _mapper.Map<GetOutStockTaskByNoResponse>(entity);
//获取物料信息 显示物料三件套
foreach (var r in response.details)
{
@@ -357,15 +362,15 @@ namespace WMS.Web.Repositories
}
/// <summary>
/// 根据来源单号搜索
/// 单号搜索
/// </summary>
/// <param name="sourceBillNos"></param>
/// <returns></returns>
public async Task<List<OutStockTask>> GetListBySourceBillNo(List<string> sourceBillNos)
public async Task<List<OutStockTask>> GetListBySourceBillNo(List<string> billNos)
{
var entitys = await _context.OutStockTask
.Include(s => s.Details)
.Where(w => sourceBillNos.Contains(w.SourceBillNo))
.Where(w => billNos.Contains(w.BillNo))
.ToListAsync();
return entitys.Clone();