标准箱入库出库

This commit is contained in:
zzyuan 2024-12-20 18:38:54 +08:00
parent 0325cc3cef
commit a0873f2acc
8 changed files with 264 additions and 65 deletions

View File

@ -3,11 +3,11 @@
<view class="accept page-common">
<view class="complete-btn">
<view class="btn first-active" @click="changeTab(1)">
<span :class="{ active: active == 1 }">完成</span>
<span :class="{ active: active == 1 }">完成</span>
<div v-if="active == 1" class="bt-line"></div>
</view>
<view class="btn second-active" style="margin-left: 120rpx" @click="changeTab(2)">
<span :class="{ active: active == 2 }">完成</span>
<span :class="{ active: active == 2 }">完成</span>
<div v-if="active == 2" class="bt-line"></div>
</view>
</view>
@ -40,8 +40,8 @@
<div class="title-left">
<span class="code">{{ item.code }}</span>
</div>
<span :class="['status', active == 1 ? 'completed' : 'pending']">
{{active == 1 ? '已完成' : '未完成'}}
<span :class="['status', active == 1 ? 'pending' : 'completed']">
{{active == 1 ? '未完成' : '已完成'}}
</span>
</div>
<div class="line"></div>
@ -85,7 +85,7 @@ import { debounce } from 'lodash-es'
const active = ref(1)
const tableList = ref([])
const total = ref(0) //
const statusList = ref(['3', '13', '4', '14', '19'])
const statusList = ref(['2', '12'])
//
const queryParams = ref({
startTime: '', //
@ -150,9 +150,9 @@ const changeTab = (index) => {
queryParams.value.endTime = ''
if (index == 1) {
statusList.value = ['3', '13', '4', '14', '19']
statusList.value = ['2', '12']
} else if (index == 2) {
statusList.value = ['2', '12']
statusList.value = ['3', '13', '4', '14', '19']
}
//
getTableList(true)

View File

@ -23,9 +23,12 @@
<button class="scan-btn" @click="scanStart">开始扫码</button>
</uni-forms-item>
<uni-forms-item label="识别编码:" name="maCode">
<uni-easyinput v-model="formData.maCode" readonly />
<uni-forms-item label="二维码编码:" name="qrCode">
<uni-easyinput v-model="formData.qrCode" readonly />
</uni-forms-item>
<uni-forms-item label="设备编码:" name="maCode">
<uni-easyinput v-model="formData.maCode" readonly />
</uni-forms-item>
<uni-forms-item label="出场编码:" name="outFacCode">
<uni-easyinput v-model="formData.outFacCode" placeholder="请输入出场编码" />
</uni-forms-item>
@ -71,8 +74,9 @@ const scanStart = () => {
onlyFromCamera: true,
scanType: ['qrCode', 'pdf417'],
success: (res) => {
console.log('扫码结果:' + res.result)
formData.value.maCode = res.result
console.log('扫码结果:' + res.result)
formData.value.qrCode = res.result.split("qrcode=")[1]
// formData.value.maCode = res.result
},
fail: (err) => {
// uni.showToast({

View File

@ -1,21 +1,20 @@
<template>
<!-- 编码出库-->
<view class="page-container">
<!-- <view class="table-list-item">
<view class="table-list-item">
<uni-row :gutter="24">
<uni-col :span="6">出库方式</uni-col>
<uni-col :span="6">
<view class="coding-btn">编码识别</view>
<view class="coding-btn" @click="codeScan">编码识别</view>
</uni-col>
<uni-col :span="6">
<view class="coding-btn">码识别</view>
<view class="coding-btn" @click="codeScan">二维码识别</view>
</uni-col>
<uni-col :span="6">
<view class="coding-btn">二维码识别</view>
<view class="coding-btn" @click="boxScan">标准箱识别</view>
</uni-col>
</uni-row>
</view> -->
</view>
<scroll-view scroll-y @scrolltolower="onScrollTolower" style="padding-bottom: 85rpx">
<view class="table-list-item" v-for="item in codeDeviceList" :key="item.id">
<uni-row :gutter="24">
@ -50,15 +49,20 @@
</uni-col>
</uni-row>
</view>
</scroll-view>
</scroll-view>
<view class="outbound-btn" @tap="onHandleOutbound"> 入库 </view>
</view>
</template>
<script setup>
import { ref, computed } from 'vue'
import { getMachineById, setInboundCodeAPI } from '@/services/purchase.js'
import { getInfoBindByCode,appWarehouseApi } from '@/services/standard.js'
import { onBackPress, onLoad } from '@dcloudio/uni-app'
const codeDeviceList = ref([])
@ -66,12 +70,88 @@ const total = ref(0)
// const query = defineProps() //
// const queryParams = JSON.parse(query.queryParams)
const queryParams = ref({})
const boxCode = ref("")
const boxInfo = ref({})
// const typeId = ref('')
// const taskId = ref('')
// const maTypeName = ref('')
// const typeName = ref('')
const codeScan = async () => {
uni.scanCode({
onlyFromCamera: true,
scanType: ['qrCode', 'pdf417'],
success: (res) => {
console.log('扫码结果:' + res.result)
},
fail: (err) => {},
})
}
//
const boxScan = async () => {
boxCode.value=""
boxCode.value = "BOX-20241212110647"
// uni.scanCode({
// onlyFromCamera: true,
// scanType: ['qrCode', 'pdf417'],
// success: (res) => {
// console.log('' + res.result)
// boxCode.value = res.result
// },
// fail: (err) => {},
// })
console.log(queryParams)
if(boxCode.value==""){
uni.showToast({ title: '扫码识别失败', icon: 'none'})
}else{
let param = {
boxCode: boxCode.value,
maTypeId:queryParams.value.typeId
}
const res = await getInfoBindByCode(param)
console.log(res)
if(res.code==200){
boxInfo.value = res.data
uni.showModal({
title: '提示',
content: `监测到${boxInfo.value.boxCode}标准箱中有${boxInfo.value.bindMaTotal}台设备,符合入库条件设备${boxInfo.value.successMaTotal}台,是否确定入库?`,
confirmText: '确定',
cancelText: '取消',
success: async (res) => {
if (res.confirm) {
if(boxInfo.value.successMaTotal>0){
boxInBound()
}
}
}
})
}else{
uni.showToast({ title: '扫码识别失败', icon: 'none'})
}
}
}
//
const boxInBound = async () => {
const res = await appWarehouseApi({
taskId: queryParams.value.taskId,
maTypeId: queryParams.value.typeId,
boxCode: boxInfo.value.boxCode,
})
if (res.code === 200) {
uni.showToast({
title: '入库成功!',
icon: 'none',
})
getCodeDeviceListData()
}else{
uni.showToast({ title: '入库失败', icon: 'none' })
}
}
//
onLoad((options) => {
queryParams.value = JSON.parse(options.queryParams)
@ -118,16 +198,14 @@ const onChangeChecked = (item) => {
//
const onHandleOutbound = async () => {
const isSelect = codeDeviceList.value.some((e) => e.checked === true)
const isSelect = codeDeviceList.value.some((e) => e.checked === true)
if (!isSelect) {
uni.showToast({
title: '请勾选需要入库的设备',
icon: 'none',
})
return
}
}
//
const paramsList = []
codeDeviceList.value.map((e) => {
@ -175,7 +253,7 @@ const onHandleOutbound = async () => {
.table-list-item {
margin: 24rpx 0;
padding: 32rpx;
padding: 30rpx;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
@ -230,6 +308,15 @@ const onHandleOutbound = async () => {
rgba(232, 232, 232, 0) 100%
);
}
.coding-btn {
padding: 5rpx 0;
background-color: #409eff;
border-radius: 6rpx;
text-align: center;
color: #fff;
font-size: 12px;
}
}
//

View File

@ -3,11 +3,11 @@
<view class="page-container">
<view class="complete-btn">
<view class="btn" @click="changeTab(1)">
<span>完成</span>
<span>完成</span>
<div v-if="active == 1" class="bt-line"></div>
</view>
<view class="btn" style="margin-left: 120rpx" @click="changeTab(2)">
<span>完成</span>
<span>完成</span>
<div v-if="active == 2" class="bt-line"></div>
</view>
</view>
@ -97,7 +97,7 @@ const queryParams = ref({
endTime: '', //
keyWord: '', //
// statusList: [19], //
taskStatus: 22,
taskStatus: 21,
pageNum: 1,
pageSize: 5,
})
@ -197,6 +197,7 @@ const getTableList = async (isTap = false) => {
//
const onScrollTolower = debounce(() => {
console.log("下一页")
//
if (tableList.value.length < total.value) {
queryParams.value.pageNum++
@ -215,9 +216,9 @@ const changeTab = (index) => {
dateArray.value = [] //
if (index == 1) {
queryParams.value.taskStatus = 22 //
queryParams.value.taskStatus = 21 //
} else if (index == 2) {
queryParams.value.taskStatus = 21 //
queryParams.value.taskStatus = 22 //
}
//
@ -242,6 +243,7 @@ const finish = computed(() => {
console.log('total.value',total.value)
console.log('tableList.value.length',tableList.value.length)
if (total.value === tableList.value.length) return true
else return false
})
</script>

View File

@ -105,7 +105,7 @@ const maxNum = computed(() => {
//
const scanStart = () => {
console.log('编码识别--')
/* // 只允许通过相机扫
//
uni.scanCode({
onlyFromCamera: true,
scanType: ['qrCode', 'pdf417'],
@ -119,34 +119,33 @@ const scanStart = () => {
// icon: 'none'
// });
},
}) */
})
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
// var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
// mpaasScanModule.mpaasScan({
mpaasScanModule.mpaasScan({
// qrCodebarCode
'scanType': ['qrCode','barCode'],
// false
'hideAlbum': false,
//ios zh-Hansen
'language' : 'en',
//(ios)
'failedMsg': '未识别到二维码,请重试',
//Android
'screenType': 'full'
},
(ret) => {
uni.showModal({
title: "弹窗标题",
// resp_code 10111000
// resp_message
// resp_result
content: JSON.stringify(ret),
showCancel: false,
confirmText: "确定"
})
})
// // qrCodebarCode
// 'scanType': ['qrCode','barCode'],
// // false
// 'hideAlbum': false,
// //ios zh-Hansen
// 'language' : 'en',
// //(ios)
// 'failedMsg': '',
// //Android
// 'screenType': 'full'
// },
// (ret) => {
// uni.showModal({
// title: "",
// // resp_code 10111000
// // resp_message
// // resp_result
// content: JSON.stringify(ret),
// showCancel: false,
// confirmText: ""
// })
// })
}

View File

@ -28,10 +28,10 @@
<view class="coding-btn" @tap="onCodeIdentify">编码识别</view>
</uni-col>
<uni-col :span="6">
<view class="coding-btn" @tap="onCodeIdentify">码识别</view>
<view class="coding-btn" @tap="onCodeIdentify">二维码识别</view>
</uni-col>
<uni-col :span="6">
<view class="coding-btn" @tap="onCodeIdentify">二维码识别</view>
<view class="coding-btn" @tap="boxScan">标准箱识别</view>
</uni-col>
</uni-row>
</view>
@ -116,6 +116,7 @@
import { ref, computed, onUnmounted } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { getCodeDeviceListAPI, setOutboundNumAPI } from '@/services/picking/outbound.js'
import { getBoxBindByCode } from '@/services/standard.js'
import { onBackPress } from '@dcloudio/uni-app'
import { debounce } from 'lodash-es'
// const query = defineProps() //
@ -125,7 +126,8 @@ const formData = ref({})
const codeDeviceList = ref([])
const total = ref(0)
const codeNum = ref(0)
const boxCode = ref("")
const boxInfo = ref({})
//
const queryCodeParams = ref({
pageNum: 1,
@ -135,6 +137,88 @@ const queryCodeParams = ref({
maCode: '',
})
//
const boxScan = async () => {
boxCode.value=""
boxCode.value = "BOX-20241212110647"
// uni.scanCode({
// onlyFromCamera: true,
// scanType: ['qrCode', 'pdf417'],
// success: (res) => {
// console.log('' + res.result)
// boxCode.value = res.result
// },
// fail: (err) => {},
// })
console.log(queryParams)
if(boxCode.value==""){
uni.showToast({ title: '扫码识别失败', icon: 'none'})
}else{
let param = {
boxCode: boxCode.value,
maTypeId:queryParams.value.typeId
}
console.log(param)
const res = await getBoxBindByCode(param)
console.log(res)
if(res.code==200){
boxInfo.value = res.data
uni.showModal({
title: '提示',
content: boxInfo.value.msg,
confirmText: '确定',
cancelText: '取消',
success: async (res) => {
if (res.confirm) {
if(boxInfo.value.recordList.length>0){
boxOutBound()
}
}
}
})
}else{
uni.showToast({ title: '扫码识别失败', icon: 'none'})
}
}
}
//
const boxOutBound = async () => {
//
const { typeId, parentId } = queryParams.value
//
const paramsList = []
boxInfo.value.recordList.map((e) => {
paramsList.push({
leaseType: 0,
boxId: e.boxId,
maId: e.maId,
manageType: 3,
outNum: 1,
parentId,
typeId,
})
})
console.log(paramsList)
const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
if (res.code === 200) {
uni.showToast({
title: '出库成功!',
icon: 'none',
})
setTimeout(() => {
//
uni.navigateBack({
delta: 1,
success() {
uni.$emit('onUpdate')
},
})
}, 500)
}
}
//
const maxNum = computed(() => {
// 1.

View File

@ -225,7 +225,7 @@ const options = ref([
text: '出库',
style: {
backgroundColor: '#3784fb',
color: '#fff',
// color: '#fff',
fontSize: '28rpx',
},
},
@ -236,7 +236,7 @@ const options2 = ref([
text: '查看',
style: {
backgroundColor: '#3784fb',
color: '#fff',
// color: '#fff',
fontSize: '28rpx',
},
},

View File

@ -57,6 +57,7 @@ export const appUnbindMaCodeApi = (data)=> {
data:data,
})
}
// 标准箱移交
export const appTransferApi = (data)=> {
return http({
@ -82,10 +83,32 @@ export const appTransferRejectApi = (data)=> {
})
}
// 新购入库扫码BoxCode-查询标准箱信息
export const getInfoBindByCode = (data) => {
return http({
method: 'GET',
url: '/material/bm_qrcode_box/get_info_bind_by_code',
data:data,
})
}
// 新购入库扫码扫码BoxCode--确认入库
export const appWarehouseApi = (data) => {
return http({
method: 'POST',
url: '/material/bm_qrcode_box/app_warehouse',
data:data,
})
}
// 领料出库扫码BoxCode-查询标准箱信息
export const getBoxBindByCode = (data) => {
return http({
method: 'GET',
url: '/material/bm_qrcode_box/get_box_bind_by_code',
data:data,
})
}