From 710e66c86fd45ea7a7bbbf97e527aa10ac84b151 Mon Sep 17 00:00:00 2001
From: 18942506660 <18942506660@A18942506660>
Date: Fri, 1 Mar 2024 10:19:31 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/WMS.Web.Domain/Entitys/Box.cs | 32 ++++++++++++-------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/src/WMS.Web.Domain/Entitys/Box.cs b/src/WMS.Web.Domain/Entitys/Box.cs
index 7cf68819..66dbbe62 100644
--- a/src/WMS.Web.Domain/Entitys/Box.cs
+++ b/src/WMS.Web.Domain/Entitys/Box.cs
@@ -54,7 +54,7 @@ namespace WMS.Web.Domain.Entitys
/// 创建时间(对应老OPS的创建时间)
///
public DateTime CreateTime { get; set; } = DateTime.Now;
-
+
///
/// 明细
///
@@ -63,7 +63,7 @@ namespace WMS.Web.Domain.Entitys
//移出
public Result Out(List<(int MaterialId, decimal Qty, List SerialNumbers)> list)
{
- foreach(var l in list)
+ foreach (var l in list)
{
var d = this.Details.FirstOrDefault(f => f.MaterialId == l.MaterialId);
if (d == null) return Result.ReFailure(ResultCodes.BoxMateriaNoData);
@@ -85,7 +85,7 @@ namespace WMS.Web.Domain.Entitys
this.Details.Add(new BoxDetails()
{
MaterialId = l.MaterialId,
- Qty=l.Qty,
+ Qty = l.Qty,
//SerialNumbers=l.SerialNumbers
});
continue;
@@ -100,12 +100,12 @@ namespace WMS.Web.Domain.Entitys
public Result TakeStock(int materialId, decimal qty)
{
var d = this.Details.FirstOrDefault(f => f.MaterialId == materialId);
- if(d==null)
+ if (d == null)
{
this.Details.Add(new BoxDetails()
{
MaterialId = materialId,
- Qty= qty
+ Qty = qty
});
}
return Result.ReSuccess();
@@ -119,16 +119,17 @@ namespace WMS.Web.Domain.Entitys
public Result BackRecordUp(int materialId, decimal qty)
{
var d = this.Details.FirstOrDefault(f => f.MaterialId == materialId);
- if(d==null)
+ if (d == null)
{
this.Details.Add(new BoxDetails()
{
MaterialId = materialId,
Qty = qty
});
- }else
+ }
+ else
{
- d.Qty = d.Qty + qty;
+ d.Qty = qty;
}
return Result.ReSuccess();
}
@@ -141,18 +142,9 @@ namespace WMS.Web.Domain.Entitys
public Result BackRecordDown(int materialId, decimal qty)
{
var d = this.Details.FirstOrDefault(f => f.MaterialId == materialId);
- if (d == null)
- {
- this.Details.Add(new BoxDetails()
- {
- MaterialId = materialId,
- Qty = qty
- });
- }
- else
- {
- d.Qty = d.Qty + qty;
- }
+ if (d != null)
+ d.Qty = (d.Qty - qty) > 0 ? (d.Qty - qty) : 0;
+
return Result.ReSuccess();
}
}