This commit is contained in:
卢江海 2025-03-31 13:36:19 +08:00
parent 5a759a2cc6
commit 2acada906c

View File

@ -209,9 +209,9 @@ namespace DOAN.Service.MES.mm.line
{
throw new Exception("线别或物料编号不能为空");
}
if (Quantity <= 0)
if (Quantity < 0)
{
throw new Exception("出库数量要大于0");
throw new Exception("出库数量不能小于0");
}
//根据线别,物料条码,批号 看库里有没有这条入库数据
MmLineInventory mmLineInventory = Queryable()
@ -310,11 +310,32 @@ namespace DOAN.Service.MES.mm.line
/// <exception cref="Exception"></exception>
public int stocktakeLineMaterial(string Id, int Quantity)
{
int result = 0;
if (string.IsNullOrEmpty(Id))
{
throw new Exception("Id不能为空");
}
return 0;
if (Quantity < 0)
{
throw new Exception("盘点数量不能小于0");
}
MmLineInventory mmLineInventory = Queryable().Where(x => x.Id == Id).First();
if (mmLineInventory== null)
{
throw new Exception("查找不到数据");
}
int begin = mmLineInventory.Quantity.Value;
mmLineInventory.Quantity = Quantity;
mmLineInventory.Updatetime = DateTime.Now;
mmLineInventory.Updateby = "系统";
result = Context.Updateable(mmLineInventory).ExecuteCommand();
if (result == 1)
{
OperationLogRecording(2, 5, mmLineInventory.MaterialCode, mmLineInventory.MaterialName, mmLineInventory.LineCode, begin, Quantity, mmLineInventory.LocationCode);
}
return result;
}
}
}