This commit is contained in:
tongfei
2024-04-03 17:22:21 +08:00
4 changed files with 28 additions and 11 deletions

View File

@@ -92,6 +92,11 @@ namespace WMS.Web.Domain.Entitys
///</summary>
[Column("CustomerId")]
public int CustomerId { get; set; } = 0;
/// <summary>
/// 是否出库
///</summary>
[Column("IsOutStock")]
public bool? IsOutStock { get; set; } = false;
/// <summary>
/// 操作(绑定箱信息)
@@ -126,6 +131,8 @@ namespace WMS.Web.Domain.Entitys
this.CustomerId = outStock.ReceiptCustomerId;
this.OutStockTime = DateTime.Now;
}
//标识出库
this.IsOutStock = true;
}
/// <summary>
/// 入库

View File

@@ -81,5 +81,10 @@ namespace WMS.Web.Domain.Entitys
///</summary>
[Column("CustomerId")]
public int CustomerId { get; set; } = 0;
/// <summary>
/// 是否出库
///</summary>
[Column("IsOutStock")]
public bool? IsOutStock { get; set; } = false;
}
}

View File

@@ -180,6 +180,7 @@ namespace WMS.Web.Domain.Services
var serialNumbers = outStock.Details.SelectMany(s => s.SerialNumbers).ToList();
var entityList = await _serialNumbersRepositories.GetEntityList(serialNumbers);
var boxIds = entityList.Select(s => s.BoxId).ToList();
boxIds.AddRange(outStock.Details.SelectMany(s => s.BoxsDetails).Select(s => s.BoxId));
var boxList = await _boxRepositories.GetEntityList(boxIds);
var userName = _singleDataService.GetSingleData(SingleAction.Staffs, loginInfo.UserInfo.CompanyId, loginInfo.UserInfo.StaffId);
@@ -191,7 +192,8 @@ namespace WMS.Web.Domain.Services
List<SerialNumberOperate> sList = new List<SerialNumberOperate>();
foreach (var entity in entityList)
{
var box = boxList.FirstOrDefault(f => f.Id == entity.BoxId);
var boxId = outStock.Details.SelectMany(s => s.BoxsDetails).FirstOrDefault(w => w.SerialNumbers.Contains(entity.SerialNumber))?.BoxId ?? 0;
var box = boxList.FirstOrDefault(f => f.Id == boxId);
var outstockDetail = outStock.Details.FirstOrDefault(f => f.MaterialNumber == entity.MaterialNumber);
if (outstockDetail == null) continue;
//修改序列号和箱绑定关系
@@ -202,8 +204,8 @@ namespace WMS.Web.Domain.Services
{
MaterialNumber = entity.MaterialNumber,
SerialNumber = entity.SerialNumber,
OrgId = box.OrgId,
SupplierId = box.SupplierId,
OrgId = box?.OrgId ?? 0,
SupplierId = box?.SupplierId ?? 0,
OperateTime = DateTime.Now,
OperateType = OutStockTypeConvert(outStock.Type),
OperateUser = userName,
@@ -391,7 +393,10 @@ namespace WMS.Web.Domain.Services
//if (backRecord.Type == BackRecordType.InstockOff)
// entity.UnBind();
if (backRecord.Type == BackRecordType.OutstockOn)
{
entity.Bind(detail.BoxId, box.CompleteCartonTime);
entity.IsOutStock = false;//标识出库状态
}
//记录序列号操作日志

View File

@@ -248,7 +248,7 @@ namespace WMS.Web.Repositories
.SelectMany(x => x.boxInventory.DefaultIfEmpty(), (p, boxInventory) => new { p.serial, boxInventory })
.GroupJoin(_context.Box, s => s.serial.BoxId, box => box.Id, (s, box) => new { s.serial, s.boxInventory, box })
.SelectMany(x => x.box.DefaultIfEmpty(), (p, box) => new { p.serial, p.boxInventory, box })
.FirstOrDefaultAsync(w => serialNumber.Equals(w.serial.SerialNumber));
.FirstOrDefaultAsync(w => serialNumber.Equals(w.serial.SerialNumber) && w.serial.IsOutStock != true);
if (entity == null || entity.serial == null)
{
if (IsOps)
@@ -289,7 +289,7 @@ namespace WMS.Web.Repositories
//.SelectMany(x => x.boxInventory.DefaultIfEmpty(), (p, boxInventory) => new { p.serial, boxInventory })
//.GroupJoin(_context.Box, s => s.serial.BoxId, box => box.Id, (s, box) => new { s.serial, s.boxInventory, box })
//.SelectMany(x => x.box.DefaultIfEmpty(), (p, box) => new { p.serial, p.boxInventory, box })
.FirstOrDefaultAsync(w => serialNumber.Equals(w.SerialNumber));
.FirstOrDefaultAsync(w => serialNumber.Equals(w.SerialNumber) && w.IsOutStock != true);
if (entity == null) return null;
response.IsOldOps = true;
response.IsBoxInventory = true;//如果是老ops序列号 默认有库存