zhaohuanhuan 1 год назад
Родитель
Сommit
62592af01c

+ 70 - 1
src/api/blind/index.ts

@@ -1,7 +1,7 @@
 // @ts-ignore
 import request from '@/utils/request'
 // @ts-ignore
-import { checkBlindBarcodeType, getBlindTaskType, getMovingTaskType } from '@/types/blind'
+import { checkBlindBarcodeType, getBlindTaskType, getMovingTaskType, setBoxBarcodeCountType, setBoxCacheDataType, submitBoxCacheDataType, } from '@/types/blind'
 
 /**
  * 盲收任务获取
@@ -56,6 +56,75 @@ export function checkBlindBarcode(params:checkBlindBarcodeType) {
     params
   })
 }
+/**
+ * 盲收-查询缓存数据-按箱清点+分货多人
+ */
+export function getBoxCacheData(params:{code:string}) {
+  return request({
+    url: 'api/entryOrder/app/blind/getCacheData',
+    method: 'get',
+    params
+  })
+}
+/**
+ * 盲收-添加缓存数据-按箱清点+分货多人
+ */
+export function setBoxCacheData(data:setBoxCacheDataType) {
+  return request({
+    url: 'api/entryOrder/app/blind/addCacheData',
+    method: 'post',
+    data
+  })
+}
+
+
+/**
+ * 盲收-根据sku+箱号修改缓存数据数量-按箱清点+分货多人
+ */
+export function setBoxBarcodeCount(data:setBoxBarcodeCountType) {
+  return request({
+    url: 'api/entryOrder/app/blind/updateCacheDataQty',
+    method: 'post',
+    data
+  })
+}
+
+/**
+ * 盲收-根据格口清除缓存数据-按箱清点+分货多人
+ */
+export function resetBoxCacheDataBin(params: { code:string ,latticeCode:string}) {
+  return request({
+    url: '/api/entryOrder/app/blind/clearCacheDataByLatticeCode',
+    method: 'post',
+    params
+  })
+}
+
+/**
+ * 盲收-重置缓存数据-按箱清点+分货多人
+ */
+export function resetBoxCacheData(params: { code:string }) {
+  return request({
+    url: 'api/entryOrder/app/blind/resetCacheData',
+    method: 'post',
+    params
+  })
+}
+
+/**
+ * 盲收-提交数据-按箱清点+分货多人
+ */
+export function submitBoxCacheData(data:submitBoxCacheDataType) {
+  return request({
+    url: 'api/entryOrder/app/blind/submitData',
+    method: 'post',
+    params:data
+  })
+}
+
+
+
+
 
 
 

+ 40 - 0
src/types/blind.ts

@@ -16,3 +16,43 @@ export interface checkBlindBarcodeType {
   ownerCode: string;
   barcode: string;
 }
+
+/**
+ * 盲收-添加缓存数据-按箱清点+分货多人
+ * ownerCode 货主
+ * code 盲收任务号
+ * barCode 条码
+ * cartonCode 箱号
+ */
+export interface setBoxCacheDataType {
+  ownerCode: string;
+  code: string;
+  cartonCode: string;
+  barCode: string;
+}
+
+/**
+ * 盲收-添加缓存数据-按箱清点+分货多人
+ * ownerCode 货主
+ * sku
+ * cartonCode 箱号
+ */
+export interface setBoxBarcodeCountType {
+  code: string;
+  cartonCode: string;
+  sku: string;
+  qty: string;
+}
+
+/**
+ * 盲收-添加缓存数据-按箱清点+分货多人
+ * ownerCode 货主
+ * type  任务模式:EntryBlindTaskTypeEnum(按箱清点+分货)
+ */
+export interface submitBoxCacheDataType {
+  code: string;
+  ownerCode: string;
+  type: string;
+}
+
+

+ 56 - 0
src/views/inbound/blindCollection/components/BarcodeCount.vue

