标准箱入库出库
This commit is contained in:
parent
0325cc3cef
commit
a0873f2acc
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
// 底部入库按钮
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
||||
// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
'scanType': ['qrCode','barCode'],
|
||||
// 是否隐藏相册,默认false不隐藏
|
||||
'hideAlbum': false,
|
||||
//ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
'language' : 'en',
|
||||
//相册选择照片识别错误提示(ios)
|
||||
'failedMsg': '未识别到二维码,请重试',
|
||||
//Android支持全屏需要设置此参数
|
||||
'screenType': 'full'
|
||||
},
|
||||
(ret) => {
|
||||
uni.showModal({
|
||||
title: "弹窗标题",
|
||||
// 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
|
||||
// 返回值中,resp_message 表示返回结果信息
|
||||
// 返回值中,resp_result 表示扫码结果,只有成功才会有返回
|
||||
content: JSON.stringify(ret),
|
||||
showCancel: false,
|
||||
confirmText: "确定"
|
||||
})
|
||||
})
|
||||
// // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
// 'scanType': ['qrCode','barCode'],
|
||||
// // 是否隐藏相册,默认false不隐藏
|
||||
// 'hideAlbum': false,
|
||||
// //ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
// 'language' : 'en',
|
||||
// //相册选择照片识别错误提示(ios)
|
||||
// 'failedMsg': '未识别到二维码,请重试',
|
||||
// //Android支持全屏需要设置此参数
|
||||
// 'screenType': 'full'
|
||||
// },
|
||||
// (ret) => {
|
||||
// uni.showModal({
|
||||
// title: "弹窗标题",
|
||||
// // 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
|
||||
// // 返回值中,resp_message 表示返回结果信息
|
||||
// // 返回值中,resp_result 表示扫码结果,只有成功才会有返回
|
||||
// content: JSON.stringify(ret),
|
||||
// showCancel: false,
|
||||
// confirmText: "确定"
|
||||
// })
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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. 先通过预领数量和已领数量计算剩余待出库数量
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue