成品库显示图号,精简历史记录map

This commit is contained in:
zhougf committed 2025-10-22 13:18:04 +08:00
1 parent 3cba19da98
commit 13d3a96f0c
3 files changed
+29 -9

No files matched your search

@@ -68,9 +68,9 @@ namespace HHWMS.Web.Controllers
Id = x.ID, Id = x.ID,
ContainerCode = x.ContainerCode, ContainerCode = x.ContainerCode,
MaterialCode = x.MaterialCode, MaterialCode = x.MaterialCode,
MaterialName = x.MaterialName, MaterialName = x.MaterialType,
MaterialSpec = x.MaterialSpec, MaterialSpec = x.MaterialSpec,
Company = x.CompanyCode, CompanyCode = x.CompanyCode,
Batch = x.Batch, Batch = x.Batch,
Qty = (int)x.Qty Qty = (int)x.Qty
}) })
@@ -160,14 +160,17 @@
{ {
title: '容器编码', title: '容器编码',
dataIndex: 'ContainerCode', dataIndex: 'ContainerCode',
width: 100
}, },
{ {
title: '物料编码', title: '物料编码',
dataIndex: 'MaterialCode', dataIndex: 'MaterialCode',
width: 120,
}, },
{ {
title: '物料名称', title: '图号',
dataIndex: 'MaterialName', dataIndex: 'MaterialName',
width: 120,
}, },
{ {
title: '物料型号', title: '物料型号',
@@ -240,7 +243,7 @@
getFilteredTips(type, inputVal) { getFilteredTips(type, inputVal) {
if (!inputVal) { if (!inputVal) {
// 没有输入时显示所有历史记录 // 没有输入时显示所有历史记录
console.log(1)
return this.history[type].map(item => ({ value: item })); return this.history[type].map(item => ({ value: item }));
} }
// 输入时过滤匹配的记录(不区分大小写) // 输入时过滤匹配的记录(不区分大小写)
@@ -262,7 +265,7 @@
// 添加到最前面(最新的在最上面) // 添加到最前面(最新的在最上面)
history.unshift(value); history.unshift(value);
// 限制最多保存10条 // 限制最多保存10条
if (history.length > 10) { if (history.length > 20) {
history.pop(); history.pop();
} }
// 保存到本地存储 // 保存到本地存储
@@ -477,7 +480,12 @@
}, },
handleDelete(record) { handleDelete(record) {
const index = this.bindList.findIndex(item => item.id === record.id); if (!record || !record.Id) {
this.$message.error("无效的记录");
return;
}
const index = this.bindList.findIndex(item => item.Id === record.Id);
if (index > -1) { if (index > -1) {
// 调用后端删除库存 // 调用后端删除库存
@@ -502,7 +510,13 @@
}, },
handleEdit(record) { handleEdit(record) {
this.editForm.index = this.bindList.findIndex(item => item.id === record.id); if (!record || !record.Id) {
this.$message.error("无效的记录");
return;
}
this.editForm.index = this.bindList.findIndex(item => item.Id === record.Id);
this.editForm.qty = Math.floor(record.Qty); this.editForm.qty = Math.floor(record.Qty);
this.editModalVisible = true; this.editModalVisible = true;
}, },
@@ -548,7 +562,12 @@
}, },
handleDeduct(record) { handleDeduct(record) {
this.deductForm.index = this.bindList.findIndex(item => item.id === record.id); if (!record || !record.Id) {
this.$message.error("无效的记录");
return;
}
this.deductForm.index = this.bindList.findIndex(item => item.Id === record.Id);
this.deductForm.qty = null; this.deductForm.qty = null;
this.deductForm.maxQty = Math.floor(record.Qty); this.deductForm.maxQty = Math.floor(record.Qty);
this.deductModalVisible = true; this.deductModalVisible = true;
@@ -573,7 +592,7 @@
this.$notification.error("扣除数量不能大于当前数量"); this.$notification.error("扣除数量不能大于当前数量");
return; return;
} }
console.log(1);
const newQty = record.Qty - this.deductForm.qty; const newQty = record.Qty - this.deductForm.qty;
if (newQty === 0) { if (newQty === 0) {
@@ -27,6 +27,7 @@ namespace HHWMS.Web.Support.Profiles
.ForMember( .ForMember(
dest => dest.CreateTime, dest => dest.CreateTime,
src => src.MapFrom(x => DateTime.Now)) src => src.MapFrom(x => DateTime.Now))
.ForMember(x => x.ID, opt => opt.Ignore())
; ;
// 任务明细 --> 库存交易 // 任务明细 --> 库存交易