@@ -0,0 +1,56 @@
+<template>
+  <div class="container-no-container">
+    <van-dialog v-model:show="barcodeTrueFalseBy"
+                :beforeClose="beforeClose"
+                :title="'条码:'+barcode+'请输入数量!'"
+                show-cancel-button>
+      <van-field  :class="['code-input',count>0?'success-border':'']"
+                 v-model="count"
+                 ref="countRef"
+                 type="digit"
+                 clearable :max="10000"
+                 placeholder="请输入数量" />
+    </van-dialog>
+  </div>
+</template>
+<script setup lang="ts">
+import { ref } from 'vue'
+import { showToast } from 'vant'
+  const barcodeTrueFalseBy=ref(false)
+  const countRef=ref(null)
+  const barcode=ref('');
+  const count=ref('');
+
+const show = async (code) => {
+    barcodeTrueFalseBy.value = true
+    barcode.value=code
+    count.value=''
+    setTimeout(()=>{
+      countRef.value?.focus()
+    },200)
+  }
+  //输入数量
+  const emit = defineEmits()
+  const  beforeClose=  (action) =>
+    new Promise(async (resolve) => {
+      if (action === 'confirm') {
+        if (count.value == '') {
+          showToast('请输入数量')
+          return resolve(false)
+        }
+        emit('setBarcodeCount', count.value)
+      }
+      resolve(true)
+    });
+    defineExpose({show})
+</script>
+<style scoped lang="sass">
+   .container-no-container
+     .code-input
+       font-size: 22px
+       font-weight: bold
+       border-bottom: 2px solid #0077ff
+       margin-top: 10px
+     .success-border
+       border-bottom: 2px solid #1ca600
+</style>

+ 40 - 0
src/views/inbound/blindCollection/components/LotAttQuality.vue

@@ -0,0 +1,40 @@
+<template>
+  <div class="container-select-owner">
+    <van-popup v-model:show="lotAttQualityTrueFalseBy" destroy-on-close round position="bottom">
+      <van-picker
+        title="选择质量状态"
+        :model-value="pickerValue"
+        :columns="columns"
+        @cancel="lotAttQualityTrueFalseBy = false"
+        @confirm="onConfirm"
+      />
+    </van-popup>
+
+  </div>
+</template>
+<script setup>
+import { ref } from 'vue'
+const columns =[{ text: '正品', value: 'ZP' },
+                { text: '残次', value: 'CP' },
+                { text: '机损', value: 'JS' },
+                { text: '箱损', value: 'JS' },
+                { text: '在途库存', value: 'JS' },
+                ]
+const fieldValue = ref(' 正品');
+const lotAttQualityTrueFalseBy=ref(false)
+const show = () => {
+  lotAttQualityTrueFalseBy.value = true
+}
+const pickerValue = ref([{ text: '正品', value: 'ZP' }]);
+const emit = defineEmits()
+const onConfirm=({ selectedValues, selectedOptions })=>{
+  pickerValue.value = selectedValues;
+  fieldValue.value = selectedOptions[0].value
+  lotAttQualityTrueFalseBy.value = false
+  emit('selectLotAttQuality', fieldValue.value)
+}
+defineExpose({show})
+
+</script>
+<style lang="scss" scoped>
+</style>

+ 36 - 0
src/views/inbound/blindCollection/components/ProductDate.vue

@@ -0,0 +1,36 @@
+<template>
+  <div class="container-select-owner">
+    <van-popup v-model:show="productDateTrueFalseBy" destroy-on-close round position="bottom">
+      <van-date-picker
+        title="选择日期"
+        :model-value="pickerValue"
+        :min-date="minDate"
+        @confirm="onConfirm"
+        @cancel="productDateTrueFalseBy = false"
+      />
+    </van-popup>
+
+  </div>
+</template>
+<script setup>
+import { ref } from 'vue'
+const result = ref('');
+const productDateTrueFalseBy=ref(false)
+const minDate= new Date(2022, 0, 1)
+const show = () => {
+  productDateTrueFalseBy.value = true
+}
+
+const pickerValue = ref(['2023', '01', '01'])
+const emit = defineEmits()
+const onConfirm=({ selectedValues })=>{
+  result.value = selectedValues.join('-');
+  pickerValue.value = selectedValues;
+  productDateTrueFalseBy.value = false
+  emit('ProductDate', result.value)
+}
+defineExpose({show})
+
+</script>
+<style lang="scss" scoped>
+</style>

+ 76 - 0
src/views/inbound/blindCollection/components/ResetData.vue

