From 2acada906cf977bed8d8ecde7a48e4a8fef2c7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E6=B1=9F=E6=B5=B7?= <18360817963@163.com> Date: Mon, 31 Mar 2025 13:36:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=98=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MES/mm/line/MmLineInventoryService.cs | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) 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