盘点没有箱库存 可以盘进库存
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using WMS.Web.Core;
|
||||
@@ -56,6 +57,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("SubStockCode")]
|
||||
public string SubStockCode { get; set; }
|
||||
/// <summary>
|
||||
/// 老仓位(如果更好了仓位 这里就是原有仓位)
|
||||
/// 如果没有更换仓位 那老仓位和新仓位就是一样的值
|
||||
/// </summary>
|
||||
[Column("Old_SubStockCode")]
|
||||
public string Old_SubStockCode { get; set; }
|
||||
/// <summary>
|
||||
/// 子仓库(跟金蝶交互字段)
|
||||
/// </summary>
|
||||
[Column("Erp_SubStockCode")]
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<BoxInventory> Get(int id);
|
||||
// 新增
|
||||
Task<BoxInventory> Add(BoxInventory entity, bool isTransaction = true);
|
||||
/// <summary>
|
||||
/// 批量添加
|
||||
/// </summary>
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace WMS.Web.Domain.Services
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
{
|
||||
_logger.LogInformation("移箱-箱库存变更:失败->" + ResultCodes.InventoryNoSourceError.Item2+",参数->" + JsonConvert.SerializeObject(dtoDatas));
|
||||
_logger.LogInformation("移箱-箱库存变更:失败->" + ResultCodes.InventoryNoSourceError.Item2 + ",参数->" + JsonConvert.SerializeObject(dtoDatas));
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ namespace WMS.Web.Domain.Services
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoData == null)
|
||||
{
|
||||
_logger.LogInformation("入库回退上下架-箱库存的变更:失败->"+ ResultCodes.InventoryNoSourceError.Item2+",参数->"+ JsonConvert.SerializeObject(dtoData));
|
||||
_logger.LogInformation("入库回退上下架-箱库存的变更:失败->" + ResultCodes.InventoryNoSourceError.Item2 + ",参数->" + JsonConvert.SerializeObject(dtoData));
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ namespace WMS.Web.Domain.Services
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
{
|
||||
_logger.LogInformation("盘点单-箱库存的变更:失败->"+ ResultCodes.InventoryNoSourceError.Item2 +",参数->"+ JsonConvert.SerializeObject(dtoDatas));
|
||||
_logger.LogInformation("盘点单-箱库存的变更:失败->" + ResultCodes.InventoryNoSourceError.Item2 + ",参数->" + JsonConvert.SerializeObject(dtoDatas));
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ namespace WMS.Web.Domain.Services
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoData == null)
|
||||
{
|
||||
_logger.LogInformation("入库单-箱库存的变更:失败->"+ ResultCodes.InventoryNoSourceError.Item2+",参数->" + JsonConvert.SerializeObject(dtoData));
|
||||
_logger.LogInformation("入库单-箱库存的变更:失败->" + ResultCodes.InventoryNoSourceError.Item2 + ",参数->" + JsonConvert.SerializeObject(dtoData));
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ namespace WMS.Web.Domain.Services
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoData == null)
|
||||
{
|
||||
_logger.LogInformation("出库单-箱库存的变更:失败->" + ResultCodes.InventoryNoSourceError.Item2+",参数->"+ JsonConvert.SerializeObject(dtoData));
|
||||
_logger.LogInformation("出库单-箱库存的变更:失败->" + ResultCodes.InventoryNoSourceError.Item2 + ",参数->" + JsonConvert.SerializeObject(dtoData));
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ namespace WMS.Web.Domain.Services
|
||||
}
|
||||
}
|
||||
_logger.LogInformation("出库单-箱库存的变更:成功,参数->" + JsonConvert.SerializeObject(dtoData));
|
||||
var lastBoxInventList= await _boxInventoryRepositories.GetList(boxIds);
|
||||
var lastBoxInventList = await _boxInventoryRepositories.GetList(boxIds);
|
||||
_logger.LogInformation("出库单-箱库存的变更:成功,处理后的箱是否存在的箱->" + JsonConvert.SerializeObject(lastBoxInventList));
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
@@ -1324,8 +1324,22 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
//3.1入库的时候:盘点-箱一定是存在于库存
|
||||
var boxInvent = boxInventorys.Where(x => x.BoxId == dto.BoxId).FirstOrDefault();
|
||||
//if (boxInvent == null)
|
||||
// return Result.ReFailure(ResultCodes.BoxInventoryHaveInventoryError);
|
||||
//v1.0.6版本 如果没有箱库存就添加
|
||||
if (boxInvent == null)
|
||||
return Result.ReFailure(ResultCodes.BoxInventoryHaveInventoryError);
|
||||
{
|
||||
BoxInventory box_add = new BoxInventory()
|
||||
{
|
||||
BoxId = dto.BoxId,
|
||||
OrgCode = dto.OrgCode,
|
||||
StockCode = dto.StockCode,
|
||||
SubStockCode = dto.SubStockCode
|
||||
};
|
||||
boxInvent = await _boxInventoryRepositories.Add(box_add);
|
||||
if (boxInvent == null) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
boxInventorys.Add(boxInvent);
|
||||
}
|
||||
|
||||
//3.2组装要新增的箱库存信息:箱和明细和序列号
|
||||
var updateEntity = boxInvent;
|
||||
|
||||
@@ -193,6 +193,34 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
return await _context.BoxInventory.Include(x => x.Details).Where(x => x.BoxId == id).FirstOrDefaultAsync();
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加及时库存
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<BoxInventory> Add(BoxInventory entity, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
await _context.BoxInventory.AddAsync(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
return entity;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量添加
|
||||
|
||||
Reference in New Issue
Block a user