From 557348cf99757bcb3e6ff61350353d027a945f9c Mon Sep 17 00:00:00 2001 From: 18942506660 <18942506660@A18942506660> Date: Tue, 7 May 2024 17:39:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InStockTaskRepositories.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/WMS.Web.Repositories/InStockTaskRepositories.cs b/src/WMS.Web.Repositories/InStockTaskRepositories.cs index 6e150d5c..14edac67 100644 --- a/src/WMS.Web.Repositories/InStockTaskRepositories.cs +++ b/src/WMS.Web.Repositories/InStockTaskRepositories.cs @@ -180,7 +180,7 @@ namespace WMS.Web.Repositories .GroupJoin(_context.InStockTaskDetails, p => p.detail.TaskDetailId, ts => ts.Id, (p, ts) => new { p.detail, p.order, p.box, ts }) .SelectMany(x => x.ts.DefaultIfEmpty(), (p, taskDet) => new { p.detail, p.order, p.box, taskDet }) - .GroupJoin(_context.InstockTaskBox, p => p.detail.BoxId, ts => ts.BoxId, (p, ts) => new { p.detail, p.order, p.box,p.taskDet, ts }) + .GroupJoin(_context.InstockTaskBox, p => p.detail.BoxId, ts => ts.BoxId, (p, ts) => new { p.detail, p.order, p.box, p.taskDet, ts }) .SelectMany(x => x.ts.DefaultIfEmpty(), (p, taskBox) => new { p.detail, p.order, p.box, p.taskDet, taskBox }) .Where(x => x.detail.TaskId == entity.Id).Select(x => new InStockTaskBoxInfoDto() { @@ -191,14 +191,14 @@ namespace WMS.Web.Repositories MethodForInt = (int)x.order.Method, MaterialNumber = x.detail.MaterialNumber, Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, x.detail.MaterialNumber), - + Qty = x.detail.Qty, RealityQty = x.detail.Qty, ReceiveQty = x.detail.Qty, ShelfTime = x.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Shelfer = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.order.CreatorId), - Receiver = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.taskBox.ReceiverId??0), - ReceiveTime =x.taskBox.CreateTime.HasValue? x.taskBox.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"):"", + Receiver = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.taskBox.ReceiverId ?? 0), + ReceiveTime = x.taskBox.CreateTime.HasValue ? x.taskBox.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", SerialNumbers = (string.Join(",", x.detail.SerialNumbers).TrimEnd(',')) }).ToListAsync(); @@ -218,7 +218,7 @@ namespace WMS.Web.Repositories BoxBillNo = x.box.BoxBillNo, SaleBillNo = x.taskDet.SaleBillNo, Method = InventoryInOutMethod.Box.GetRemark(), - MethodForInt =(int)InventoryInOutMethod.Box, + MethodForInt = (int)InventoryInOutMethod.Box, Qty = x.detail.ReceiveQty, ReceiveQty = x.detail.ReceiveQty, RealityQty = 0, @@ -227,13 +227,13 @@ namespace WMS.Web.Repositories ShelfTime = "", Shelfer = "", ReceiveTime = x.box.CreateTime.HasValue ? x.box.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", - Receiver = x.box.ReceiverId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.box.ReceiverId.Value) : "", + Receiver = x.box.ReceiverId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.box.ReceiverId.Value) : "", SerialNumbers = x.detail.SerialNumbers != null && x.detail.SerialNumbers.Count() > 0 ? (string.Join(",", x.detail.SerialNumbers).TrimEnd(',')) : "", }).ToListAsync(); boxList.AddRange(receiveBox); } - + var boxs = await _context.Box.Where(x => boxIds.Contains(x.Id)).ToListAsync(); boxList.ForEach(x => { @@ -241,7 +241,7 @@ namespace WMS.Web.Repositories if (current_box != null) { var current_boxDet = current_box.Details.Where(d => d.MaterialNumber == x.MaterialNumber).FirstOrDefault(); - if (current_boxDet!=null && x.MethodForInt == (int)InventoryInOutMethod.Product && current_boxDet.Qty != 0) + if (current_boxDet != null && x.MethodForInt == (int)InventoryInOutMethod.Product && current_boxDet.Qty != 0) x.Qty = current_boxDet.Qty; } }); @@ -500,8 +500,9 @@ namespace WMS.Web.Repositories _transaction.Commit(); return true; } - catch + catch (Exception ex) { + Console.WriteLine($"入库任务单插入失败:{ex.Message}"); if (_transaction != null) _transaction.Rollback(); return false;