20261026 #14
@ -128,7 +128,7 @@ public partial class WarehouseService
|
|||||||
var resolvedCustomerId = await ResolveListCustomerIdAsync(customerId);
|
var resolvedCustomerId = await ResolveListCustomerIdAsync(customerId);
|
||||||
var notice = await GetInboundNoticeOrThrowAsync(resolvedCustomerId, id);
|
var notice = await GetInboundNoticeOrThrowAsync(resolvedCustomerId, id);
|
||||||
var boxes = await InboundBoxRepository.GetListAsync(x => x.InboundNoticeId == notice.Id);
|
var boxes = await InboundBoxRepository.GetListAsync(x => x.InboundNoticeId == notice.Id);
|
||||||
boxes = boxes.OrderBy(x => x.BoxSeqNo).ThenBy(x => x.Id).ToList();
|
boxes = OrderInboundBoxes(boxes);
|
||||||
var boxIds = boxes.Select(x => x.Id).ToArray();
|
var boxIds = boxes.Select(x => x.Id).ToArray();
|
||||||
var lines = boxIds.Length == 0
|
var lines = boxIds.Length == 0
|
||||||
? []
|
? []
|
||||||
@ -367,7 +367,8 @@ public partial class WarehouseService
|
|||||||
var customerId = await ResolveListCustomerIdAsync(input.CustomerId);
|
var customerId = await ResolveListCustomerIdAsync(input.CustomerId);
|
||||||
var notice = await GetInboundNoticeOrThrowAsync(customerId, input.Id);
|
var notice = await GetInboundNoticeOrThrowAsync(customerId, input.Id);
|
||||||
var boxes = await InboundBoxRepository.GetListAsync(x => x.InboundNoticeId == notice.Id);
|
var boxes = await InboundBoxRepository.GetListAsync(x => x.InboundNoticeId == notice.Id);
|
||||||
boxes = boxes.OrderBy(x => x.BoxSeqNo).ThenBy(x => x.Id).ToList();
|
// BoxSeqNo 为字符串,必须按数值排,否则 10 会排在 2 前面导致箱唛乱序
|
||||||
|
boxes = OrderInboundBoxes(boxes);
|
||||||
if (boxes.Count == 0)
|
if (boxes.Count == 0)
|
||||||
{
|
{
|
||||||
throw new BusinessException("该预报没有箱子,无法打印箱唛");
|
throw new BusinessException("该预报没有箱子,无法打印箱唛");
|
||||||
@ -549,4 +550,23 @@ public partial class WarehouseService
|
|||||||
BinLocationId = line.BinLocationId
|
BinLocationId = line.BinLocationId
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按箱序号数值升序;无法解析的序号排最后,同序号再按 Id。
|
||||||
|
/// </summary>
|
||||||
|
private static List<CInboundBox> OrderInboundBoxes(IEnumerable<CInboundBox> boxes) =>
|
||||||
|
boxes
|
||||||
|
.OrderBy(x => ParseBoxSeqNo(x.BoxSeqNo))
|
||||||
|
.ThenBy(x => x.Id)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
private static int ParseBoxSeqNo(string? boxSeqNo)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(boxSeqNo))
|
||||||
|
{
|
||||||
|
return int.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return int.TryParse(boxSeqNo.Trim(), out var n) && n > 0 ? n : int.MaxValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user