@@ -0,0 +1,76 @@
+<template>
+  <div class="container-no-container">
+    <van-dialog v-model:show="resetDataTrueFalseBy"
+                :beforeClose="beforeClose"
+                title="若确定重新清点,请输入格口号!"
+                show-cancel-button
+                >
+      <van-field  :class="['code-input',bin>0?'success-border':'']"
+                 v-model="bin"
+                 ref="binRef"
+                 type="digit"
+                 clearable :max="1000"
+                 placeholder="请输入格口" />
+      <van-row>
+        <van-col span="16"></van-col>
+        <van-col span="8"><div class="completion" @click="onConfirm" >清除全部</div></van-col>
+      </van-row>
+    </van-dialog>
+  </div>
+</template>
+<script setup lang="ts">
+import { ref } from 'vue'
+import { showToast } from 'vant'
+const resetDataTrueFalseBy=ref(false)
+const binRef=ref(null)
+const bin=ref('');
+const props = defineProps({
+  binData: Array
+});
+const show = async () => {
+    resetDataTrueFalseBy.value = true
+    bin.value=''
+    setTimeout(()=>{
+      binRef.value?.focus()
+    },200)
+  }
+  //输入数量
+  const emit = defineEmits()
+  const  beforeClose=  (action) =>
+    new Promise(async (resolve) => {
+      if (action === 'confirm') {
+        if (bin.value == '') {
+          showToast('请输入格口号')
+          return resolve(false)
+        }
+        // if (bin.value>props.binData?.length) {
+        //   showToast({duration:6000,message:`输入格口号${bin.value}不存在,请输入${props.binData?.length}以内格口号`})
+        //   return resolve(false)
+        // }
+        emit('resetData', bin.value,'bin')
+      }
+      resolve(true)
+    });
+    const onConfirm=()=>{
+      resetDataTrueFalseBy.value = false
+      emit('resetData',undefined,'all')
+    }
+    defineExpose({show})
+</script>
+<style scoped lang="sass">
+   .container-no-container
+     .code-input
+       font-size: 22px
+       font-weight: bold
+       border-bottom: 2px solid #0077ff
+       margin-top: 10px
+     .completion
+       text-align: right
+       font-size: 14px
+       padding: 10px 20px 10px 0
+       cursor: pointer
+       text-decoration: underline
+       color: #ff0d00
+     .success-border
+       border-bottom: 2px solid #1ca600
+</style>

+ 19 - 3
src/views/inbound/blindCollection/components/TaskList.vue

@@ -14,7 +14,7 @@
           <th style="width: 60px">货主</th>
           <th style="width: 72px">创建时间</th>
           <th>创建人</th>
-          <th>状态</th>
+          <th style="width: 40px">状态</th>
           <th style="width: 50px">操作</th>
         </tr>
         </thead>
@@ -24,8 +24,8 @@
           <td>{{ item.ownerName }}</td>
           <td>{{ item.createTime }}</td>
           <td>{{ item.creator }}</td>
-          <td>{{ item.status }}</td>
-          <td><van-button plain size="mini" type="primary">接受任务</van-button></td>
+          <td :style="statusStyle(item.status)" >{{ item.status }}</td>
+          <td><van-button plain size="mini" type="primary" @click="onTaskDetail(item)">接受任务</van-button></td>
 
         </tr>
         </tbody>
@@ -36,6 +36,7 @@
 </template>
 <script setup lang="ts">
 import { nextTick, onMounted, ref } from 'vue'
+import { useRouter } from 'vue-router'
 const taskTrueFalseBy=ref(false)
 const taskList=ref({})
 onMounted(()=>{
@@ -43,10 +44,25 @@ onMounted(()=>{
     window.scrollTo(0, 0);
   });
 })
+const statusStyle = (status) => {
+  switch (status) {
+    case '作业中':
+      return { color: '#ff941a' }
+    case '创建':
+      return { color: '#07c160' }
+    default:
+      return { color: '#000' }
+  }
+}
 const show = async (list) => {
   taskList.value = list
   taskTrueFalseBy.value = true
 }
+const router = useRouter()
+const onTaskDetail = (item) => {
+  taskTrueFalseBy.value = false
+  router.push({name:'BlindTask',query: { code:item.code,type:item.type }})
+}
 defineExpose({show})
 </script>
 <style scoped lang="sass">

+ 9 - 6
src/views/inbound/blindCollection/mode/index.vue

@@ -5,10 +5,11 @@
       left-arrow
       fixed
       placeholder
