再次修改
This commit is contained in:
@@ -124,30 +124,41 @@ namespace BarCode.Web.Domain.Entitys
|
|||||||
/// /// <param name="isNotCount">是否不计数</param>
|
/// /// <param name="isNotCount">是否不计数</param>
|
||||||
public Result UnSerialNumber(string serialNumber, string materialNumber,string isNotCount)
|
public Result UnSerialNumber(string serialNumber, string materialNumber,string isNotCount)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var detail = this.Details.FirstOrDefault(f => f.MaterialNumber.Equals(materialNumber));
|
var detail = this.Details.FirstOrDefault(f => f.MaterialNumber.Equals(materialNumber));
|
||||||
if (detail == null)
|
|
||||||
return Result.ReFailure(ResultCodes.BoxMaterialNoDataError);
|
if (isNotCount != "1")
|
||||||
var serial = detail.SerialNumbers.FirstOrDefault(f => f.Equals(serialNumber));
|
{
|
||||||
if (serial == null && isNotCount!="1")
|
if (detail == null)
|
||||||
return Result.ReFailure(ResultCodes.BoxSerialNumberNoDataError);
|
return Result.ReFailure(ResultCodes.BoxMaterialNoDataError);
|
||||||
|
var serial = detail.SerialNumbers.FirstOrDefault(f => f.Equals(serialNumber));
|
||||||
|
if (serial == null)
|
||||||
|
return Result.ReFailure(ResultCodes.BoxSerialNumberNoDataError);
|
||||||
|
}
|
||||||
|
if(detail!=null)
|
||||||
|
{
|
||||||
detail.SerialNumbers.Remove(serialNumber);
|
detail.SerialNumbers.Remove(serialNumber);
|
||||||
|
if (isNotCount == "1")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
detail.Qty = detail.Qty - 1;
|
||||||
|
}
|
||||||
|
//如果数量为0了就删除这条明细
|
||||||
|
if (detail.Qty <= 0)
|
||||||
|
this.Details.Remove(detail);
|
||||||
|
//如果没有明细了 就把状态改成未使用
|
||||||
|
if (detail.Qty <= 0)
|
||||||
|
this.Status = BoxStatus.NoUse;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// detail.Qty = detail.SerialNumbers.Count();
|
// detail.Qty = detail.SerialNumbers.Count();
|
||||||
if(isNotCount=="1")
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
detail.Qty = detail.Qty - 1;
|
|
||||||
}
|
|
||||||
//如果数量为0了就删除这条明细
|
|
||||||
if (detail.Qty <= 0)
|
|
||||||
this.Details.Remove(detail);
|
|
||||||
//如果没有明细了 就把状态改成未使用
|
|
||||||
if (detail.Qty <= 0)
|
|
||||||
this.Status = BoxStatus.NoUse;
|
|
||||||
|
|
||||||
////如果数量为0了就删除这条明细
|
////如果数量为0了就删除这条明细
|
||||||
//if (detail.SerialNumbers.Count() <= 0)
|
//if (detail.SerialNumbers.Count() <= 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user