Browse Source

还库任务初始化

zhaohuanhuan 1 month ago
parent
commit
e2d113372b

+ 74 - 0
src/api/returnTask/index.ts

@@ -0,0 +1,74 @@
+// @ts-ignore
+import request from '@/utils/request'
+// @ts-ignore
+import {createReturnFirstSeedType, createReturnTaskType, getReturnTaskBinListType, getReturnTaskPageType, returnTaskFirstStepCompleteType, updateReturnTaskUsedQtyType} from '@/types/returnTask'
+
+//分页查询还库任务列表
+export function getReturnTaskPage(params:getReturnTaskPageType) {
+  return request({
+    url: '/api/wms/return/task/page',
+    method: 'get',
+    params
+  })
+}
+
+//分页查询还库任务列表
+export function createReturnTask(data:createReturnTaskType) {
+  return request({
+    url: '/api/wms/return/task/create',
+    method: 'post',
+    data
+  })
+}
+
+
+//还库分配格口
+export function createReturnFirstSeed(data:createReturnFirstSeedType) {
+  return request({
+    url: '/api/wms/return/task/firstSeed',
+    method: 'post',
+    data
+  })
+}
+
+
+
+//查询还库分配格口数据
+export function getReturnTaskBinList(params:getReturnTaskBinListType) {
+  return request({
+    url: '/api/wms/return/task/item/list',
+    method: 'get',
+    params
+  })
+}
+
+
+
+//放弃任务
+export function returnTaskAbandon(data:getReturnTaskBinListType) {
+  return request({
+    url: '/api/wms/return/task/abandon',
+    method: 'post',
+    data
+  })
+}
+
+//完成分配格口和呼叫校车
+export function returnTaskFirstStepComplete(data:returnTaskFirstStepCompleteType) {
+  return request({
+    url: '/api/wms/return/task/firstStepComplete',
+    method: 'post',
+    data
+  })
+}
+
+//更新还库任务已使用数量
+export function updateReturnTaskUsedQty(data:updateReturnTaskUsedQtyType) {
+  return request({
+    url: '/api/wms/return/task/item/updateUsedQty',
+    method: 'post',
+    data
+  })
+}
+
+

+ 6 - 0
src/router/index.ts

@@ -182,6 +182,12 @@ const routes: RouteRecordRaw[] = [
     meta:{title:'还库列表'},
     meta:{title:'还库列表'},
     component: () => import('@/views/inventory/returnTask/list/index.vue')
     component: () => import('@/views/inventory/returnTask/list/index.vue')
   },
   },
+  {
+    path: '/return-bin',
+    name: 'ReturnBin',
+    meta:{title:'还库任务-分格口'},
+    component: () => import('@/views/inventory/returnTask/bin/index.vue')
+  },
   {
   {
     path: '/return-task',
     path: '/return-task',
     name: 'ReturnTask',
     name: 'ReturnTask',

+ 97 - 0
src/types/returnTask.ts

@@ -0,0 +1,97 @@
+
+/**
+ * 分页查询还库任务列表
+ */
+export interface getReturnTaskPageType {
+  page: number;
+  size: number;
+  warehouse: string;
+  /**
+   * 状态
+   */
+  status?: string;
+  /**
+   * 任务号
+   */
+  taskNo?: string;
+  [property: string]: any;
+}
+
+/**
+ * 创建还库任务
+ */
+export interface createReturnTaskType {
+  /**
+   * 容器号
+   */
+  containerCode: string;
+  /**
+   * 仓库编码
+   */
+  warehouse: string;
+  [property: string]: any;
+}
+
+/**
+ * 创建还库任务
+ */
+export interface createReturnFirstSeedType {
+  /**
+   * 商品条码
+   */
+  barcode: string;
+  /**
+   * 库位容器号
+   */
+  containerCode: string;
+  /**
+   * 商品批次号
+   */
+  lotNum: string;
+  /**
+   * 任务号
+   */
+  taskNo: string;
+  [property: string]: any;
+}
+
+//查询还库分配格口数据
+export interface getReturnTaskBinListType {
+  taskNo: string;
+  [property: string]: any;
+}
+
+//完成分配格口和呼叫校车
+export interface returnTaskFirstStepCompleteType {
+  /**
+   * 是否调用海康快上
+   */
+  callHikQuickIn: boolean;
+  /**
+   * 任务号
+   */
+  taskNo: string;
+  [property: string]: any;
+}
+
+/**
+ * 更新还库任务已使用数量
+ */
+export interface updateReturnTaskUsedQtyType {
+  /**
+   * 批次号
+   */
+  lotNum: string;
+  /**
+   * 本次移库数量
+   */
+  moveQty: number;
+  /**
+   * 任务号
+   */
+  taskNo: string;
+  [property: string]: any;
+}
+
+
+

+ 546 - 0
src/views/inventory/returnTask/bin/index.vue

@@ -0,0 +1,546 @@
+<template>
+  <div class="container">
+    <van-nav-bar
+        title="还库任务-分格口"
+        left-arrow
+        fixed
+        placeholder
+        @click-left="onClickLeft"
+    >
+      <template #left>
+        <van-icon name="arrow-left" size="25"/>
+        <div style="color: #fff">返回</div>
+      </template>
+      <template #right>
+        <div style="color: #fff;line-height: 46px " @click="onComplete">完成</div>
+        <div style="padding:14px 0 12px 6px" @click="onClickRightIcon">
+          <van-icon name="list-switch" size="25"/>
+        </div>
+      </template>
+    </van-nav-bar>
+    <div class="move-stock">
+      <div class="code">
+        <div class="code-title">
+          <div>{{ containerNo || '' }}</div>
+          <div class="code-tips">
+            <van-notice-bar :background="'none'" :speed="50" :text="tips"/>
+          </div>
+        </div>
+        <div class="code-input">
+          <van-search
+              ref="searchRef"
+              v-model="searchBarcode"
+              placeholder="请扫描商品条码"
+              @search="_handlerScan(searchBarcode)"
+              label="商品条码:"
+              left-icon=""
+              :class="[scanType===2?'search-input-barcode':'','van-hairline--bottom']"
+              @focus="scanType=2"
+              autocomplete="off"
+          >
+          </van-search>
+        </div>
+      </div>
+      <div class="move-stock-content">
+        <table class="compact-table">
+          <colgroup>
+            <col v-for="i in 10" style="width: 10%;">
+          </colgroup>
+          <tbody>
+          <tr>
+            <td colspan="3">格口</td>
+            <td colspan="7">{{ bin }}</td>
+          </tr>
+          </tbody>
+        </table>
+      </div>
+      <div class="move-stock-list">
+        <table class="task-table">
+          <thead>
+          <tr>
+            <th>商品条码</th>
+            <th>商品名称</th>
+            <th>格口号</th>
+            <th>数量</th>
+          </tr>
+          </thead>
+          <tbody>
+          <tr v-for="(item, index) in binList" :key="index" v-if="binList.length>0">
+            <td>{{ item.barcode }}</td>
+            <td>{{ item.skuName }}</td>
+            <td>{{ item.slot }}</td>
+            <td>{{ item.qty }}</td>
+          </tr>
+          <tr v-else>
+            <td colspan="4">
+              <van-empty :image="nodataUrl" image-size="120"/>
+            </td>
+          </tr>
+          </tbody>
+        </table>
+      </div>
+    </div>
+    <!-- 弹出框 -->
+    <van-action-sheet
+        v-model:show="modeTrueFalseBy"
+        :actions="actions"
+        cancel-text="取消"
+        close-on-click-action
+        @select="onSelectMode"
+    />
+    <!--  单据选择-->
+    <van-action-sheet v-model:show="lotBarcodeTrueFalseBy" cancel-text="取消" description="请选择商品批次"
+                      close-on-click-action>
+      <van-cell-group>
+        <van-cell v-for="item in lotBarcodeList"
+                  @click="_getRecommendedLocation(item.lotNum,item.customerId);barcodeActive=item;lotBarcodeTrueFalseBy=false">
+          <template #title>
+            {{ item.sku }}({{ item.availableQty }}件)
+          </template>
+          <template #label>
+            生产日期:{{ item.productionDate || '--' }}-失效日期:{{ item.expirationDate || '--' }}
+          </template>
+        </van-cell>
+      </van-cell-group>
+    </van-action-sheet>
+  </div>
+</template>
+
+<script setup>
+import {onMounted, onUnmounted, ref} from 'vue'
+import {useRouter, useRoute} from 'vue-router'
+import {useStore} from '@/store/modules/user'
+import {androidFocus, getHeader, goBack, scanError, scanSuccess} from '@/utils/android'
+import {closeListener, openListener, scanInit} from '@/utils/keydownListener'
+import {getInventoryList} from '@/api/check/index'
+import {closeLoading, showLoading} from '@/utils/loading'
+import nodataUrl from '@/assets/nodata.png'
+import {showConfirmDialog, showDialog, showNotify, showToast} from 'vant'
+import {getRecommendedLocation} from "@/api/haikang/index";
+import {
+  createReturnFirstSeed,
+  getReturnTaskBinList,
+  returnTaskAbandon,
+  returnTaskFirstStepComplete
+} from "@/api/returnTask/index";
+
+const router = useRouter()
+const route = useRoute()
+const store = useStore()
+try {
+  getHeader()
+  androidFocus()
+} catch (error) {
+  router.push('/login')
+}
+const warehouse = store.warehouse
+
+const pattern = /^[1-9]\d*$/
+// 容器号和扫描类型的状态
+const taskNo = ref(route.query.code)
+const containerNo = ref(route.query.container)
+//扫描类型
+const scanType = ref(2)
+const searchRef = ref(null)
+//扫描条码
+const searchBarcode = ref('')
+//扫描库位
+const location = ref('')
+//批次数据
+const lotBarcodeList = ref([])
+const lotBarcodeTrueFalseBy = ref(false)
+const barcodeActive = ref({})
+//格口
+const bin = ref('-')
+const binList = ref([])
+const model = ref({})
+const countRef = ref(null)
+const back = ref(true)
+// 页面初始化
+onMounted(() => {
+  openListener()
+  scanInit(_handlerScan)
+  loadData()
+})
+//切换模式
+const actions = [
+  {name: '放弃', key: 'abandon'}
+]
+const modeTrueFalseBy = ref(false)
+
+// 扫描条码监听
+const _handlerScan = (code) => {
+  if (scanType.value === 2) {
+    setTimeout(() => {
+      _getInventoryList(code)
+    }, 200)
+  }
+}
+// 获取库存数据
+const _getInventoryList = async (barcode) => {
+  const data = {warehouse, location: containerNo.value, barcode}
+  try {
+    showLoading()
+    const res = await getInventoryList(data)
+    closeLoading()
+    if (res.data.length === 0) {
+      scanError()
+      searchBarcode.value = ''
+      showNotify({duration: 5000, message: `条码:${barcode},未找到可还库库存,请检查条码!`})
+      tips.value = `条码:${barcode},未找到可还库库存,请检查条码!`
+      return
+    }
+    barcodeActive.value = {}
+    lotBarcodeList.value = res.data
+    searchBarcode.value = res.data[0].sku
+    if (lotBarcodeList.value.length == 1) {
+      barcodeActive.value = lotBarcodeList.value[0]
+      await _getRecommendedLocation(lotBarcodeList.value[0].lotNum, lotBarcodeList.value[0].customerId)
+    } else if (lotBarcodeList.value.length > 1) {
+      lotBarcodeTrueFalseBy.value = true
+    }
+
+  } catch (err) {
+    closeLoading()
+    console.error(err)
+  }
+}
+// 获取库存数据
+const _getRecommendedLocation = async (lotNum, owner) => {
+  try {
+    const params = {warehouse, lotNum, owner, zoneGroup: 'WH01-01'}
+    const res = await getRecommendedLocation(params)
+    //  'EA'数据
+    const eaItems = res.data.filter(item => item.type === 'EA')
+    // 获取 quantity < 300 的
+    let result = eaItems.find(item => item.quantity !== null && item.quantity < 1000)
+    // 获取 quantity 为 null 的
+    if (!result) {
+      result = eaItems.find(item => item.quantity === null)
+    }
+    if (result) {
+      if (result.quantity === null) {
+        scanError()
+        tips.value = `${searchBarcode.value}:库区内无商品库存,请调空料箱进行入库`
+        showNotify({
+          type: 'danger',
+          duration: 3000,
+          message: `${searchBarcode.value}:库区内无商品库存,请调空料箱进行入库`
+        })
+        searchBarcode.value = ''
+        scanType.value = 2
+        return
+      }
+      setLocation(result)
+    }
+  } catch (err) {
+    console.error(err)
+  }
+}
+
+// 设置库位
+const setLocation = (item) => {
+  const data = {
+    taskNo: taskNo.value,
+    barcode: searchBarcode.value,
+    lotNum: barcodeActive.value.lotNum,
+    containerCode: item.location
+  }
+  createReturnFirstSeed(data).then(res => {
+    scanSuccess()
+    searchBarcode.value = ''
+    bin.value = res.data
+    tips.value = `请扫描商品条码`
+    getTaskBinList()
+  }).catch(err => {
+    scanError()
+    barcodeActive.value = {}
+    searchBarcode.value = ''
+    bin.value = '-'
+    tips.value = `${err.message}`
+  })
+}
+
+// 提示文本根据扫描类型返回
+const tips = ref('请扫描商品条码')
+const onSelectMode = async (value) => {
+  if (value.key == 'abandon') {
+    showDialog({
+      title: '温馨提示',
+      message: '您正在进行放弃任务操作,是否继续?',
+    }).then(() => {
+      showLoading()
+      returnTaskAbandon({taskNo: taskNo.value}).then(res => {
+        router.push({name: 'ReturnList'})
+        showToast({duration: 3000, message: '当前任务已放弃正在跳转到任务页面,请稍后~'})
+      }).catch((err) => {
+        tips.value = `${err.message}`
+      }).finally(_ => {
+        closeLoading()
+      })
+    });
+
+  }
+}
+
+const getTaskBinList = () => {
+  getReturnTaskBinList({taskNo: taskNo.value}).then(res => {
+    binList.value = res.data.sort((a, b) => {
+      if (a.slot < b.slot) {
+        return 1;
+      }
+      if (a.slot > b.slot) {
+        return -1;
+      }
+      return 0
+    });
+  }).catch(err => {
+    scanError()
+    tips.value = `${err.message}`
+    showNotify({type: 'danger', duration: 3000, message: `${err.message}`})
+  })
+}
+const onClickRightIcon = () => {
+  modeTrueFalseBy.value = true
+}
+// 完成任务
+const onComplete = () => {
+  showConfirmDialog({
+    title: '温馨提示',
+    message:
+        '您正在进行完成操作,是否立即呼叫小车?',
+    confirmButtonText: '立即呼叫',
+    cancelButtonText: '不呼叫',
+  })
+    .then(() => {
+      _returnTaskFirstStepComplete(true)
+    })
+    .catch(() => {
+      _returnTaskFirstStepComplete(false)
+    });
+}
+const _returnTaskFirstStepComplete=(callHikQuickIn)=>{
+  showLoading()
+  returnTaskFirstStepComplete({taskNo:taskNo.value,callHikQuickIn}).then(res => {
+    if(callHikQuickIn){
+      router.replace({ name: 'ReturnTask', query: { code:taskNo.value,container:containerNo.value } });
+    }else {
+      router.push({name: 'ReturnList'})
+    }
+  }).finally(_ => {
+    closeLoading()
+  })
+}
+// 数据刷新
+const loadData = () => {
+  scanType.value = 2
+  getTaskBinList()
+  setTimeout(() => {
+    if (binList.value.length > 0) {
+      bin.value = binList.value[0].slot
+    }
+  }, 400)
+}
+
+const onClickLeft = () => {
+  router.push({name:'ReturnList'})
+};
+
+onUnmounted(() => {
+  closeListener()
+})
+
+window.onRefresh = loadData
+</script>
+
+<style scoped lang="scss">
+.container {
+  .move-stock {
+    .code {
+      background: #e9f4ff;
+      box-sizing: border-box;
+      padding: 8px 0;
+    }
+
+    .code-title {
+      display: flex;
+      justify-content: space-between;
+      padding: 0 15px 8px 15px;
+    }
+
+    .code-input {
+      ::v-deep(.van-search) {
+        padding: 0;
+        font-size: 16px;
+      }
+
+      ::v-deep(.van-search__field) {
+        border-bottom: 2px solid #ffffff;
+        height: 50px;
+        display: flex;
+        align-items: center;
+      }
+
+      ::v-deep(.van-search__content) {
+        background: #fff;
+        height: 50px;
+        display: flex;
+        align-items: center;
+      }
+
+      ::v-deep(.van-field__control) {
+        font-size: 16px;
+        height: 50px;
+        line-height: 50px;
+      }
+
+      .search-input-barcode {
+        ::v-deep(.van-search__field) {
+          border-bottom: 2px solid #0077ff;
+          z-index: 2;
+        }
+      }
+    }
+
+    .code-tips {
+      color: #ed6a0c;
+      flex: 1;
+    }
+
+    .code-count {
+      font-size: 16px;
+      font-weight: bold;
+
+      span {
+        color: #0077ff;
+      }
+    }
+
+    .nav-right {
+      padding: 14px 0 12px 5px;
+    }
+
+    .move-stock-list {
+      width: 100%;
+      overflow-y: auto;
+      max-height: 280px;
+      min-height: 100px;
+
+      .move-button {
+        background: #1989fa;
+        color: #fff;
+        width: 100%;
+        height: 30px;
+        font-size: 14px;
+        line-height: 30px;
+        font-weight: bold;
+      }
+
+      .task-table,
+      .task-table-bin,
+      .task-table-box {
+        width: 100%;
+        table-layout: fixed;
+        border-collapse: collapse;
+        font-size: 13px;
+      }
+
+      .task-table th,
+      .task-table-bin th,
+      .task-table td,
+      .task-table-bin td,
+      .task-table-box th,
+      .task-table-box td {
+        text-align: center;
+        border: 1px solid #ccc;
+        word-wrap: break-word;
+        word-break: break-all;
+      }
+
+      .task-table thead,
+      .task-table-bin thead,
+      .task-table-box thead {
+        background-color: #3f8dff;
+        position: sticky;
+        top: 0;
+        color: white;
+        font-size: 13px;
+      }
+
+      .task-table-bin thead {
+        background-color: #3f8dff;
+      }
+
+      .task-table-bin tbody {
+        background: #cde7ff;
+      }
+
+      .task-table tbody tr.pricking-active {
+        background-color: #d6f9e7;
+      }
+
+      .task-table tbody tr.stock-active {
+        background-color: #fffadd;
+      }
+
+      .task-table tbody tr.virtual-active {
+        background-color: #cacaca;
+      }
+    }
+
+    .move-stock-content {
+      margin-bottom: 10px;
+
+      .compact-table {
+        width: 100%;
+        border-collapse: collapse;
+        margin: 0;
+        font-size: 14px;
+        line-height: 1.2;
+        border: 1px solid #ccc;
+
+        td {
+          padding: 8px 12px;
+          border: 1px solid #ccc;
+          background: transparent;
+          text-align: center;
+        }
+
+        td:first-child {
+          color: #333;
+          font-size: 25px;
+        }
+
+        td:last-child {
+          color: #e63535;
+          font-size: 50px;
+
+        }
+      }
+    }
+  }
+}
+
+.count-input {
+  ::v-deep(.van-field__value) {
+    border-bottom: 2px solid #0077ff;
+    font-size: 16px;
+  }
+}
+
+.completion {
+  text-align: right;
+  font-size: 14px;
+  line-height: 35px;
+  color: #0077ff;
+  padding: 0 10px;
+  cursor: pointer;
+  text-decoration: underline;
+}
+
+.tips {
+  font-size: 13px;
+  text-align: left;
+  padding: 5px 15px;
+}
+</style>

+ 47 - 48
src/views/inventory/returnTask/list/index.vue

@@ -27,26 +27,26 @@
                 <tr>
                 <tr>
                   <th>任务号</th>
                   <th>任务号</th>
                   <th style="width: 50px">状态</th>
                   <th style="width: 50px">状态</th>
-                  <th style="width: 70px">创建日期</th>
-                  <th style="width: 60px">剩余数量</th>
+                  <th style="width: 75px">创建日期</th>
+                  <th style="width: 55px">剩余数量</th>
                   <th style="width: 70px">操作</th>
                   <th style="width: 70px">操作</th>
                 </tr>
                 </tr>
                 </thead>
                 </thead>
                 <tbody>
                 <tbody>
                 <tr v-for="(row, rowIndex) in taskList" :key="rowIndex">
                 <tr v-for="(row, rowIndex) in taskList" :key="rowIndex">
-                  <td style="word-wrap: break-word" >{{ row.code }}</td>
-                  <td style="word-wrap: break-word" >{{ statusMap[row.status] || row.status }}</td>
-                  <td style="word-wrap: break-word;font-size:11px">26012107:09</td>
-                  <td style="word-wrap: break-word;">{{ row.locationQuantity }}</td>
+                  <td style="word-wrap: break-word" >{{ row.containerCode }}</td>
+                  <td style="word-wrap: break-word" >{{ row.statusDesc }}</td>
+                  <td style="word-wrap: break-word;font-size:11px">{{ time(row.createTime) }}</td>
+                  <td style="word-wrap: break-word;">{{ row.remainingQty }}</td>
                   <td>
                   <td>
-                    <van-button type="primary" size="mini" plain  @click="linkTask(row.code,'MoveDown')">作业</van-button>
-                    <van-button type="primary" size="mini" plain @click="linkTask(row.code,'MoveDown')">查看</van-button>
+                    <van-button type="primary" size="mini" plain  @click="linkTask(row)">作业</van-button>
+                    <van-button type="primary" size="mini" plain @click="linkTask(row)">查看</van-button>
                   </td>
                   </td>
                 </tr>
                 </tr>
                 <tr v-if="taskList.length==0 && !loadingMore">
                 <tr v-if="taskList.length==0 && !loadingMore">
                   <td colspan="5">
                   <td colspan="5">
                     <van-empty :image="nodataUrl" image-size="140" >
                     <van-empty :image="nodataUrl" image-size="140" >
-                      <van-button round type="primary" class="bottom-button" size="small" @click="loadData">刷新</van-button>
+                      <van-button round type="primary" class="bottom-button" size="small" @click="loadData(true)">刷新</van-button>
                     </van-empty>
                     </van-empty>
                   </td>
                   </td>
                 </tr>
                 </tr>
@@ -64,16 +64,14 @@
 
 
 <script setup>
 <script setup>
 import { computed, onMounted, ref } from 'vue'
 import { computed, onMounted, ref } from 'vue'
-import { getHeader, goBack, scanError } from '@/utils/android'
+import {getHeader, goBack, scanError, scanSuccess} from '@/utils/android'
 import { useStore } from '@/store/modules/user'
 import { useStore } from '@/store/modules/user'
-import { getMoveTaskList } from '@/api/transferMove/index'
 import { showToast } from 'vant'
 import { showToast } from 'vant'
 import nodataUrl from '@/assets/nodata.png'
 import nodataUrl from '@/assets/nodata.png'
 import { closeLoading, showLoading } from '@/utils/loading'
 import { closeLoading, showLoading } from '@/utils/loading'
 import { useRouter } from 'vue-router'
 import { useRouter } from 'vue-router'
-import { toMap } from '@/utils/dataType.js'
 import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
 import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
-import { openListener, scanInit } from '@/utils/keydownListener.js'
+import {createReturnTask, getReturnTaskPage} from "@/api/returnTask/index.ts";
 const router = useRouter()
 const router = useRouter()
 try {
 try {
   getHeader()
   getHeader()
@@ -95,15 +93,15 @@ const statusMap=ref({
 })
 })
 
 
 // 分页相关状态
 // 分页相关状态
-const pageNum = ref(1)
-const pageSize = ref(20)
+const page = ref(1)
+const size = ref(20)
 const hasMore = ref(true)
 const hasMore = ref(true)
 const loadingMore = ref(false)
 const loadingMore = ref(false)
 
 
 const loadData = async (isLoadMore = false) => {
 const loadData = async (isLoadMore = false) => {
   if (!isLoadMore) {
   if (!isLoadMore) {
     showLoading()
     showLoading()
-    pageNum.value = 1
+    page.value = 1
     taskList.value = []
     taskList.value = []
   } else {
   } else {
     loadingMore.value = true
     loadingMore.value = true
@@ -111,20 +109,19 @@ const loadData = async (isLoadMore = false) => {
 
 
   try {
   try {
     const params = {
     const params = {
-      warehouseCode: warehouse,
-      pageNum: pageNum.value,
-      pageSize: pageSize.value
+      warehouse: warehouse,
+      page: page.value,
+      size: size.value
     }
     }
-    const res = await getMoveTaskList(params)
-
+    const res = await getReturnTaskPage(params)
     if (isLoadMore) {
     if (isLoadMore) {
-      taskList.value = [...taskList.value, ...res.data]
+      taskList.value = [...taskList.value, ...res.data.records]
     } else {
     } else {
-      taskList.value = res.data
+      taskList.value = res.data.records
     }
     }
 
 
     // 判断是否还有更多数据
     // 判断是否还有更多数据
-    hasMore.value = res.data && res.data.length === pageSize.value
+    hasMore.value = res.data.records && res.data.records.length === size.value
   } finally {
   } finally {
     if (!isLoadMore) {
     if (!isLoadMore) {
       closeLoading()
       closeLoading()
@@ -133,11 +130,23 @@ const loadData = async (isLoadMore = false) => {
     }
     }
   }
   }
 }
 }
-
+ const time=(createTime)=>{
+   // 创建一个日期对象
+   let date = new Date(createTime);
+// 获取年月日时分的部分
+   let year = date.getFullYear().toString().slice(2); // 获取年份的后两位
+   let month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份,保证两位
+   let day = String(date.getDate()).padStart(2, '0'); // 获取日期,保证两位
+   let hours = String(date.getHours()).padStart(2, '0'); // 获取小时,保证两位
+   let minutes = String(date.getMinutes()).padStart(2, '0'); // 获取分钟,保证两位
+// 组装成目标格式
+   let formattedDate = `${year}${month}${day}${hours}:${minutes}`;
+   return formattedDate
+ }
 // 上拉加载更多
 // 上拉加载更多
 const loadMore = () => {
 const loadMore = () => {
   if (hasMore.value && !loadingMore.value) {
   if (hasMore.value && !loadingMore.value) {
-    pageNum.value++
+    page.value++
     loadData(true)
     loadData(true)
   }
   }
 }
 }
@@ -148,35 +157,25 @@ const onClickRight=()=>{
   inputBarcodeRef.value?.show(undefined,'请扫描反拣容器','')
   inputBarcodeRef.value?.show(undefined,'请扫描反拣容器','')
 }
 }
 const setBarcode=(code)=>{
 const setBarcode=(code)=>{
-  const checkContainer = `FJ-${warehouse}-`
-  if (!code.includes(checkContainer)) {
+  createReturnTask({warehouse,containerCode:code}).then(res=>{
+    console.log(res,"res")
+    scanSuccess()
+    router.push({ name:'ReturnTask', query: { code: res.data,container:code,status:'CREATING' } });
+  }).catch(err=>{
     scanError()
     scanError()
     setTimeout(()=>{
     setTimeout(()=>{
-      inputBarcodeRef.value?.show('', '请扫描反拣容器', '扫描容器不是反拣容器,请重新扫描')
+      inputBarcodeRef.value?.show('', '请扫描反拣容器', err.message)
     },300)
     },300)
-    return
-  }
-  router.push({ name:'ReturnTask', query: { code: code,status:0 } });
+  })
 }
 }
 
 
 // 进入任务
 // 进入任务
-const linkTask = (code, name) => {
-  if (code !== 0) {
-    localStorage.setItem('MOVETASKCODE', code);
-  }
-  let taskCode = localStorage.getItem('MOVETASKCODE') || code;
-  const listMap = toMap(taskList.value, 'code');
-  if (taskCode == 0) {
-    taskCode = taskList.value.length > 0
-      ? taskList.value[0].code
-      : listMap[taskCode]?.code || code
-  } else {
-    taskCode = taskList.value.length > 0?listMap[taskCode]?.code || taskList.value[0].code:0
-  }
-  router.push({ name, query: { code: taskCode } });
-  if (taskCode !== 0) {
-    localStorage.setItem('MOVETASKCODE', taskCode);
+const linkTask = (item) => {
+  let name='ReturnBin'
+  if(item.status=='WORKING'){
+    name='ReturnTask'
   }
   }
+  router.push({ name, query: { code:item.taskNo,container:item.containerCode,status:item.status } });
 };
 };
 
 
 /**
 /**

File diff suppressed because it is too large
+ 562 - 330
src/views/inventory/returnTask/task/index.vue


Some files were not shown because too many files changed in this diff