huang
2025-10-22 78d73df2f8e0c6855d65eb1f2c6df08e0f99bab1
UI-Project/src/views/GlassStorage/rawfilmstorage2.vue
@@ -83,12 +83,14 @@
const slot = ref('');
const leftingStation = ref('');
const loadingline = ref('');
const rawTableData = ref([]);
let webSocket: WebSocket | null = null;
const globalDate = inject('globalDate');
const value = ref('')
const options = [
  {
    value: 101,
    value: 99,
    label: t('film.warehousing1'),
  },
]
@@ -117,8 +119,10 @@
  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
}
onMounted(() => {
  console.log("onMounted 钩子已触发");
  socket = initializeWebSocket(socketUrl, handleMessage);
  parseAndSetTime();
  getListRawGlassTask();
});
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/glassStorage/api/talk/rawGlass`;
@@ -129,6 +133,7 @@
    }
    return task;
  });
  rawTableData.value = formattedTasks;
  tableDataa.value = formattedTasks;
  if (data.rawStationDetailsList != null) {
    tableDatab.value = data.rawStationDetailsList[0]
@@ -295,6 +300,39 @@
const handleBinde = (row) => {
  dialogFormVisiblee.value = true;
};
// 查询原片仓储任务详情
const getListRawGlassTask = async (row) => {
  try {
    console.log("[getListRawGlassTask] 函数已被调用,开始执行");
    var url = "/glassStorage/rawGlassStorageTask/listRawGlassTask";
    const response = await request.post(url)
    if (response.code === 200) {
      ElMessage.success(response.message);
      // 更新tableDataa数据
      if (response.data && response.data.tasks && response.data.tasks[0]) {
        const formattedTasks = response.data.tasks[0].map(task => {
          if (task && task.createTime) {
            return { ...task, createTime: formatTimestamp(task.createTime) };
          }
          return task;
        });
        rawTableData.value = formattedTasks;
        tableDataa.value = formattedTasks;
      }
      // 更新tableDatab数据,确保页面能及时显示任务
      if (response.data && response.data.rawStationDetailsList && response.data.rawStationDetailsList[0]) {
        tableDatab.value = response.data.rawStationDetailsList[0];
      }
    } else {
      ElMessage.error(response.msg);
    }
  } catch (error) {
    console.error('查询原片仓储任务详情失败:', error);
  }
};
// 删除 
const deleteWarehousing = async (row) => {
  try {
@@ -346,21 +384,25 @@
  } catch (error) {
  }
};
// 入库请求
// 吊装位请求
const handleupc = async () => {
  try {
    var url = "/glassStorage/rawGlassStorageDetails/warehousingRequest?leftingStation=" + leftingStation.value;
    const response = await request.post(url)
    if (response.code == 200) {
      ElMessage.success(response.message);
      dialogFormVisiblec.value = false;
      leftingStation.value = '';
      // 调用获取任务详情的接口,确保数据及时更新
      await getListRawGlassTask();
      dialogFormVisiblec.value = false;
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
      ElMessage.error(response.message);
    }
  }
  catch (error) {
    dialogFormVisiblec.value = false;
    console.error('入库请求失败:', error);
  }
}
// 出库请求
@@ -406,33 +448,36 @@
  }
};
// 查询数据
const selectReportData = async () => {
  let celllist = []
  let stateList = []
  if (selectValuesa[0] != null && selectValuesa[0] != 'undefined') {
    if (selectValuesa[0] != "") {
      celllist = [selectValuesa[0]];
    }
const selectReportData = () => {
  // 处理查询条件
  const [taskStateVal, taskTypeVal] = selectValuesa;
  const beginDate = timeRange.value?.[0] || '';
  const endDate = timeRange.value?.[1] || '';
  let filteredData = [...rawTableData.value];
  if (beginDate) {
    const beginTime = new Date(beginDate).getTime();
    filteredData = filteredData.filter(item => new Date(item.createTime).getTime() >= beginTime);
  }
  if (selectValuesa[1] != null && selectValuesa[1] != 'undefined') {
    if (selectValuesa[1] != "") {
      stateList = [selectValuesa[1]];
    }
  if (endDate) {
    const endTime = new Date(endDate).getTime();
    filteredData = filteredData.filter(item => new Date(item.createTime).getTime() <= endTime);
  }
  const response = await request.post("/glassStorage/rawGlassStorageTask/setRawGlassTaskRequest", {
    beginDate: (timeRange.value && timeRange.value[0]) || '',
    endDate: (timeRange.value && timeRange.value[1]) || '',
    taskState: celllist,
    taskType: stateList
  })
  if (response.code === 200) {
    // tableDataa.value = response.data;
    ElMessage.success(response.message);
  if (taskStateVal != null && taskStateVal !== 'undefined' && taskStateVal !== '') {
    filteredData = filteredData.filter(item => item.taskState.toString() === taskStateVal);
  }
  else {
    ElMessage.error(response.message);
  if (taskTypeVal != null && taskTypeVal !== 'undefined' && taskTypeVal !== '') {
    filteredData = filteredData.filter(item => item.taskType.toString() === taskTypeVal);
  }
  tableDataa.value = filteredData;
  ElMessage.success(`查询成功,共 ${filteredData.length} 条数据`);
};
// 是否禁用
const toggleEnableState = async (row: any) => {
  if (!row.deviceId) {
@@ -587,7 +632,7 @@
function getStatusText1(taskType) {
  switch (taskType) {
    case 1:
      return t('sorter.advancetask');//进片任务
      return t('sorter.warehouseReturntasks');//回库任务
    case 2:
      return t('sorter.outputtasks');//出片任务
    case 3:
@@ -595,27 +640,31 @@
    case 4:
      return t('sorter.advancerequests');//进片请求
    case 5:
      return t('sorter.releaserequest');//出片请求
      return t('sorter.warehouseReturntasks');//回库请求
  }
}
function getStatusType2(taskState) {
  switch (taskState) {
    case 0:
      return 'info';
    case 2:
      return 'warning';
    case 1:
      return 'warning';
    case 2:
      return 'success';
    case 3:
      return 'danger';
  }
}
function getStatusText2(taskState) {
  switch (taskState) {
    case 0:
      return t('film.built');//新建
    case 2:
      return t('film.fail');//失败
    case 1:
      return t('film.execution');//执行中
    case 2:
      return t('film.finish');//完成
    case 3:
      return t('film.fail');//失败
  }
}
onBeforeUnmount(() => {
@@ -632,10 +681,10 @@
        {{ $t('film.warehousing') }}
      </el-button>
      <el-button style="margin-left: 20px;" id="searchButton" type="success" @click="handleBindc">
        {{ $t('film.pwarehousing') }}
        {{ $t('film.emptyShelfPosition') }}
      </el-button>
      <el-button style="margin-left: 20px;" id="searchButton" type="success" @click="handleBinde">{{
        $t('film.pwareout')
        $t('film.warehouseReturn')
      }}
      </el-button>
      <el-button style="margin-left: 20px;" id="searchButton" type="success" @click="handlehistorical">{{
@@ -645,17 +694,18 @@
      <el-date-picker style="margin-left: 10px;" v-model="timeRange" type="datetimerange" format="YYYY/MM/DD HH:mm:ss"
        value-format="YYYY-MM-DD HH:mm:ss" :start-placeholder="$t('film.starttime')"
        :end-placeholder="$t('film.endtime')" :default-time="defaultTime" />
      <el-select v-model="selectValuesa[0]" clearable :placeholder="$t('film.taskstatus')" style="margin-left: 10px;">
      <el-select v-model="selectValuesa[0]" clearable :placeholder="$t('film.taskstatus')" style="margin-left: 10px; width: 200px;">
        <el-option :label="$t('film.built')" value="0"></el-option>
        <el-option :label="$t('film.finish')" value="1"></el-option>
        <el-option :label="$t('film.fail')" value="2"></el-option>
        <el-option :label="$t('film.execution')" value="1"></el-option>
        <el-option :label="$t('film.finish')" value="2"></el-option>
        <el-option :label="$t('film.fail')" value="3"></el-option>
      </el-select>
      <el-select v-model="selectValuesa[1]" clearable :placeholder="$t('film.tasktype')" style="margin-left: 10px;">
        <el-option :label="$t('sorter.advancetask')" value="1"></el-option>
      <el-select v-model="selectValuesa[1]" clearable :placeholder="$t('film.tasktype')" style="margin-left: 10px; width: 200px;">
        <el-option :label="$t('sorter.warehouseReturntasks')" value="1"></el-option>
        <el-option :label="$t('sorter.outputtasks')" value="2"></el-option>
        <el-option :label="$t('sorter.schedulingtasks')" value="3"></el-option>
        <el-option :label="$t('sorter.advancerequests')" value="4"></el-option>
        <el-option :label="$t('sorter.releaserequest')" value="5"></el-option>
        <el-option :label="$t('sorter.warehouseReturntasks')" value="5"></el-option>
      </el-select>
      <el-button type="primary" style="margin-left: 10px;" @click="selectReportData()">{{ $t('film.inquire')
      }}</el-button>
@@ -685,9 +735,9 @@
          <el-table-column prop="createTime" align="center" :label="$t('film.createtime')" />
          <el-table-column fixed="right" :label="$t('film.operate')" align="center">
            <template #default="scope">
              <el-button :disabled="(scope.row.taskState !== 0)" type="text" plain @click="successfull(scope.row)">{{
              <el-button :disabled="(scope.row.taskState >=2)" type="text" plain @click="successfull(scope.row)">{{
                $t('searchOrder.successfullyprocessed') }}</el-button>
              <el-button :disabled="(scope.row.taskState !== 0)" type="text" plain @click="handleptask(scope.row)">{{
              <el-button :disabled="(scope.row.taskState >=2)" type="text" plain @click="handleptask(scope.row)">{{
                $t('searchOrder.taskfailure') }}</el-button>
            </template>
          </el-table-column>
@@ -757,7 +807,7 @@
    <el-dialog v-model="dialogFormVisiblea" top="5vh" width="85%">
      <el-table ref="table" style="margin-top: 20px;height: 700px;" :data="tableDatab"
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }">
        <el-table-column prop="deviceId" fixed align="center" :label="$t('film.station')" min-width="80" />
        <!-- <el-table-column prop="deviceId" fixed align="center" :label="$t('film.station')" min-width="80" /> -->
        <el-table-column prop="slot" fixed align="center" :label="$t('film.slot')" min-width="80" />
        <el-table-column prop="patternWidth" align="center" :label="$t('film.width')" min-width="80" />
        <el-table-column prop="patternHeight" align="center" :label="$t('film.height')" min-width="80" />
@@ -865,11 +915,11 @@
        </div>
      </template>
    </el-dialog>
    <el-dialog v-model="dialogFormVisiblec" top="24vh" width="30%" :title="$t('film.pwarehousing')">
    <el-dialog v-model="dialogFormVisiblec" top="24vh" width="30%" :title="$t('film.emptyShelfPosition')">
      <div style="margin-left: 50px;margin-bottom: 10px;">
        <el-form-item :label="$t('film.position')" :required="true">
          <el-select v-model="leftingStation" clearable :placeholder="$t('film.cposition')" style="margin-left: 20px;">
            <el-option :label="$t('film.position1')" value="101"></el-option>
            <el-option :label="$t('film.position1')" value="99"></el-option>
          </el-select>
        </el-form-item>
      </div>
@@ -882,11 +932,11 @@
        </div>
      </template>
    </el-dialog>
    <el-dialog v-model="dialogFormVisiblee" top="24vh" width="30%" :title="$t('film.pwareout')">
    <el-dialog v-model="dialogFormVisiblee" top="24vh" width="30%" :title="$t('film.warehouseReturn')">
      <div style="margin-left: 50px;margin-bottom: 10px;">
        <el-form-item :label="$t('film.position')" :required="true">
          <el-select v-model="leftingStation" clearable :placeholder="$t('film.cposition')" style="margin-left: 20px;">
            <el-option :label="$t('film.position1')" value="101"></el-option>
            <el-option :label="$t('film.position1')" value="99"></el-option>
          </el-select>
        </el-form-item>
      </div>
@@ -998,22 +1048,22 @@
}
.img-dlpl {
  margin-left: 38px;
  margin-left: 345px;
  margin-top: 15px;
  background-image: url('../../assets/cangchu2.png');
  background-image: url('../../assets/aj.png');
  background-repeat: no-repeat;
  background-attachment: local;
  min-height: 800px;
  width: 1070px;
  max-width: 100%;
  background-size: 1500px 810px;
  background-size: 980px 700px;
  overflow: hidden;
  position: relative;
}
.img-car1 {
  display: flex;
  background-image: url('../../assets/cangchu1.png');
  background-image: url('');
  position: absolute;
  background-repeat: no-repeat;
  background-attachment: local;