From 09344a78396401ea7b3ea0762262456ef9592a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83?= <15095123350@163.com> Date: Mon, 12 Aug 2024 10:30:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=83=8C=E8=B4=9FAgv?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs | 13 +++++-------- src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs b/src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs index 0994da3..dd7e472 100644 --- a/src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs +++ b/src/Khd.Core.Wcs/Wcs/CreateTaskByRecord.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SixLabors.ImageSharp; using System.Data; +using System.Linq; using Z.EntityFramework.Plus; namespace Khd.Core.Wcs.Wcs @@ -1792,7 +1793,6 @@ namespace Khd.Core.Wcs.Wcs dbContext.SaveChanges(); } } - foreach (var item in rawOutStock) { if (item.endStationCode == "BB_01") @@ -1996,7 +1996,7 @@ namespace Khd.Core.Wcs.Wcs foreach (var task in tasks) { var wmsRawStock = rawStock.Where(t => t.palletInfoCode == task.containerNo && t.materialId == order.MaterialId && t.saleOrderId == order.SaleOrderId).ToList(); - decimal? total = wmsRawStock.Sum(t => t.totalAmount - t.frozenAmount); + decimal? total = wmsRawStock.Sum(t => t.totalAmount)- wmsRawStock.Sum(t => t.frozenAmount); needNumber -= total; WmsBaseLocation wmsBaseLocation = AllWmsBaseLocations.Where(t => t.locationCode == task.currPointNo).First(); index = wmsBaseLocation.locRow; @@ -2054,23 +2054,20 @@ namespace Khd.Core.Wcs.Wcs int qty = 0; if (stock.totalAmount - stock.frozenAmount <= needNumber)//该料箱全部出 { - needNumber -= stock.totalAmount - stock.frozenAmount; - RealOutNumber += stock.totalAmount - stock.frozenAmount; + needNumber -= (stock.totalAmount - stock.frozenAmount); qty = Convert.ToInt32(stock.totalAmount - stock.frozenAmount); stock.updateDate = DateTime.Now; } else { - RealOutNumber += needNumber; qty = Convert.ToInt32(needNumber); - needNumber = 0; - + needNumber = 0; stock.updateDate = DateTime.Now; } WmsRawOutstock? wmsRawOutstock = orderList.Where(t => t.materialId == order.MaterialId).FirstOrDefault(); if (wmsRawOutstock != null) { - WcsTask wcsTask = new WcsTask() + var wcsTask = new WcsTask() { objid = StaticData.SnowId.NextId(), orderId = wmsRawOutstock.rawOutstockId, diff --git a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs index 7407769..6fa0695 100644 --- a/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs +++ b/src/Khd.Core.Wpf/Form/FormBoardT.xaml.cs @@ -1348,7 +1348,7 @@ namespace Khd.Core.Wpf.Form wcsTask.objid = Global.SnowId.NextId(); WcsTaskLog wcsTaskLog = CoreMapper.Map(wcsTask); dbContext.Add(wcsTaskLog); - dbContext.Update(wcsTask); + dbContext.Add(wcsTask); } else if (messageBoxResult == MessageBoxResult.Cancel) {