+      @click-left="goBack"
     >
       <template #left>
-        <van-icon name="arrow-left" size="25"   @click="goBack" />
-        <div style="color: #fff" @click="onClickLeft">返回</div>
+        <van-icon name="arrow-left" size="25"/>
+        <div style="color: #fff">返回</div>
       </template>
       <template #right>
         <div style="color: #fff" @click="onClickRight">任务中心</div>
@@ -45,7 +46,6 @@
             <div class="right">
               <van-button type="primary" round size="small"> 选择</van-button>
             </div>
-
           </div>
           <div class="select-item"  @click="onSelect(3)">
             <i class="iconfont icon-shoudongluru select-item-icon" style="color: #ef9a00"></i>
@@ -60,7 +60,7 @@
           <div class="select-item"  @click="onSelect(5)">
             <i class="iconfont icon-zhuangxiangyanhuodan select-item-icon" style="color:#55d1c2;"></i>
             <div class="left">
-              <div class="select-item-title">按箱清点+分货多人</div>
+              <div class="select-item-title">按箱清点+分货</div>
               <div class="select-item-tips">步骤:扫描箱号->扫描条码->统计数量</div>
             </div>
             <div class="right">
@@ -76,8 +76,8 @@
 <script setup>
 import { goBack } from '@/utils/android.ts'
 import { useRoute, useRouter } from 'vue-router'
-import { onMounted, ref } from 'vue'
-import { openListener, scanInit } from '@/utils/keydownListener.js'
+import { onMounted, onUnmounted, ref } from 'vue'
+import { closeListener, openListener, scanInit } from '@/utils/keydownListener.js'
 import { getBlindTask, getBlindTaskList, getMovingTask, setBlindTaskMode } from '@/api/blind/index.ts'
 import { showConfirmDialog, showToast } from 'vant'
 import TaskList from '@/views/inbound/blindCollection/components/TaskList.vue'
@@ -95,6 +95,9 @@ onMounted(() => {
     scanInit(_handlerScan)
   },300)
 })
