增加日志

This commit is contained in:
18942506660
2024-05-07 17:39:38 +08:00
parent 380e7cb15a
commit 557348cf99

View File

@@ -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 }) .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 }) .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 }) .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() .Where(x => x.detail.TaskId == entity.Id).Select(x => new InStockTaskBoxInfoDto()
{ {
@@ -191,14 +191,14 @@ namespace WMS.Web.Repositories
MethodForInt = (int)x.order.Method, MethodForInt = (int)x.order.Method,
MaterialNumber = x.detail.MaterialNumber, MaterialNumber = x.detail.MaterialNumber,
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, x.detail.MaterialNumber), Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, x.detail.MaterialNumber),
Qty = x.detail.Qty, Qty = x.detail.Qty,
RealityQty = x.detail.Qty, RealityQty = x.detail.Qty,
ReceiveQty = x.detail.Qty, ReceiveQty = x.detail.Qty,
ShelfTime = x.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), ShelfTime = x.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
Shelfer = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.order.CreatorId), Shelfer = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.order.CreatorId),
Receiver = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.taskBox.ReceiverId??0), 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"):"", ReceiveTime = x.taskBox.CreateTime.HasValue ? x.taskBox.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
SerialNumbers = (string.Join(",", x.detail.SerialNumbers).TrimEnd(',')) SerialNumbers = (string.Join(",", x.detail.SerialNumbers).TrimEnd(','))
}).ToListAsync(); }).ToListAsync();
@@ -218,7 +218,7 @@ namespace WMS.Web.Repositories
BoxBillNo = x.box.BoxBillNo, BoxBillNo = x.box.BoxBillNo,
SaleBillNo = x.taskDet.SaleBillNo, SaleBillNo = x.taskDet.SaleBillNo,
Method = InventoryInOutMethod.Box.GetRemark(), Method = InventoryInOutMethod.Box.GetRemark(),
MethodForInt =(int)InventoryInOutMethod.Box, MethodForInt = (int)InventoryInOutMethod.Box,
Qty = x.detail.ReceiveQty, Qty = x.detail.ReceiveQty,
ReceiveQty = x.detail.ReceiveQty, ReceiveQty = x.detail.ReceiveQty,
RealityQty = 0, RealityQty = 0,
@@ -227,13 +227,13 @@ namespace WMS.Web.Repositories
ShelfTime = "", ShelfTime = "",
Shelfer = "", Shelfer = "",
ReceiveTime = x.box.CreateTime.HasValue ? x.box.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", 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(',')) : "", SerialNumbers = x.detail.SerialNumbers != null && x.detail.SerialNumbers.Count() > 0 ? (string.Join(",", x.detail.SerialNumbers).TrimEnd(',')) : "",
}).ToListAsync(); }).ToListAsync();
boxList.AddRange(receiveBox); boxList.AddRange(receiveBox);
} }
var boxs = await _context.Box.Where(x => boxIds.Contains(x.Id)).ToListAsync(); var boxs = await _context.Box.Where(x => boxIds.Contains(x.Id)).ToListAsync();
boxList.ForEach(x => boxList.ForEach(x =>
{ {
@@ -241,7 +241,7 @@ namespace WMS.Web.Repositories
if (current_box != null) if (current_box != null)
{ {
var current_boxDet = current_box.Details.Where(d => d.MaterialNumber == x.MaterialNumber).FirstOrDefault(); 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; x.Qty = current_boxDet.Qty;
} }
}); });
@@ -500,8 +500,9 @@ namespace WMS.Web.Repositories
_transaction.Commit(); _transaction.Commit();
return true; return true;
} }
catch catch (Exception ex)
{ {
Console.WriteLine($"入库任务单插入失败:{ex.Message}");
if (_transaction != null) if (_transaction != null)
_transaction.Rollback(); _transaction.Rollback();
return false; return false;