编码入库
This commit is contained in:
		
							parent
							
								
									3c7bace495
								
							
						
					
					
						commit
						12c299bed1
					
				| 
						 | 
				
			
			@ -9,7 +9,7 @@
 | 
			
		|||
		            <text class="form-view">{{ queryParams.typeName }}</text>
 | 
			
		||||
		         </uni-forms-item>
 | 
			
		||||
		         <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> 
 | 
			
		||||
		</view>
 | 
			
		||||
| 
						 | 
				
			
			@ -44,11 +44,11 @@
 | 
			
		|||
		<view class="table-list-item">
 | 
			
		||||
		     <scroll-view class="scroll-view" scroll-y="true" style="height: 500rpx;"> 
 | 
			
		||||
				<uni-forms :model="codeData" label-width="90" :border="true">
 | 
			
		||||
					 <uni-forms-item label="识别编码:" name="typeName">
 | 
			
		||||
						<uni-easyinput v-model="codeData.maCode" :disabled="true" placeholder="识别编码" />
 | 
			
		||||
					 <uni-forms-item label="识别编码:" name="maCode">
 | 
			
		||||
						<uni-easyinput v-model="codeData.maCode"  placeholder="识别编码" @input="onInputChange"/>
 | 
			
		||||
					 </uni-forms-item>
 | 
			
		||||
					<uni-forms-item label="物资类型:" name="typeModelName">
 | 
			
		||||
						<text class="form-view">{{ codeData.typeModelName }}</text>
 | 
			
		||||
					<uni-forms-item label="物资类型:" name="maTypeName">
 | 
			
		||||
						<text class="form-view">{{ codeData.maTypeName }}</text>
 | 
			
		||||
					 </uni-forms-item>
 | 
			
		||||
					 <uni-forms-item label="规格型号:">
 | 
			
		||||
						<text class="form-view">{{ codeData.typeName }}</text>
 | 
			
		||||
| 
						 | 
				
			
			@ -62,10 +62,10 @@
 | 
			
		|||
	</view>
 | 
			
		||||
	
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
 | 
			
		||||
	export default {
 | 
			
		||||
		
 | 
			
		||||
		data() {
 | 
			
		||||
			return {
 | 
			
		||||
				livePusher: null,
 | 
			
		||||
| 
						 | 
				
			
			@ -81,14 +81,21 @@
 | 
			
		|||
					code:"",
 | 
			
		||||
					time:"",
 | 
			
		||||
					maNum:"1"
 | 
			
		||||
				}
 | 
			
		||||
				},
 | 
			
		||||
				entryData:{},
 | 
			
		||||
				inPutList:[],
 | 
			
		||||
				codeDeviceList:[]
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		onLoad(options) {
 | 
			
		||||
			this.queryParams = JSON.parse(options.queryParams)
 | 
			
		||||
			console.log(this.queryParams)
 | 
			
		||||
			this.queryCodeParams.typeId = this.queryParams.typeId;
 | 
			
		||||
			this.getCodeDeviceListData()
 | 
			
		||||
		},
 | 
			
		||||
		//onShow() {
 | 
			
		||||
			//this.getCodeDeviceListData()
 | 
			
		||||
		//},
 | 
			
		||||
		onReady() { 
 | 
			
		||||
			this.cameraHeight = uni.getSystemInfoSync().screenHeight * 0.22
 | 
			
		||||
			console.log(this.cameraHeight) 
 | 
			
		||||
| 
						 | 
				
			
			@ -132,35 +139,132 @@
 | 
			
		|||
				}
 | 
			
		||||
			},
 | 
			
		||||
			async onHandleEntry(){
 | 
			
		||||
				// let paramsList = []
 | 
			
		||||
				//     paramsList.push({
 | 
			
		||||
				//         maCode: this.codeData.maCode,
 | 
			
		||||
				//         maId: this.codeData.maId,
 | 
			
		||||
				//         leaseType:0,
 | 
			
		||||
				//         outType:2,
 | 
			
		||||
				//         outNum:1,
 | 
			
		||||
				//         typeId:this.codeData.typeId,
 | 
			
		||||
				//         manageType: this.codeData.manageType,
 | 
			
		||||
				//         parentId: this.queryParams.parentId,
 | 
			
		||||
				//         // typeName: this.codeData.typeName,
 | 
			
		||||
				//         // typeModelName: this.codeData.typeModelName
 | 
			
		||||
				//     }) 
 | 
			
		||||
				// console.log('333333333', paramsList)
 | 
			
		||||
				// const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
 | 
			
		||||
				// if (res.code === 200) {
 | 
			
		||||
				//     uni.showToast({
 | 
			
		||||
				//         title: '出库成功!',
 | 
			
		||||
				//         icon: 'none',
 | 
			
		||||
				//     }) 
 | 
			
		||||
				//     this.queryCodeParams.maCode = ''
 | 
			
		||||
				//     this.codeData = {} 
 | 
			
		||||
				// }
 | 
			
		||||
				this.inPutList = []
 | 
			
		||||
				if(Object.keys(this.entryData).length != 0){
 | 
			
		||||
				
 | 
			
		||||
				 this.inPutList.push({maCode:this.entryData.maCode})
 | 
			
		||||
				   let obj = {
 | 
			
		||||
						taskId: this.queryParams.taskId,
 | 
			
		||||
						typeId:this.queryParams.typeId,
 | 
			
		||||
						purchaseId: this.entryData.id,
 | 
			
		||||
						inPutList: this.inPutList,
 | 
			
		||||
						typeName: this.entryData.maTypeName,
 | 
			
		||||
						typeModelName: this.entryData.typeName,
 | 
			
		||||
						manageType: this.queryParams.manageType
 | 
			
		||||
				    }
 | 
			
		||||
				uni.request({
 | 
			
		||||
					url: '/material/purchase/storage/warehouse',
 | 
			
		||||
					method: 'post',
 | 
			
		||||
					data: obj,
 | 
			
		||||
					header: {
 | 
			
		||||
					'Content-Type': 'application/json' // 根据后端要求设置请求头,常见的 POST 请求数据格式为 JSON
 | 
			
		||||
					},
 | 
			
		||||
					success: res => {
 | 
			
		||||
					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>
 | 
			
		||||
 | 
			
		||||
<style>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
	.page-container {
 | 
			
		||||
	    display: flex;
 | 
			
		||||
	    height: auto;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,3 +64,11 @@ export const getTypeByQrcodeApi = (data)=> {
 | 
			
		|||
    })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//根据新购编码查询物料信息
 | 
			
		||||
export const getMachineCode = (data)=> {
 | 
			
		||||
  return http({
 | 
			
		||||
  url: '/material/purchase/storagegetMachineByCode',
 | 
			
		||||
  method: 'GET',
 | 
			
		||||
  data: data,
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue