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

@@ -143,7 +143,9 @@ export function listCoilByIds(coilIds) {
url: '/wms/materialCoil/list',
method: 'get',
params: {
coilIds
coilIds,
pageNum: 1,
pageSize: 1000
}
})
}

View File

@@ -56,4 +56,17 @@ export function getDeliveryReport(query) {
method: 'get',
params: query
})
}
}
/**
* 获取当前可用的钢卷列表
*/
export function listSelectableCoils(planId) {
return request({
url: '/wms/deliveryPlan/selectableCoils',
method: 'get',
params: {
planId: planId
}
})
}

View File

@@ -18,7 +18,7 @@
<el-dialog title="选择钢卷" :visible.sync="dialogVisible" width="900px" :close-on-click-modal="false"
@close="handleClose" append-to-body>
<!-- 搜索区域 -->
<el-form :inline="true" :model="queryParams" class="search-form">
<el-form v-if="!rangeMode" :inline="true" :model="queryParams" class="search-form">
<el-form-item label="卷号">
<el-input v-model="queryParams.currentCoilNo" placeholder="请输入卷号" clearable size="small"
@keyup.enter.native="handleQuery" />
@@ -47,7 +47,7 @@
</el-table>
<!-- 分页 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
<pagination v-if="!rangeMode" v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<div slot="footer" class="dialog-footer">
@@ -91,6 +91,15 @@ export default {
type: Object,
default: null
},
rangeMode: {
type: Boolean,
default: false
},
// 返回选择模式不再通过list借口获取而是传入可以选择的钢卷数据
rangeData: {
type: Array,
default: () => []
}
},
data() {
return {
@@ -178,6 +187,12 @@ export default {
methods: {
// 获取钢卷列表
async getList() {
// 如果是范围模式,直接使用传入数据
if (this.rangeMode) {
this.coilList = this.rangeData || [];
this.total = this.coilList.length;
return;
}
try {
this.loading = true;
const params = { ...this.queryParams, ...this.filters };

View File

@@ -49,7 +49,7 @@
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="发货钢卷" prop="coilId">
<div style="display: flex; gap: 10px;">
<coil-selector v-model="form.coilId" :use-trigger="true" @select="handleSelect" />
<coil-selector v-model="form.coilId" :use-trigger="true" @select="handleSelect" :rangeMode="true" :rangeData="coilList" />
<el-checkbox v-model="autoFillForm" label="自动填写表单信息" />
</div>
</el-form-item>
@@ -108,6 +108,10 @@ export default {
waybillId: {
type: String,
default: '',
},
coilList: {
type: Array,
default: () => []
}
},
components: {
@@ -273,12 +277,14 @@ export default {
this.getList();
}).finally(() => {
this.buttonLoading = false;
this.$emit('update');
});
} else {
addDeliveryWaybillDetail(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
this.$emit('add');
}).finally(() => {
this.buttonLoading = false;
});
@@ -296,6 +302,7 @@ export default {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
this.$emit('delete');
}).catch(() => {
}).finally(() => {
this.loading = false;

View File

@@ -104,7 +104,7 @@
<div class="waybill-pickup-location">
<!-- <div class="pickup-location-item inline"> -->
<span class="label">取货地点</span>
<input type="text" class="editable-input full-input transparent-input" />
<input type="text" class="editable-input full-input transparent-input" v-model="localWaybill.pickupLocation" />
<!-- </div> -->
</div>
@@ -159,7 +159,8 @@ export default {
deliveryDay: '',
principal: '',
principalPhone: '',
licensePlate: ''
licensePlate: '',
pickupLocation: ''
},
// 本地可编辑的发货单明细
localWaybillDetails: []
@@ -178,7 +179,8 @@ export default {
deliveryDay: this.getDayFromDate(newVal.deliveryTime) || '',
principal: newVal.principal || '',
principalPhone: newVal.principalPhone || '',
licensePlate: newVal.licensePlate || ''
licensePlate: newVal.licensePlate || '',
pickupLocation: newVal.pickupLocation || ''
};
}
},
@@ -187,6 +189,7 @@ export default {
},
waybillDetails: {
handler(newVal) {
console.log('waybillDetails', newVal);
if (newVal && Array.isArray(newVal)) {
this.localWaybillDetails = [...newVal];
} else {
@@ -222,27 +225,6 @@ export default {
}
return '';
},
// 添加明细
addDetail() {
this.localWaybillDetails.push({
productName: '',
edgeType: '',
packageType: '',
settlementType: '',
rawMaterialFactory: '',
coilNumber: '',
specification: '',
material: '',
quantity: 0,
weight: 0,
unitPrice: 0,
remark: ''
});
},
// 删除明细
deleteDetail(index) {
this.localWaybillDetails.splice(index, 1);
},
// 保存为图片
saveAsImage() {
const node = this.$refs.waybillRef;

View File

@@ -92,7 +92,7 @@
<el-table-column label="厂家" align="center" prop="manufacturer" />
<el-table-column label="重量(t)" align="center" prop="netWeight" width="100" />
<el-table-column label="库区" align="center" prop="warehouseName" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="100">
<el-table-column label="操作" align="center" width="100" fixed="right">
<template slot-scope="scope">
<el-button type="danger" size="small" @click.stop="handleDeleteCoil(scope.row)">删除</el-button>
</template>

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;