diff --git a/klp-ui/src/views/wms/delivery/components/wayBill2.vue b/klp-ui/src/views/wms/delivery/components/wayBill2.vue new file mode 100644 index 00000000..ed2c01be --- /dev/null +++ b/klp-ui/src/views/wms/delivery/components/wayBill2.vue @@ -0,0 +1,1389 @@ + + + + + + diff --git a/klp-ui/src/views/wms/delivery/waybill/index.vue b/klp-ui/src/views/wms/delivery/waybill/index.vue index 0999fb0d..30360a28 100644 --- a/klp-ui/src/views/wms/delivery/waybill/index.vue +++ b/klp-ui/src/views/wms/delivery/waybill/index.vue @@ -72,6 +72,8 @@ @@ -148,6 +151,8 @@ import MemoInput from "@/components/MemoInput"; import DeliveryWaybillDetail from "../components/detailTable.vue"; import WayBill from "../components/wayBill.vue"; import PlanList from "../components/planList.vue"; +import WayBill2 from "../components/wayBill2.vue"; + export default { name: "DeliveryWaybill", @@ -155,7 +160,8 @@ export default { MemoInput, DeliveryWaybillDetail, WayBill, - PlanList + PlanList, + WayBill2 }, data() { return { @@ -182,6 +188,8 @@ export default { currentWaybillDetails: [], // 弹出层标题 title: "", + // 打印类型 + printType: 0, // 是否显示弹出层 open: false, // 查询参数 @@ -422,6 +430,65 @@ export default { /** 打印发货单 */ handlePrint(row) { this.loading = true; + this.printType = 0; + // 获取发货单明细 + listDeliveryWaybillDetail({ + waybillId: row.waybillId, + pageNum: 1, + pageSize: 1000 // 获取所有明细 + }).then(response => { + // 处理字段映射,确保与wayBill组件使用的字段名一致 + this.currentWaybillDetails = response.rows.map(item => ({ + coilId: item.coilId, + productName: item.productName, + edgeType: item.edgeType, + packageType: item.packaging, // 映射packaging到packageType + settlementType: item.settlementType, + rawMaterialFactory: item.rawMaterialFactory, + coilNumber: item.coilNo, // 映射coilNo到coilNumber + specification: item.specification, + material: item.material, + quantity: item.quantity, + weight: item.weight, + unitPrice: item.unitPrice || '', + // 单价为空时,显示为空字符串 + remark: item.remark + })); + const coils = this.currentWaybillDetails.map(item => item.coilId).join(','); + if (coils) { + 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.currentWaybillDetails = this.currentWaybillDetails.map(item => { + const actualWarehouseName = response.rows.find(detail => detail.coilId === item.coilId)?.actualWarehouseName || ''; + return { + ...item, + actualWarehouseName: actualWarehouseName, + }; + }); + }); + } + this.currentWaybill = { + ...row, + }; + this.printDialogVisible = true; + this.loading = false; + + }).catch(error => { + console.error('获取发货单明细失败:', error); + this.$modal.msgError('获取发货单明细失败'); + this.loading = false; + }); + }, + /** 打印发货单 */ + handlePrintSimple(row) { + this.loading = true; + this.printType = 1; // 获取发货单明细 listDeliveryWaybillDetail({ waybillId: row.waybillId,