+onUnmounted(() => {
+  closeListener()
+})
 //监听扫描
 const _handlerScan=(code)=>{
   if (/[a-zA-Z]/.test(code)) {

+ 0 - 0
src/views/inbound/blindCollection/task/hooks/data.ts


+ 427 - 26
src/views/inbound/blindCollection/task/index.vue

@@ -5,54 +5,455 @@
       left-arrow
       fixed
       placeholder
+      @click-left="onClickLeft"
     >
       <template #left>
-        <van-icon name="arrow-left" size="25"   @click="goBack" />
-        <div style="color: #fff" @click="onClickLeft">返回</div>
+        <van-icon name="arrow-left" size="25" />
+        <div style="color: #fff" >返回</div>
       </template>
       <template #right>
         <div style="color: #fff" @click="onClickRight">提交任务</div>
       </template>
     </van-nav-bar>
-    <van-field v-model="barcode" label="条码" placeholder="请扫描条码"  @keydown.enter.native="_checkBarcode" />
+    <div class="blind-task-list">
+      <van-cell-group inset>
+        <van-field label-width="70" center class="select" v-model="taskInfo.ownerName" readonly :is-link="modeType===3" @click-right-icon="onLotAtt"	  >
+          <template #label>
+            <van-button size="small" plain type="danger" @click="_resetData" >重新清点</van-button>
+          </template>
+          <template #right-icon v-if="modeType===3" >
+            <van-tag type="primary">正品</van-tag>
+          </template>
+        </van-field>
+        <table  border="0" style="border-collapse: collapse" v-if="modeType===5" >
+          <tbody>
+          <tr style="border-bottom: 1px solid #ebedf0">
+            <td width="70px" style="border-right: 1px solid #ebedf0" >箱号</td>
+            <td width="120px" style="border-right: 1px solid #ebedf0;word-break: break-all" >{{ preBoxNo || '--' }}<van-icon v-if="preBoxNo" name="edit" color="#0077aa" /></td>
+            <td>
+              <van-field  label-width="70" :class="focusType===5?'box-input':'select'" ref="boxNoRef" v-model="boxNo"
+                         label="" @focus="onFocus(5)" @blur="onFocus(0)" placeholder="请扫描箱号" clearable  @keydown.enter="_scanBox"  >
+              </van-field>
+            </td>
+          </tr>
+          <tr>
+            <td width="70px" style="border-right: 1px solid #ebedf0" >条码</td>
+            <td width="120px" style="border-right: 1px solid #ebedf0;word-break: break-all" >{{ preBarcode || '--' }}</td>
+            <td>
+              <van-field  label-width="70" :class="focusType===1?'box-input':'select'" ref="barcodeRef" v-model="barcode"
+                 @focus="onFocus(1)" @blur="onFocus(0)" placeholder="请扫描条码" clearable
+                 @keydown.enter="_checkBarcode" />
+            </td>
+          </tr>
+          </tbody>
+        </table>
+        <van-field v-if="modeType!==5" label-width="70" :class="focusType===1?'input':'select'" ref="barcodeRef" v-model="barcode"
+                   label="条码" @focus="onFocus(1)" @blur="onFocus(0)" placeholder="请扫描条码" clearable
+                   @keydown.enter.native="_checkBarcode" />
+        <van-field label-width="70" class="select" v-model="manufactureDate" label="生产日期" v-if="modeType===3"
+                   placeholder="请选择生产日期" readonly is-link @click="onProduct(1)" />
+        <van-field label-width="70" class="select" v-model="expirationDate" label="失效日期" v-if="modeType===3"
+                   placeholder="请选择失效日期" readonly is-link @click="onProduct(2)" />
+        <van-field label-width="70" :class="focusType===2?'input':'select'" ref="lotNumberRef" v-model="lotNumber" v-if="modeType===3"
+                   label="批次号" @focus="onFocus(2)"  @blur="onFocus(0)"  placeholder="请扫描批次号" clearable />
+        <van-field label-width="70" :class="focusType===3?'input':'select'" ref="countRef" v-model="count" center v-if="modeType===3"
+                   label="数量" @focus="onFocus(3)"  @blur="onFocus(0)"  :min="1" :max="10000" type="digit" placeholder="请输入数量">
+          <template #button>
+            <van-button size="small" type="primary">装&nbsp;&nbsp;箱</van-button>
+          </template>
+        </van-field>
+        <van-grid clickable :column-num="2" v-if="modeType!==3">
+          <van-grid-item icon="home-o" text="数量">
+            <template #icon>
+              <div class="number">{{newOneData.qty}}</div>
+            </template>
+          </van-grid-item>
+          <van-grid-item  v-if="modeType===2 ">
+            <template #default>
+              <van-button  type="primary">装&nbsp;&nbsp;箱</van-button>
+            </template>
+          </van-grid-item>
+          <van-grid-item text="格口" v-else>
+            <template #icon>
+              <div  class="bin">{{newOneData.latticeCode}}</div>
+            </template>
+          </van-grid-item>
+        </van-grid>
+        <van-field label-width="70"  class="select" v-model="newOneData.barCode" center  label="上一条:"  placeholder="上条数据" readonly>
+          <template #button v-if="modeType!==5 && newOneData.latticeCode">
+            <van-button size="mini" type="danger" plain @click="resetNewBin" >取 消</van-button>
+          </template>
+        </van-field>
+      </van-cell-group>
+    </div>
+    <div class="blind-task-table" >
+      <van-cell-group inset v-if="modeType===5">
+        <div style="display: flex">
+          <div style="flex: 1">
+            <table class="task-table-box" >
+              <thead>
+              <tr>
+                <th style="min-width: 40px">箱号</th>
+                <th style="min-width: 40px">条码</th>
+                <th style="min-width: 40px">数量</th>
+              </tr>
+              </thead>
+              <tbody>
+              <tr v-if="boxTypeData.cartonDataList" v-for="(item,index) in boxTypeData.cartonDataList" :key="index" @click="_setBarcodeCount(item)">
+                <td>{{ item.cartonCode }}</td>
+                <td>{{ item.barCode }}</td>
+                <td>{{ item.qty }}</td>
+              </tr>
+              </tbody>
+            </table>
+          </div>
+          <div style="flex: 1">
+            <table class="task-table-bin" v-if="modeType===5">
+              <thead>
+              <tr>
+                <th style="min-width: 40px">格口</th>
+                <th style="min-width: 40px">条码</th>
+                <th style="min-width: 40px">数量</th>
+              </tr>
+              </thead>
+              <tbody>
+              <tr v-if="boxTypeData.latticeDataList" v-for="(item,index) in boxTypeData.latticeDataList" :key="index">
+                <td>{{ item.latticeCode }}</td>
+                <td>{{ item.barCode }}</td>
+                <td>{{ item.qty }}</td>
+              </tr>
+              </tbody>
+            </table>
+          </div>
+        </div>
+        </van-cell-group>
+        <van-cell-group inset v-else>
+        <table class="task-table">
+          <thead>
+          <tr>
+            <th width="120px" >商品条码</th>
+            <th>格口/箱号</th>
+            <th width="80px">数量({{allCount}})</th>
+            <th>操作</th>
+          </tr>
+          </thead>
+          <tbody>
+          <tr v-if="boxTypeData.latticeDataList" v-for="(item,index) in boxTypeData.latticeDataList" :key="index" :class="{'odd-row': index % 2 !=0}">
+            <td>{{ item.barCode }}</td>
+            <td>{{ item.latticeCode }}</td>
+            <td>{{ item.qty }}</td>
+            <td>
+              <van-button plain size="mini" type="primary" @click="_setBarcodeCount(item)" >修改数量</van-button>
+            </td>
+          </tr>
+          </tbody>
+        </table>
+      </van-cell-group>
+    </div>
+    <lot-att-quality ref="lotAttQualityRef" @selectLotAttQuality="selectLotAttQuality" />
+    <product-date  ref="productDateRef" @productDate="onProductDate"  />
+    <barcode-count ref="barcodeCountRef" @setBarcodeCount="setBarcodeCount" />
+    <van-back-top right="15vw" bottom="10vh" />
+    <reset-data ref="resetDataRef" :binData="boxTypeData?boxTypeData.latticeDataList:[]" @resetData="onResetData" />
   </div>
 </template>
 <script setup>
-import { goBack } from '@/utils/android'
 import { useRoute } from 'vue-router'
-import { checkBlindBarcode, getBlindTask } from '@/api/blind/index.ts'
-import { ref } from 'vue'
+import {
+  checkBlindBarcode,
+  getBlindTask,
+  getBoxCacheData, resetBoxCacheData, resetBoxCacheDataBin, setBlindTaskMode,
+  setBoxBarcodeCount,
+  setBoxCacheData, submitBoxCacheData,
+} from '@/api/blind/index.ts'
+import { computed, onMounted, ref } from 'vue'
+import LotAttQuality from '@/views/inbound/blindCollection/components/LotAttQuality.vue'
+import ProductDate from '@/views/inbound/blindCollection/components/ProductDate.vue'
+import { scanError, scanSuccess } from '@/utils/android'
+import BarcodeCount from '@/views/inbound/blindCollection/components/BarcodeCount.vue'
+import { showConfirmDialog, showToast } from 'vant'
+import ResetData from '@/views/inbound/blindCollection/components/ResetData.vue'
+import { reactive } from '@vue/runtime-dom'
 const route = useRoute()
-const barcode=ref('')
+//箱号
+const boxNo = ref('')
+//上一个箱号
+const preBoxNo = ref('')
+//条码
+const barcode = ref('')
+//上一个条码
+const preBarcode=ref('')
+//生产日期
+const manufactureDate = ref('')
+//失效日期
+const expirationDate = ref('')
+//批次号
+const lotNumber = ref('')
+//数量
+const count = ref('')
+const focusType = ref(0)
+const modeMap = {
+  '分货模式': 1,
+  '清点模式': 2,
+  '录入模式': 3,
+  '按箱清点+分货多人': 5,
+}
+const modeType = modeMap[route.query.type]
+const barcodeRef = ref(null)
+const boxNoRef = ref(null)
+const lotNumberRef = ref(null)
+const countRef = ref(null)
+
+//按箱清点+分货数据
+const boxTypeData=ref({})
+const newOneData = computed(() => boxTypeData.value.latticeDataList?.[0] ?? { barCode: '', qty: 0, latticeCode: 0 });
+const allCount = computed(() => {
+  return boxTypeData.value.latticeDataList?.reduce((sum, item) => sum + item.qty, 0) || 0
+});
+const onFocus = (type) => {
+  focusType.value = type
+}
+
 //查询任务信息
-const taskInfo=ref({})
-const taskType=route.query.type
-const getTaskInfo=(taskNo)=>{
-  getBlindTask({taskNo}).then(res => {
-    taskInfo.value=res.data
-  })
+const taskInfo = ref({})
+const taskType = route.query.type
+const getTaskInfo = async (taskNo) => {
+  const taskResponse = await getBlindTask({ taskNo });
+  taskInfo.value = taskResponse.data;
+  const boxResponse = await getBoxCacheData({ code: taskNo });
+  boxTypeData.value = boxResponse.data;
+}
+onMounted(() => {
+  getTaskInfo(route.query.code)
+  if(modeType===5){
+    focusType.value=5
+    boxNoRef.value?.focus()
+  }else {
+    barcodeRef.value?.focus()
+  }
+})
+
+// 验证箱号
+const _scanBox=()=>{
+  preBoxNo.value=boxNo.value
+  boxNo.value=''
+  barcode.value=''
+  barcodeRef.value?.focus()
 }
-getTaskInfo(route.query.code)
+const localData=ref([])
+const _checkBarcode = () => {
+  const { warehouseCode, ownerCode,code } = taskInfo.value;  // 解构出taskInfo中的仓库和业主信息
+  const params = {
+    warehouse: warehouseCode,
+    ownerCode,
+    barcode: barcode.value,
+  };
+  if(barcode.value==='') return
+  checkBlindBarcode(params).then(res => {
+    scanSuccess()
+    preBarcode.value = barcode.value;
+    if (modeType === 3) {
+      lotNumberRef.value.focus();
+      focusType.value = 2;
+    } else if (modeType === 5) {
+      const data = {
+        ownerCode,
+        code,
+        cartonCode: preBoxNo.value,
+        barCode: barcode.value,
+      };
+      _setBoxCacheData(data);  // 添加缓存数据
+    }else if(modeType === 2) {
+      const data = {
+        barCode: barcode.value,
+        cartonCode: null,
+        qty: 1
+      };
+      // 查找是否已存在相同的 barCode
+      const existingItem = localData.value.find(item => item.barCode === barcode.value);
+      if (existingItem) {
+        // 如果存在相同的 barCode,数量增加 1
+        existingItem.qty += 1;
+      } else {
+        // 如果不存在相同的 barCode,新增数据
+        localData.value.push(data);
+      }
+      localData.value.unshift(localData.value.pop());
+      boxTypeData.value.latticeDataList.unshift(...localData.value);
+    }
+    barcode.value = '';  // 清空条码
+  }).catch(() => {
+    scanError()
+  })
+};
 
-const _checkBarcode=()=>{
-  const params={
-    warehouse:taskInfo.value.warehouseCode,
-    ownerCode:taskInfo.value.ownerCode,
-    barcode:barcode.value,
+// 盲收-添加缓存数据-按箱清点+分货多人
+const _setBoxCacheData = (data) => {
+  setBoxCacheData(data).then(res=>{
+    boxTypeData.value = res.data
+    scanSuccess()
+  }).catch(() => {
+    scanError()
+  })
+};
+//设置条码数量
+const barcodeCountRef=ref(null)
+const activeItem=ref({})
+const _setBarcodeCount=(item)=>{
+  activeItem.value=item
+  barcodeCountRef.value?.show(item.barCode)
+}
+const setBarcodeCount=(count)=>{
+  const {sku,cartonCode}=activeItem.value
+  const data={
+    code:route.query.code,
+    sku,
+    cartonCode,
+    qty:count,
   }
-  checkBlindBarcode(params).then(res=>{
-    console.log(res.data)
+  setBoxBarcodeCount(data).then(res=>{
+    boxTypeData.value = res.data
+    scanSuccess()
+  }).catch(() => {
+    scanError()
   })
 }
-// checkBlindBarcode
+// 重新清点数据
+const resetDataRef=ref(null)
+const _resetData=()=>{
+  if(newOneData.value.qty===0){
+    showToast('暂无数据,不支持重新清点!!!')
+  }else {
+    resetDataRef.value?.show()
+  }
 
+}
+const onResetData=(bin,type)=>{
+  const params={code:taskInfo.value.code,latticeCode:bin}
+    let url=resetBoxCacheDataBin
+    if(type==='all'){
+      url=resetBoxCacheData
+    }
+    url(params).then(res=>{
+      scanSuccess()
+      boxTypeData.value = res.data
+      barcodeRef.value?.focus()
+    }).catch(() => {
+      scanError()
+    })
+}
 
+const  resetNewBin=()=>{
+  showConfirmDialog({
+    title: '温馨提示',
+    message:
+      `您正在清除格口:${newOneData.value.latticeCode}数据,是否继续?`,
+  })
+    .then(() => {
+      onResetData(newOneData.value.latticeCode,'bin')
+    })
+}
+//质量状态选择
+const lotAttQualityRef=ref(null)
+const onLotAtt=()=>{
+  lotAttQualityRef.value.show()
+}
+const selectLotAttQuality=(lotAtt08)=>{
+  console.log(lotAtt08)
+}
+//选择生产日期、失效日期
+const productDateRef=ref(null)
+const dateType=ref(1)
+const onProduct=(type)=>{
+  dateType.value=type
+  productDateRef.value.show()
+}
+const onProductDate=(date)=>{
+  if(dateType.value===1){
+    manufactureDate.value=date
+  }else {
+    expirationDate.value=date
+  }
+}
 const onClickLeft = () => {
-  history.back();
-};
-const onClickRight=()=>{
+  history.back()
+}
+const onClickRight = () => {
+  if(newOneData.value.qty===0){
+    showToast('暂无数据,不支持提交任务!!!')
+    return
+  }
+  const {code,ownerCode}=taskInfo.value
+  let type='EntryBlindTaskTypeEnum'
+  const data={code,ownerCode,type}
+  submitBoxCacheData(data).then(res=>{
+    scanSuccess()
+    showToast('数据提交成功,将进入盲收首页')
+    onClickLeft()
+  }).catch(() => {
+    scanError()
+  })
 
 }
 </script>
-<style scoped lang="scss">
+<style scoped lang="sass">
+.blind-task-list
+  padding: 10px 0
+  font-size: 14px
+  .select
+    padding: 10px 15px
+  .box-input
+    padding: 10px 0 0 0
+    ::v-deep(.van-field__control)
+      font-size: 16px
+      font-weight: bold
+      border-bottom: 2px solid #0077ff
+      //z-index: 1
+      padding-bottom: 10px
+  .input
+    padding: 10px 15px 0 15px
+    ::v-deep(.van-field__control)
+      font-size: 16px
+      font-weight: bold
+      border-bottom: 2px solid #0077ff
+      //z-index: 1
+      padding-bottom: 10px
+  .input:last-child
+    padding-bottom: 10px
+  .number,.bin
+    font-size: 30px
+    font-weight: 800
+    color: #ff0000
+  .bin
+    color: #0bc15f
+.blind-task-table
+  width: 100%
+  overflow-y: auto
+  .task-table,.task-table-bin,.task-table-box
+    width: 100%
+    table-layout: fixed
+    border-collapse: collapse
+    font-size: 15px
+  .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
+    z-index: 1
+    color: white
+    font-size: 15px
+  .task-table-bin thead
+    background-color: #3f8dff
+  .task-table-bin tbody
+    background: #cde7ff
+  .task-table-box thead
+    background-color: #ff8d29
+  .task-table-box tbody
+    background: #ffe9d8
+  .task-table tbody tr.odd-row
+    background-color: #e4f2ff
 </style>

+ 3 - 2
src/views/outbound/picking/list/index.vue

@@ -5,10 +5,11 @@
       left-arrow
       fixed
       placeholder
+      @click-left="goBack"
     >
       <template #left>
-        <van-icon name="arrow-left" size="25"   @click="goBack" />
-        <div style="color: #fff" @click="goBack">返回</div>
+        <van-icon name="arrow-left" size="25"  />
+        <div style="color: #fff" >返回</div>
       </template>
       <template #right>
         <div style="color: #fff" @click="onSelectMode({key:'picking'})">开始作业</div>

+ 1 - 1
src/views/outbound/picking/task/index.vue

@@ -8,7 +8,7 @@
       >
       <template #left>
         <van-icon name="arrow-left" size="25"   @click="goBack" />
-        <div style="color: #fff" @click="onClickLeft">返回</div>
+        <div style="color: #fff;height: 46px;padding-right:20px;line-height: 46px" @click="onClickLeft">返回</div>
       </template>
       <template #right>
         <div style="color: #fff" @click="onClickRight">开始作业</div>