|
|
@@ -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">装 箱</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">装 箱</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>
|