编码入库

This commit is contained in:
hongchao 2025-02-07 16:21:15 +08:00
parent 3c7bace495
commit 12c299bed1
2 changed files with 144 additions and 32 deletions

View File

@ -9,7 +9,7 @@
<text class="form-view">{{ queryParams.typeName }}</text> <text class="form-view">{{ queryParams.typeName }}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="待入库数量:"> <uni-forms-item label="待入库数量:">
<text class="form-view">{{ queryParams.bindNum-queryParams.inputNum }}</text> <text class="form-view">{{ codeDeviceList.length }}</text>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
</view> </view>
@ -44,11 +44,11 @@
<view class="table-list-item"> <view class="table-list-item">
<scroll-view class="scroll-view" scroll-y="true" style="height: 500rpx;"> <scroll-view class="scroll-view" scroll-y="true" style="height: 500rpx;">
<uni-forms :model="codeData" label-width="90" :border="true"> <uni-forms :model="codeData" label-width="90" :border="true">
<uni-forms-item label="识别编码:" name="typeName"> <uni-forms-item label="识别编码:" name="maCode">
<uni-easyinput v-model="codeData.maCode" :disabled="true" placeholder="识别编码" /> <uni-easyinput v-model="codeData.maCode" placeholder="识别编码" @input="onInputChange"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="物资类型:" name="typeModelName"> <uni-forms-item label="物资类型:" name="maTypeName">
<text class="form-view">{{ codeData.typeModelName }}</text> <text class="form-view">{{ codeData.maTypeName }}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="规格型号:"> <uni-forms-item label="规格型号:">
<text class="form-view">{{ codeData.typeName }}</text> <text class="form-view">{{ codeData.typeName }}</text>
@ -62,10 +62,10 @@
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
livePusher: null, livePusher: null,
@ -81,14 +81,21 @@
code:"", code:"",
time:"", time:"",
maNum:"1" maNum:"1"
} },
entryData:{},
inPutList:[],
codeDeviceList:[]
} }
}, },
onLoad(options) { onLoad(options) {
this.queryParams = JSON.parse(options.queryParams) this.queryParams = JSON.parse(options.queryParams)
console.log(this.queryParams) console.log(this.queryParams)
this.queryCodeParams.typeId = this.queryParams.typeId; this.queryCodeParams.typeId = this.queryParams.typeId;
this.getCodeDeviceListData()
}, },
//onShow() {
//this.getCodeDeviceListData()
//},
onReady() { onReady() {
this.cameraHeight = uni.getSystemInfoSync().screenHeight * 0.22 this.cameraHeight = uni.getSystemInfoSync().screenHeight * 0.22
console.log(this.cameraHeight) console.log(this.cameraHeight)
@ -132,35 +139,132 @@
} }
}, },
async onHandleEntry(){ async onHandleEntry(){
// let paramsList = [] this.inPutList = []
// paramsList.push({ if(Object.keys(this.entryData).length != 0){
// maCode: this.codeData.maCode,
// maId: this.codeData.maId, this.inPutList.push({maCode:this.entryData.maCode})
// leaseType:0, let obj = {
// outType:2, taskId: this.queryParams.taskId,
// outNum:1, typeId:this.queryParams.typeId,
// typeId:this.codeData.typeId, purchaseId: this.entryData.id,
// manageType: this.codeData.manageType, inPutList: this.inPutList,
// parentId: this.queryParams.parentId, typeName: this.entryData.maTypeName,
// // typeName: this.codeData.typeName, typeModelName: this.entryData.typeName,
// // typeModelName: this.codeData.typeModelName manageType: this.queryParams.manageType
// }) }
// console.log('333333333', paramsList) uni.request({
// const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList }) url: '/material/purchase/storage/warehouse',
// if (res.code === 200) { method: 'post',
// uni.showToast({ data: obj,
// title: '出库成功!', header: {
// icon: 'none', 'Content-Type': 'application/json' // 根据后端要求设置请求头,常见的 POST 请求数据格式为 JSON
// }) },
// this.queryCodeParams.maCode = '' success: res => {
// this.codeData = {} if(res.statusCode ==200){
// } uni.showToast({
title: '入库成功!',
icon: 'none' ,
complete: () => {
setTimeout(() => {
// 在提示框显示结束后执行页面返回操作
uni.navigateBack({
delta: 1,
success: () => {
console.log('成功返回上一个页面');
},
fail: (err) => {
console.error('返回上一个页面失败', err);
}
});
}, 500);
}
})
}else{
uni.showToast({ title: '入库失败!', icon: 'none' })
}
},
fail: err => {
uni.showToast({
title: err,
icon: 'none',
})
}
})
}else{
uni.showToast({ title: '请查找到相应编码后再进行入库', icon: 'none' })
}
},
async onInputChange(event){
const inputValue = event;
this.entryData = {};
let param = { maCode: inputValue,taskId: this.queryParams.taskId,typeId:this.queryParams.typeId};
uni.request({
url: '/material/purchase/storage/getMachineByCode',
method: 'get',
data: param,
success: res => {
res = res.data;
console.log(res)
if(res.code==200 && res.data.length!=0){
console.log("接口返回结果:", res);
this.entryData = res.data[0]
this.codeData.maTypeName = res.data[0].maTypeName
this.codeData.typeName = res.data[0].typeName
}else if(res.code==200 && res.data.length==0){
console.log("接口返回结果:", res);
this.codeData.maTypeName=''
this.codeData.typeName=''
}else{
this.codeData.maTypeName=''
this.codeData.typeName=''
uni.showToast({
title: res.msg,
icon: 'none',
})
}
},
fail: err => {
uni.showToast({
title: err,
icon: 'none',
})
}
})
},
async getCodeDeviceListData(){
let obj = {
typeId: this.queryParams.typeId,
taskId: this.queryParams.taskId,
}
uni.request({
url: '/material/purchase/storage/getMachineById',
method: 'post',
data: obj,
header: {
'Content-Type': 'application/json' // 根据后端要求设置请求头,常见的 POST 请求数据格式为 JSON
},
success: res => {
if(res.statusCode ==200){
console.log('222222',res)
this.codeDeviceList = res.data.data
}else{
uni.showToast({ title: '入库失败!', icon: 'none' })
}
},
fail: err => {
uni.showToast({
title: err,
icon: 'none',
})
}
})
} }
} }
} }
</script> </script>
<style> <style lang="scss" scoped>
.page-container { .page-container {
display: flex; display: flex;
height: auto; height: auto;

View File

@ -64,3 +64,11 @@ export const getTypeByQrcodeApi = (data)=> {
}) })
} }
//根据新购编码查询物料信息
export const getMachineCode = (data)=> {
return http({
url: '/material/purchase/storagegetMachineByCode',
method: 'GET',
data: data,
})
}