盘点没有箱库存 可以盘进库存
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using WMS.Web.Core;
|
using WMS.Web.Core;
|
||||||
@@ -56,6 +57,12 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
[Column("SubStockCode")]
|
[Column("SubStockCode")]
|
||||||
public string SubStockCode { get; set; }
|
public string SubStockCode { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 老仓位(如果更好了仓位 这里就是原有仓位)
|
||||||
|
/// 如果没有更换仓位 那老仓位和新仓位就是一样的值
|
||||||
|
/// </summary>
|
||||||
|
[Column("Old_SubStockCode")]
|
||||||
|
public string Old_SubStockCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// 子仓库(跟金蝶交互字段)
|
/// 子仓库(跟金蝶交互字段)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Column("Erp_SubStockCode")]
|
[Column("Erp_SubStockCode")]
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<BoxInventory> Get(int id);
|
Task<BoxInventory> Get(int id);
|
||||||
|
// 新增
|
||||||
|
Task<BoxInventory> Add(BoxInventory entity, bool isTransaction = true);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 批量添加
|
/// 批量添加
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1324,8 +1324,22 @@ namespace WMS.Web.Domain.Services
|
|||||||
{
|
{
|
||||||
//3.1入库的时候:盘点-箱一定是存在于库存
|
//3.1入库的时候:盘点-箱一定是存在于库存
|
||||||
var boxInvent = boxInventorys.Where(x => x.BoxId == dto.BoxId).FirstOrDefault();
|
var boxInvent = boxInventorys.Where(x => x.BoxId == dto.BoxId).FirstOrDefault();
|
||||||
|
//if (boxInvent == null)
|
||||||
|
// return Result.ReFailure(ResultCodes.BoxInventoryHaveInventoryError);
|
||||||
|
//v1.0.6版本 如果没有箱库存就添加
|
||||||
if (boxInvent == null)
|
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组装要新增的箱库存信息:箱和明细和序列号
|
//3.2组装要新增的箱库存信息:箱和明细和序列号
|
||||||
var updateEntity = boxInvent;
|
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();
|
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>
|
/// <summary>
|
||||||
/// 批量添加
|
/// 批量添加
|
||||||
|
|||||||
Reference in New Issue
Block a user