diff --git a/DOAN.Service/MES/mm/line/MmLineInventoryService.cs b/DOAN.Service/MES/mm/line/MmLineInventoryService.cs index ddd5a67..a236993 100644 --- a/DOAN.Service/MES/mm/line/MmLineInventoryService.cs +++ b/DOAN.Service/MES/mm/line/MmLineInventoryService.cs @@ -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 /// 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; } } } \ No newline at end of file