wanshenmean
2026-03-30 5a73b7ff0b5f063de61fd014feaa68d267630db9
Code/WMS/WIDESEA_WMSClient/src/views/stock/stockChat.vue
@@ -168,10 +168,10 @@
async function loadWarehouseList() {
  try {
    const res = await proxy.http.get('/api/Warehouse/GetAll')
    if (res.Status && res.Data) {
      warehouseList.value = res.Data
      if (res.Data.length > 0) {
        activeWarehouse.value = res.Data[0].warehouseId || res.Data[0].id
    if (res.status && res.data) {
      warehouseList.value = res.data
      if (res.data.length > 0) {
        activeWarehouse.value = res.data[0].warehouseId || res.data[0].id
        await loadWarehouseData(activeWarehouse.value)
      }
    }
@@ -184,12 +184,15 @@
async function loadWarehouseData(warehouseId) {
  try {
    const res = await proxy.http.get(`/api/StockInfo/Get3DLayout?warehouseId=${warehouseId}`)
    if (res.Status && res.Data) {
      const data = res.Data
      locationData = data.Locations || []
    console.log('Get3DLayout response:', res)
    if (res.status && res.data) {
      const data = res.data
      console.log('data.locations:', data.locations)
      locationData = data.locations || []
      // 使用后端返回的筛选列表
      materielCodeList.value = data.MaterielCodeList || []
      batchNoList.value = data.BatchNoList || []
      materielCodeList.value = data.materielCodeList || []
      batchNoList.value = data.batchNoList || []
      console.log('locationData set:', locationData.length, 'items')
      // 渲染货位
      renderLocations()
    }
@@ -258,6 +261,7 @@
// 渲染货位
function renderLocations() {
  console.log('renderLocations called', { scene: !!scene, locationDataLength: locationData.length })
  if (!scene) return
  // 移除旧的货位网格
@@ -269,7 +273,7 @@
  }
  // 过滤数据
  let filteredData = locationData
  let filteredData = [...locationData]
  if (filterStockStatus.value !== null) {
    filteredData = filteredData.filter(loc => loc.stockStatus === filterStockStatus.value)
  }
@@ -280,6 +284,7 @@
    filteredData = filteredData.filter(loc => loc.batchNo === filterBatchNo.value)
  }
  console.log('filteredData length:', filteredData.length)
  if (filteredData.length === 0) return
  // 创建 InstancedMesh
@@ -303,12 +308,17 @@
    // 设置颜色
    color.setHex(getLocationColor(location))
    locationMesh.setColorAt(i, color)
    if (i === 0) {
      console.log('First location:', location, { x, y, z })
    }
  })
  locationMesh.instanceMatrix.needsUpdate = true
  if (locationMesh.instanceColor) locationMesh.instanceColor.needsUpdate = true
  scene.add(locationMesh)
  console.log('locationMesh added to scene')
}
// 动画循环