feat(发货单): 增加发货单钢卷选择范围限制功能

- 在CoilSelector组件中新增rangeMode和rangeData属性,支持传入可选钢卷列表
- 发货单明细表增加对可选钢卷列表的支持,并在增删改时刷新列表
- 发货单打印时自动填充取货地点为实际库位前三位
- 调整操作列固定显示在表格右侧
This commit is contained in:
砂糖
2025-12-09 14:37:46 +08:00
parent d4e882610b
commit 2d30a2f3fb
7 changed files with 74 additions and 35 deletions

View File

@@ -80,7 +80,7 @@
<el-divider style="margin: 20px 0;" />
<DeliveryWaybillDetail ref="detailTable" :waybillId="waybillId" />
<DeliveryWaybillDetail ref="detailTable" :waybillId="waybillId" :coilList="coilList" @add="refreshCoilList" @update="refreshCoilList" @delete="refreshCoilList" />
</el-card>
</el-col>
</el-row>
@@ -138,7 +138,8 @@
<script>
import { listDeliveryWaybill, getDeliveryWaybill, delDeliveryWaybill, addDeliveryWaybill, updateDeliveryWaybill } from "@/api/wms/deliveryWaybill";
import { listDeliveryPlan } from "@/api/wms/deliveryPlan"; // 导入发货计划API
import { listDeliveryPlan, listSelectableCoils } from "@/api/wms/deliveryPlan"; // 导入发货计划API
import { listCoilByIds } from "@/api/wms/coil";
import { listDeliveryWaybillDetail } from "@/api/wms/deliveryWaybillDetail";
import MemoInput from "@/components/MemoInput";
import DeliveryWaybillDetail from "../components/detailTable.vue";
@@ -215,7 +216,8 @@ export default {
planName: undefined,
planType: 0,
auditStatus: 1,
}
},
coilList: []
};
},
created() {
@@ -238,6 +240,13 @@ export default {
this.loading = false;
});
},
refreshCoilList() {
if (this.selectedPlan && this.selectedPlan.planId) {
listSelectableCoils(this.selectedPlan.planId).then(response => {
this.coilList = response.data;
});
}
},
/** 完成状态改变时的处理 */
handleStatusChange(row) {
// 确保在更新状态时包含waybillId
@@ -314,6 +323,7 @@ export default {
},
handlePlanSelect(row) {
this.selectedPlan = row;
this.refreshCoilList();
// 更新查询参数根据选中的planId筛选发货单
this.queryParams.planId = row.planId;
this.waybillId = null;
@@ -398,8 +408,6 @@ export default {
/** 打印发货单 */
handlePrint(row) {
this.loading = true;
// 设置当前发货单
this.currentWaybill = row;
// 获取发货单明细
listDeliveryWaybillDetail({
waybillId: row.waybillId,
@@ -408,6 +416,7 @@ export default {
}).then(response => {
// 处理字段映射确保与wayBill组件使用的字段名一致
this.currentWaybillDetails = response.rows.map(item => ({
coilId: item.coilId,
productName: item.productName,
edgeType: item.edgeType,
packageType: item.packaging, // 映射packaging到packageType
@@ -421,6 +430,17 @@ export default {
unitPrice: item.unitPrice,
remark: item.remark
}));
const coils = this.currentWaybillDetails.map(item => item.coilId).join(',');
listCoilByIds(coils).then(response => {
// 取前三位, 然后去抽后用;连接
// 设置当前发货单
const actualWahouseNames = [...new Set(response.rows.filter(item => Boolean(item.actualWarehouseName)).map(item => item.actualWarehouseName.slice(0, 3)))].join(';');
this.currentWaybill = {
...row,
pickupLocation: actualWahouseNames || '',
};
});
// 打开打印对话框
this.printDialogVisible = true;
this.loading = false;