feature:
成品入库页面分配库存弹窗字段完善
This commit is contained in:
1 parent
c76e7bb681
commit
b6c3ef8b2c
10 files changed
+441
-56
No files matched your search
@@ -81,20 +81,37 @@ namespace HHWMS.Web.Controllers
|
||||
return JsonMore(null, 500, "只有ERP发货通知单允许使用分配/下发");
|
||||
}
|
||||
|
||||
var details = _unitwork.Find<ShipmentDetail>(x => x.HeaderId == headerId && x.DLsID.HasValue)
|
||||
// 明细的图号/物料名称可能因 ERP 未返回或历史数据为空,展示时用物料表兜底(不修改库内数据)
|
||||
var detailList = _unitwork.Find<ShipmentDetail>(x => x.HeaderId == headerId && x.DLsID.HasValue)
|
||||
.OrderBy(x => x.ID)
|
||||
.Select(x => new
|
||||
.ToList();
|
||||
var detailMaterialCodes = detailList
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x.MaterialCode))
|
||||
.Select(x => x.MaterialCode)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var detailMaterials = detailMaterialCodes.Count > 0
|
||||
? _unitwork.Find<Material>(x => detailMaterialCodes.Contains(x.MaterialCode))
|
||||
.ToDictionary(x => x.MaterialCode)
|
||||
: new Dictionary<string, Material>();
|
||||
|
||||
// 图号/物料名称统一从物料表取(物料表取不到时再退回明细自带的值)
|
||||
var details = detailList.Select(x =>
|
||||
{
|
||||
x.ID,
|
||||
x.DLsID,
|
||||
x.MaterialCode,
|
||||
x.MaterialName,
|
||||
x.MaterialType,
|
||||
Qty = x.Qty ?? 0,
|
||||
CompletedQty = x.CompletedQty ?? 0,
|
||||
DividedQty = x.DividedQty ?? 0,
|
||||
RemainingQty = (x.Qty ?? 0) - (x.CompletedQty ?? 0) - (x.DividedQty ?? 0),
|
||||
Status = x.Status.ToString()
|
||||
detailMaterials.TryGetValue(x.MaterialCode ?? "", out var material);
|
||||
return new
|
||||
{
|
||||
x.ID,
|
||||
x.DLsID,
|
||||
x.MaterialCode,
|
||||
MaterialName = material?.MaterialName ?? x.MaterialName,
|
||||
MaterialType = material?.MaterialType ?? x.MaterialType,
|
||||
Qty = x.Qty ?? 0,
|
||||
CompletedQty = x.CompletedQty ?? 0,
|
||||
DividedQty = x.DividedQty ?? 0,
|
||||
RemainingQty = (x.Qty ?? 0) - (x.CompletedQty ?? 0) - (x.DividedQty ?? 0),
|
||||
Status = x.Status.ToString()
|
||||
};
|
||||
})
|
||||
.ToList();
|
||||
|
||||
@@ -126,11 +143,32 @@ namespace HHWMS.Web.Controllers
|
||||
var shipmentHeaders = _unitwork.Find<ShipmentHeader>(x => shipmentHeaderIds.Contains(x.ID))
|
||||
.ToDictionary(x => x.ID);
|
||||
|
||||
// 托盘任务 → 库位:按任务明细里的库存ID取库存所在库位(同一托盘的库存库位一致),取不到时退回任务起点库位
|
||||
var taskInventoryIds = allTaskDetails
|
||||
.Where(x => x.InventoryId.HasValue)
|
||||
.Select(x => x.InventoryId.Value)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var inventoryLocations = taskInventoryIds.Count > 0
|
||||
? _unitwork.Find<Inventory>(x => taskInventoryIds.Contains(x.ID))
|
||||
.ToDictionary(x => x.ID, x => x.LocationCode)
|
||||
: new Dictionary<int, string>();
|
||||
var taskLocations = new Dictionary<int, string>();
|
||||
foreach (var task in taskHeaders)
|
||||
{
|
||||
var locationCode = allTaskDetails
|
||||
.Where(x => x.HeaderId == task.ID && x.InventoryId.HasValue)
|
||||
.Select(x => inventoryLocations.TryGetValue(x.InventoryId.Value, out var loc) ? loc : null)
|
||||
.FirstOrDefault(l => !string.IsNullOrWhiteSpace(l));
|
||||
taskLocations[task.ID] = string.IsNullOrWhiteSpace(locationCode) ? task.FromLocation : locationCode;
|
||||
}
|
||||
|
||||
var tasks = taskHeaders.Select(task => new
|
||||
{
|
||||
task.ID,
|
||||
task.TaskNo,
|
||||
task.ContainerCode,
|
||||
LocationCode = taskLocations[task.ID],
|
||||
task.FromLocation,
|
||||
task.ToLocation,
|
||||
Status = task.Status.ToString(),
|
||||
@@ -228,6 +266,13 @@ namespace HHWMS.Web.Controllers
|
||||
var locationCodes = inventories.Select(x => x.LocationCode).Distinct().ToList();
|
||||
var locations = _unitwork.Find<Location>(x => locationCodes.Contains(x.Code))
|
||||
.ToDictionary(x => x.Code);
|
||||
// 公司名称从本地客商表(Customer)取,取不到则回退显示公司编码
|
||||
var companyCodes = inventories.Select(x => x.CompanyCode)
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var customers = _unitwork.Find<Customer>(x => companyCodes.Contains(x.Code))
|
||||
.ToDictionary(x => x.Code, x => x.Name);
|
||||
|
||||
var result = inventories.Select(inventory =>
|
||||
{
|
||||
@@ -235,6 +280,7 @@ namespace HHWMS.Web.Controllers
|
||||
var task = activeTasks.FirstOrDefault(x => x.ContainerCode == inventory.ContainerCode);
|
||||
containers.TryGetValue(inventory.ContainerCode, out var container);
|
||||
locations.TryGetValue(inventory.LocationCode, out var location);
|
||||
customers.TryGetValue(inventory.CompanyCode ?? "", out var companyName);
|
||||
var isPendingShipmentTask = task != null
|
||||
&& task.Status == TaskStatusEnum.待下发
|
||||
&& shipmentTaskIds.Contains(task.ID);
|
||||
@@ -248,6 +294,8 @@ namespace HHWMS.Web.Controllers
|
||||
inventory.ID,
|
||||
inventory.ContainerCode,
|
||||
inventory.LocationCode,
|
||||
inventory.CompanyCode,
|
||||
CompanyName = string.IsNullOrWhiteSpace(companyName) ? inventory.CompanyCode : companyName,
|
||||
inventory.MaterialCode,
|
||||
inventory.MaterialName,
|
||||
inventory.MaterialType,
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<a-table :data="details" :pagination="false" row-key="ID">
|
||||
<template #columns>
|
||||
<a-table-column title="物料编码" data-index="MaterialCode"></a-table-column>
|
||||
<a-table-column title="图号" data-index="MaterialType"></a-table-column>
|
||||
<a-table-column title="物料名称" data-index="MaterialName"></a-table-column>
|
||||
<a-table-column title="需求数量" data-index="Qty"></a-table-column>
|
||||
<a-table-column title="已分配" data-index="DividedQty"></a-table-column>
|
||||
@@ -36,7 +37,7 @@
|
||||
style="margin-bottom: 12px">
|
||||
<template #extra>
|
||||
<a-space>
|
||||
<span>托盘:{{ task.ContainerCode }};状态:{{ task.Status }}</span>
|
||||
<span>托盘:{{ task.ContainerCode }};库位:{{ task.LocationCode || '-' }};状态:{{ task.Status }}</span>
|
||||
<a-select v-if="task.CanDispatch" v-model="task.SelectedOutPort"
|
||||
popup-container="#shipment-allocate-@Model.Entity.ID"
|
||||
placeholder="选择出库口" style="width: 150px">
|
||||
@@ -84,6 +85,7 @@
|
||||
<a-table-column title="库存ID" data-index="ID" :width="90"></a-table-column>
|
||||
<a-table-column title="托盘" data-index="ContainerCode"></a-table-column>
|
||||
<a-table-column title="库位" data-index="LocationCode"></a-table-column>
|
||||
<a-table-column title="公司" data-index="CompanyName"></a-table-column>
|
||||
<a-table-column title="批次" data-index="Batch"></a-table-column>
|
||||
<a-table-column title="库存数量" data-index="Qty"></a-table-column>
|
||||
<a-table-column title="已被分配" data-index="AllocatedQty"></a-table-column>
|
||||
|
||||
Reference in new issue
Block a user