瀏覽代碼

二维码内容规则调整后的修改

zhuangdezheng 1 年之前
父節點
當前提交
699b7e55b5

+ 8 - 0
api/business/dayWorkItem.js

@@ -61,6 +61,14 @@ export function getDayworkItemByCarrierId(data) {
 	})
 }
 
+export function getDayworkItemByCarrierCode(data) {
+	return req.request({
+		url: '/business/dayworkItem/getDayworkItemByCarrierCode',
+		method: 'GET',
+		data: data
+	})
+}
+
 export function saveproTem(data) {
 	return req.request({
 		url: '/business/dayworkItem/proTem',

+ 8 - 0
api/business/quickDaywork.js

@@ -24,6 +24,14 @@ export function getDayworkByCarrierId(data) {
 	})
 }
 
+export function getDayworkByCarrierCode(data) {
+	return req.request({
+		url:'/business/quickDaywork/getDayworkByCarrierCode',
+		method: 'POST',
+		data: data
+	})
+}
+
 export function reportDaywork(data) {
 	return req.request({
 		url:'/business/quickDaywork/reportDaywork',

+ 43 - 1
components/dialog-end-work/dialog-end-work.vue

@@ -234,7 +234,7 @@
 		// }
 	}
 
-
+/*
 	function handleScanCode() {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
@@ -275,6 +275,48 @@
 		);
 		}
 	}
+*/
+
+	function handleScanCode() {
+		// 引入原生插件
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		if (mpaasScanModule) {
+		//调用插件的 mpaasScan 方法
+		mpaasScanModule.mpaasScan({
+				// 扫码识别类型,参数可多选,qrCode、barCode,
+				// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+				scanType: ["qrCode", "barCode"],
+				// 是否隐藏相册,默认false不隐藏
+				hideAlbum: false,
+			},
+			(ret) => {
+				let vehicleObj = {carrierCode: ret.resp_result};
+				let hasInFlag = false
+				for (let i = 0; i < bindList.value.length; i++) {
+					if (vehicleObj.carrierCode == bindList.value[i].carrierCode) {
+						hasInFlag = true
+						if (!bindList.value[i].flag) {
+							endFlag.value += 1;
+						}
+						bindList.value[i].flag = true;
+					}
+				}
+				if(!hasInFlag) {
+					uni.showToast({
+						icon: 'none',
+						title: '该批次没有绑定此箱',
+						duration: 2000
+					})
+				}
+				if (endFlag.value < bindList.value.length && hasInFlag) {
+						 setTimeout(() => {
+						    handleScanCode();
+						  }, 700);
+				}
+			}
+		);
+		}
+	}
 
 	function handlePreFinishReporting() {
 		//投产数

+ 2 - 0
pages/addNewBatch/index.vue

@@ -532,6 +532,7 @@
 		dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
 	}
 
+/*
 	// function handleScanCode() {
 	// 	uni.scanCode({
 	// 		scanType: ['qrCode'],
@@ -571,6 +572,7 @@
 	// 		}
 	// 	});
 	// }
+*/
 
 	function handleAdd() {
 		if (selectedProcess.value == null) {

+ 14 - 1
pages/batchReporting/index.vue

@@ -392,6 +392,7 @@
 				},
 				(ret) => {
 					console.log(ret);
+					/* 原有代码,之前二维码中存的信息比较多,用一个JSON格式存储。
 					let vehicleObj = JSON.parse(ret.resp_result);
 					if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
 						uni.showToast({
@@ -401,8 +402,19 @@
 						})
 						return;
 					}
+					*/
+					let vehicleObj = { carrierCode: ret.resp_result};
+					if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+						uni.showToast({
+							icon: "none",
+							title: "请扫载具码",
+							duration: 1000
+						})
+						return;
+					}
 					showDaywork({
-						carrierId: vehicleObj.carrierId,
+						carrierId: '0', // 不传递箱子id
+						carrierCode: vehicleObj.carrierCode,
 						status: 7
 					}).then(response => {
 						if (response.code == 200) {
@@ -442,6 +454,7 @@
 			// 测试时用
 			showDaywork({
 				carrierId: '1780467398971187210',
+				carrierCode: '',
 				status: 7
 			}).then(response => {
 				if (response.code == 200) {

+ 57 - 1
pages/changeBox/index.vue

@@ -197,7 +197,7 @@
 		newBindList.value.push(item)
 		item.inpShow = false;
 	}
-
+/*
 	function handleScanCode() {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
@@ -270,6 +270,62 @@
 			}
 		);
 	}
+*/
+	function handleScanCode() {
+		// 引入原生插件
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+
+		// 调用插件的 mpaasScan 方法
+		mpaasScanModule.mpaasScan({
+				// 扫码识别类型,参数可多选,qrCode、barCode,
+				// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+				scanType: ["qrCode", "barCode"],
+				// 是否隐藏相册,默认false不隐藏
+				hideAlbum: false,
+			},
+			(ret) => {
+				let vehicleObj = { carrierCode: ret.resp_result };
+				if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+					uni.showToast({
+						icon: "none",
+						title: "请扫载具码"
+					})
+					return;
+				}
+				for (let i = 0; i < newBindList.value.length; i++) {
+					if (newBindList.value[i].carrierCode === vehicleObj.carrierCode) {
+						uni.showToast({
+							icon: "none",
+							title: "载具已存在"
+						})
+						return;
+					}
+				}
+				const checkData = {
+					...dayWorkInfo,
+					dayworkCarriers: newBindList.value,
+					newCarrierCode: vehicleObj.carrierCode
+				}
+				console.log("dayWorkInfo", dayWorkInfo);
+				checkCarrierNew(checkData).then(response => {
+					if (response.code == 200) {
+						newBindList.value.push(JSON.parse(ret.resp_result));
+					} else {
+						uni.showToast({
+							icon: 'none',
+							title: response.msg
+						})
+						return;
+					}
+				}).catch(err => {
+					uni.showToast({
+						icon: 'none',
+						title: '箱码检测检测错误' + err.message
+					})
+				})
+			}
+		);
+	}
 
 	function handleSubmit() {
 		let carrierRejectList = []

+ 89 - 1
pages/fastProductionPlan/index.vue

@@ -88,6 +88,7 @@
 		getQuickDayworkList,
 		finishQuick,
 		getDayworkByCarrierId,
+		getDayworkByCarrierCode,
 		reportDaywork
 	} from '@/api/business/quickDaywork'
 	import {
@@ -161,7 +162,7 @@
 		keyword.value = input
 		handleChangeWorkshop(workshopId.value)
 	}
-
+/*  【原有代码】
 	function handleAdd() {
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
 		if (mpaasScanModule) {
@@ -257,6 +258,93 @@
 		}
 		// lotReporting.value.open(data);
 	}
+*/
+
+	function handleAdd() {
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		if (mpaasScanModule) {
+			// 调用插件的 mpaasScan 方法
+			mpaasScanModule.mpaasScan({
+					// 扫码识别类型,参数可多选,qrCode、barCode,
+					// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+					scanType: ["qrCode", "barCode"],
+					// 是否隐藏相册,默认false不隐藏
+					hideAlbum: false,
+				},
+				(ret) => {
+					let vehicleObj = {carrierCode: ret.resp_result};
+					if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+						uni.showToast({
+							icon: "none",
+							title: "请扫载具码",
+							duration: 1000
+						})
+						return;
+					}
+					getDayworkByCarrierCode({
+						carrierCode: vehicleObj.carrierCode,
+						deptId: store.curDeptDetails.deptId,
+						status: 7
+					}).then(response => {
+						if (response.code == 200) {
+							if (response.data.items.length > 0) {
+								lotReporting.value.open(response.data);
+							} else {
+								uni.showToast({
+									icon: 'none',
+									title: '该批次不在此计划单内, 或不在当前工段',
+									duration: 2000
+								})
+							}
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: response.msg,
+								duration: 2000
+							})
+						}
+					})
+				}
+			);
+		} else {
+			// 测试时用
+			getDayworkByCarrierId({
+				carrierId: '1747500987688890381',
+				status: 7,
+				deptId: store.curDeptDetails.deptId,
+			}).then(response => {
+				console.log(response)
+				if (response.code == 200) {
+					// 
+					// if (response.data.items[0].deptId !== store.curDeptDetails.deptId) {
+					// 	uni.showToast({
+					// 		icon: 'none',
+					// 		title: '该批次不在当前工段',
+					// 		duration: 2000
+					// 	})
+					// 	return
+					// }
+					if (response.data.items.length > 0) {
+						// console.log(response.data)
+						lotReporting.value.open(response.data);
+					} else {
+						uni.showToast({
+							icon: 'none',
+							title: '该批次不在此计划单内, 或不在当前工段',
+							duration: 2000
+						})
+					}
+				} else {
+					uni.showToast({
+						icon: 'none',
+						title: response.msg,
+						duration: 2000
+					})
+				}
+			})
+		}
+		// lotReporting.value.open(data);
+	}
 
 	function handleContinue() {
 		// lotReporting.value.open('test')

+ 62 - 2
pages/outsourcedInspection/scan.vue

@@ -63,6 +63,7 @@
 	onLoad(() => {})
 
 	// 扫码
+	/* 【原有代码】
 	const handleScanCode = () => {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
@@ -89,7 +90,7 @@
 					//判断该箱是否绑定批次
 
 				result.processCode = store.outsourcedCode;
-				/************************ 根据扫码查询到的数据和需要检查的工序查询信息 ************************/
+				
 				getLotOutsourcedInfo(result).then(resqust => {
 					if (resqust.code == 200) {
 						lot.value = resqust.data;
@@ -117,7 +118,66 @@
 			}
 			)
 		}
-}
+	}
+	*/
+	
+	const handleScanCode = () => {
+		// 引入原生插件
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		if (mpaasScanModule) {
+			// 调用插件的 mpaasScan 方法
+			mpaasScanModule.mpaasScan({
+					// 扫码识别类型,参数可多选,qrCode、barCode,
+					// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+					scanType: ["qrCode", "barCode"],
+					// 是否隐藏相册,默认false不隐藏
+					hideAlbum: false,
+				},
+				(ret) => {
+					console.log(ret)
+					const result = {
+						carrierCode: ret.resp_result,
+						processCode: ''
+					}
+					if (!result.carrierCode || result.carrierCode == "") {
+						uni.showToast({
+							icon: "none",
+							title: "请扫载具码",
+							duration: 1000
+						})
+						return
+					}
+					//判断该箱是否绑定批次
+	
+					result.processCode = store.outsourcedCode;
+					/************************ 根据扫码查询到的数据和需要检查的工序查询信息 ************************/
+					getLotOutsourcedInfo(result).then(resqust => {
+						if (resqust.code == 200) {
+							lot.value = resqust.data;
+							lot.value.carrierCode = result.carrierCode
+							carrierCode.value = result.carrierCode;
+							// store.processInspection = null;
+							console.log("resqust", resqust);
+							uni.hideLoading();
+						} else {
+							// uni.hideLoading();
+							uni.showToast({
+								icon: 'none',
+								title: resqust.msg,
+								duration: 2000
+							})
+						}
+					}).catch(err => {
+						uni.showToast({
+							icon: 'none',
+							title: err.message,
+							duration: 2000
+						})
+					})
+				}
+			)
+		}
+	}
 
 	//选择批号弹窗带回
 	function handleSelectProcessInspection(data) {

+ 105 - 2
pages/outsourcedReturnCheck/carriers.vue

@@ -111,7 +111,7 @@
 			console.log(res)
 		})
 	}
-
+/*
 	function checkItem(item) {
 		// console.log(item)
 		if (checkedCarriers.value.findIndex(v => item.id === v) >= 0) {
@@ -121,7 +121,15 @@
 		}
 		// return true;
 	}
-
+*/
+	function checkItem(item) {
+		if (checkedCarriers.value.findIndex(v => item.code === v) >= 0) {
+			return true
+		} else {
+			return false;
+		}
+	}
+/* 【原有的handleScanCode代码】
 	function handleScanCode() {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
@@ -226,6 +234,101 @@
 			}
 		}
 	}
+*/
+function handleScanCode() {
+		// 引入原生插件
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		// const mpaasScanModule = false
+		if (mpaasScanModule) {
+			// 调用插件的 mpaasScan 方法
+			mpaasScanModule.mpaasScan({
+					// 扫码识别类型,参数可多选,qrCode、barCode,
+					// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+					scanType: ["qrCode", "barCode"],
+					// 是否隐藏相册,默认false不隐藏
+					hideAlbum: false,
+				},
+				(ret) => {
+					let vehicleObj = {carrierCode: ret.resp_result};
+					if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+						message.value = '请扫载具码'
+						inputDialog.value.open()
+						return;
+					}
+					let checked = false
+					let allChecked = true
+					details.value.forEach(l => {
+						checked = checked || (l.carriers.findIndex(e => e.id === vehicleObj.carrierCode) >= 0)
+						if (checked) {
+							checkedCarriers.value.push(vehicleObj.carrierCode)
+						}
+						allChecked = allChecked && l.carriers.every(t => checkedCarriers.value.includes(t.code))
+					})
+					if (checked) {
+						uni.showToast({
+							icon: 'none',
+							title: '已扫箱' + vehicleObj.carrierCode
+						})
+						if (allChecked) {
+							debonce(() => {
+								uni.showToast({
+									icon: 'none',
+									title: '已验证所有箱码'
+								})
+							}, 700)
+						} else {
+							debounce(handleScanCode, 700)
+						}
+					} else {
+						message.value = '该箱号' + vehicleObj.carrierCode + '不在此发出单'
+						inputDialog.value.open()
+						return
+					}
+				}
+			);
+		} else {
+			let vehicleObj = {
+				carrierId: "0",
+				carrierCode: "1"
+			};
+
+			if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+				message.value = '请扫载具码'
+				inputDialog.value.open()
+				return;
+			}
+			let checked = false
+			let allChecked = true
+			details.value.forEach(l => {
+				checked = checked || (l.carriers.findIndex(e => e.id === vehicleObj.carrierCode) >= 0)
+				// allChecked = allChecked && (l.carriers.findIndex(e => e.id === vehicleObj.carrierId) >= 0)
+				if (checked) {
+					checkedCarriers.value.push(vehicleObj.carrierCode)
+				}
+				allChecked = allChecked && l.carriers.every(t => checkedCarriers.value.includes(t.code))
+			})
+			if (checked) {
+				uni.showToast({
+					icon: 'none',
+					title: '已扫箱' + vehicleObj.carrierCode
+				})
+				if (allChecked) {
+					debonce(() => {
+						uni.showToast({
+							icon: 'none',
+							title: '已验证所有箱码'
+						})
+					}, 700)
+				} else {
+					debounce(handleScanCode, 700)
+				}
+			} else {
+				message.value = '该箱号' + vehicleObj.carrierCode + '不在此发出单'
+				inputDialog.value.open()
+				return
+			}
+		}
+	}
 </script>
 
 <style lang="scss">

+ 82 - 1
pages/processInspection/scan.vue

@@ -62,6 +62,7 @@
 	onLoad(() => {})
 
 	// 扫码
+	/*
 	const handleScanCode = () => {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
@@ -86,7 +87,6 @@
 						return;
 					}
 
-					/************************ 查询是否一批多箱 ************************/
 					getCarrierInfo(result).then(resqust => {
 						if (resqust.code == 200) {
 							//返回数据大于一条,跳转选择批次弹窗
@@ -195,6 +195,87 @@
 		// 	})
 		// }
 	}
+	*/
+	const handleScanCode = () => {
+		// 引入原生插件
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		if (mpaasScanModule) {
+			// 调用插件的 mpaasScan 方法
+			mpaasScanModule.mpaasScan({
+					// 扫码识别类型,参数可多选,qrCode、barCode,
+					// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+					scanType: ["qrCode", "barCode"],
+					// 是否隐藏相册,默认false不隐藏
+					hideAlbum: false,
+				},
+				(ret) => {
+					console.log(ret);
+					const result = {carrierCode: ret.resp_result};
+					if (!result.carrierCode || result.carrierCode == "") {
+						uni.showToast({
+							icon: "none",
+							title: "请扫载具码",
+							duration: 1000
+						})
+						return;
+					}
+
+					getCarrierInfo(result).then(resqust => {
+						if (resqust.code == 200) {
+							//返回数据大于一条,跳转选择批次弹窗
+							if (resqust.data.length > 1) {
+								query.value = result;
+								console.log("查询箱号信息", resqust)
+								selectProcessInspection.value.open(resqust.data)
+							} else {
+								uni.showLoading({
+									title: '加载中'
+								});
+								// 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
+								// 需要定义一个请求方法, 从后端获取
+								getLotInfo(result).then(res => {
+									if (res.code == 200) {
+										lot.value = res.data;
+										lot.value.carrierCode = result.carrierCode
+										carrierCode.value = result.carrierCode;
+										console.log("res", res);
+										uni.hideLoading();
+									} else {
+										uni.showToast({
+											icon: 'none',
+											title: res.msg,
+											duration: 2000
+										})
+									}
+								}).catch(err => {
+									uni.showToast({
+										icon: 'none',
+										title: err.message,
+										duration: 2000
+									})
+								})
+
+							}
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: resqust.msg,
+								duration: 2000
+							})
+						}
+					}).catch(err => {
+						uni.showToast({
+							icon: 'none',
+							title: err.message,
+							duration: 2000
+						})
+					})
+
+				}
+			);
+		}
+	}
+
 
 	//选择批号弹窗带回
 	function handleSelectProcessInspection(data) {

+ 61 - 2
pages/recerptSfprod/index.vue

@@ -43,6 +43,7 @@
 	} from '@dcloudio/uni-app'
 	import {
 		getDayworkItemByCarrierId,
+		getDayworkItemByCarrierCode,
 		updateDayWorkItemBatch
 	} from '@/api/business/dayWorkItem.js'
 	import {
@@ -59,7 +60,7 @@
 	onLoad(() => {})
 
 	function init() {}
-
+/*
 	function handleScanCode() {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
@@ -117,7 +118,65 @@
 			}
 		);
 	}
-
+*/
+	
+	function handleScanCode() {
+		// 引入原生插件
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		// 调用插件的 mpaasScan 方法
+		mpaasScanModule.mpaasScan({
+				// 扫码识别类型,参数可多选,qrCode、barCode,
+				// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+				scanType: ["qrCode", "barCode"],
+				// 是否隐藏相册,默认false不隐藏
+				hideAlbum: false,
+			},
+			(ret) => {
+				let vehicleObj = {carrierCode: ret.resp_result};
+				if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+					uni.showToast({
+						icon: "none",
+						title: "请扫载具码",
+					})
+					return;
+				}
+				getDayworkItemByCarrierCode({
+					carrierCode: vehicleObj.carrierCode,
+					status: 6
+				}).then(response => {
+					console.log(response)
+					if (response.data.length == 0) {
+						uni.showToast({
+							icon: 'none',
+							title: '该批次已被领取'
+						})
+						return;
+					}
+				 
+					for (let i = 0; i < response.data.length; i++) {
+						if(products.value.some(item => item.id == response.data[i].id)){
+							uni.showToast({
+								icon: 'none',
+								title: '该设批次已存在,请勿重复扫码添加'
+							})
+							return; 
+						}
+						products.value.push(response.data[i]);
+						console.log(products.value)
+					}
+					console.log(products.value)
+					let sum = 0; //总箱数
+					for (let i = 0; i < products.value.length; i++) {
+						products.value[i].carriers = products.value[i].carrierName.split('、').length;
+						sum += products.value[i].carriers;
+					}
+					title.value = products.value[0].deptName + ' (' + sum + '箱)';
+					console.log(products.value)
+					init();
+				})
+			}
+		);
+	}
 	function handleConfirmReceipt() {
 		if (selection.value.length > 0) {
 			receipt.value.open();

+ 99 - 0
pages/sortBatchReporting/index.vue

@@ -400,6 +400,7 @@
 
 	// }
 
+/*
 	function handleScanCode() {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
@@ -496,6 +497,104 @@
 			})
 		}
 	}
+*/
+
+	function handleScanCode() {
+		// 引入原生插件
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		// const mpaasScanModule = null
+		if (mpaasScanModule) {
+			// 调用插件的 mpaasScan 方法
+			mpaasScanModule.mpaasScan({
+					// 扫码识别类型,参数可多选,qrCode、barCode,
+					// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+					scanType: ["qrCode", "barCode"],
+					// 是否隐藏相册,默认false不隐藏
+					hideAlbum: false,
+				},
+				(ret) => {
+					console.log(ret);
+					let vehicleObj = {carrierCode: ret.resp_result};
+					if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+						uni.showToast({
+							icon: "none",
+							title: "请扫载具码",
+							duration: 1000
+						})
+						return;
+					}
+					showDaywork({
+						carrierCode: vehicleObj.carrierCode,
+						status: 7
+					}).then(response => {
+						if (response.code == 200) {
+							// console.log(response)
+							// console.log(response.data[0].productionPlanDetailId)
+							// console.log(store.planDetails.id)
+							if (response.data[0].deptId !== store.curDeptDetails.deptId) {
+								uni.showToast({
+									icon: 'none',
+									title: '该批次不在当前工段',
+									duration: 2000
+								})
+								return
+							}
+							if (response.data[0].productionPlanDetailId == store.planDetails.id) {
+								// console.log(response.data)
+								lotDialog.value.open(response.data);
+							} else {
+								uni.showToast({
+									icon: 'none',
+									title: '该批次不在此计划单内',
+									duration: 2000
+								})
+							}
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: response.msg,
+								duration: 2000
+							})
+						}
+					})
+				}
+			);
+		} else {
+			// 测试时用
+			showDaywork({
+				carrierId: '1770342949090017283',
+				status: 7
+			}).then(response => {
+				if (response.code == 200) {
+					if (response.data[0].deptId !== store.curDeptDetails.deptId) {
+						uni.showToast({
+							icon: 'none',
+							title: '该批次不在当前工段',
+							duration: 2000
+						})
+						return
+					}
+					if (response.data[0].productionPlanDetailId == store.planDetails.id) {
+						console.log(response.data)
+						lotDialog.value.open(response.data);
+					} else {
+						uni.showToast({
+							icon: 'none',
+							title: '该批次不在此计划单内',
+							duration: 2000
+						})
+					}
+				} else {
+					console.log(response)
+					uni.showToast({
+						icon: 'none',
+						title: response.msg,
+						duration: 2000
+					})
+				}
+			})
+		}
+	}
 
 	// function handleScanCode() {
 	// 	uni.scanCode({

+ 80 - 2
pages/startTurnover/index.vue

@@ -51,7 +51,8 @@
 		onLoad,
 	} from '@dcloudio/uni-app'
 	import {
-		getDayworkItemByCarrierId
+		getDayworkItemByCarrierId,
+		getDayworkItemByCarrierCode
 	} from '@/api/business/dayWorkItem.js'
 
 	const active = ref(false)
@@ -71,7 +72,7 @@
 	function init() {
 		flag.value = listData.value.length > 0 ? false : true;
 	}
-
+/*
 	function HandleScanCode() {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
@@ -147,7 +148,84 @@
 			})
 		}
 	}
+*/
 
+	function HandleScanCode() {
+		// 引入原生插件
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		if (mpaasScanModule) {
+			// 调用插件的 mpaasScan 方法
+			mpaasScanModule.mpaasScan({
+					// 扫码识别类型,参数可多选,qrCode、barCode,
+					// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+					scanType: ["qrCode", "barCode"],
+					// 是否隐藏相册,默认false不隐藏
+					hideAlbum: false,
+				},
+				(ret) => {
+					let vehicleObj = {carrierCode: ret.resp_result};
+					if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+						uni.showToast({
+							icon: "none",
+							title: "请扫载具码",
+							duration: 1000
+						})
+						return;
+					}
+					getDayworkItemByCarrierCode({
+						carrierCode: vehicleObj.carrierCode,
+						status: 4
+					}).then(response => {
+						console.log(response)
+						for (let i = 0; i < listData.value.length; i++) {
+							if (listData.value[i].lotCode === response.data[0].lotCode) {
+								uni.showToast({
+									icon: "none",
+									title: "该批次已存在"
+								})
+								console.log("该批次已存在")
+								return;
+							}
+						}
+						for (let i = 0; i < response.data.length; i++) {
+							listData.value.push(response.data[i]);
+						}
+						for (let i = 0; i < listData.value.length; i++) {
+							listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
+						}
+						console.log(listData.value);
+						init();
+					})
+				}
+			);
+		} else {
+			getDayworkItemByCarrierId({
+				carrierId: '1747500989324668942',
+				status: 4
+			}).then(response => {
+				console.log(response)
+				for (let i = 0; i < listData.value.length; i++) {
+					if (listData.value[i].lotCode === response.data[0].lotCode) {
+						uni.showToast({
+							icon: "none",
+							title: "该批次已存在"
+						})
+						console.log("该批次已存在")
+						return;
+					}
+				}
+				for (let i = 0; i < response.data.length; i++) {
+					listData.value.push(response.data[i]);
+				}
+				for (let i = 0; i < listData.value.length; i++) {
+					listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
+				}
+				console.log(listData.value);
+				init();
+			})
+		}
+	}
+	
 	function handleStartTurnover() {
 		// 调用子组件中的方法
 		turnoverTask.value.open(listData.value);

+ 97 - 1
pages/switchDept/index.vue

@@ -126,7 +126,7 @@
 
 
 	onShow(() => {})
-
+/*
 	function handleScanCode() {
 		// 引入原生插件
 		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
@@ -220,6 +220,102 @@
 			})
 		}
 	}
+*/
+
+	function handleScanCode() {
+		// 引入原生插件
+		const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
+		if (mpaasScanModule) {
+			// 调用插件的 mpaasScan 方法
+			mpaasScanModule.mpaasScan({
+					// 扫码识别类型,参数可多选,qrCode、barCode,
+					// 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
+					scanType: ["qrCode", "barCode"],
+					// 是否隐藏相册,默认false不隐藏
+					hideAlbum: false,
+				},
+				(ret) => {
+					let vehicleObj = {carrierCode: ret.resp_result};
+					if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
+						uni.showToast({
+							icon: "none",
+							title: "请扫载具码",
+							duration: 1000
+						})
+						return;
+					}
+					// 测试时用
+					getDayworkByCarrierCode({
+						carrierCode: vehicleObj.carrierCode,
+						status: 7,
+						deptId: store.curDeptDetails.deptId
+					}).then(res => {
+						if (res.code == 200) {
+							if (res.data.length === 0) {
+								uni.showToast({
+									title: '该批次未周转到当前工段',
+									icon: 'none'
+								})
+							} else {
+								allData.value.push(...res.data.filter(v =>
+									allData.value.findIndex(e => e.id === v.id) <
+									0))
+								handleSearch()
+								debounce(handleScanCode, 700)
+							}
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: res.msg,
+								duration: 2000
+							})
+						}
+					}).catch(err => {
+						console.log(err)
+					})
+				}
+			);
+		} else {
+			// 测试时用
+			getDayworkByCarrierCode({
+				carrierId: '1780467398971187210',
+				status: 7,
+				deptId: store.curDeptDetails.deptId
+			}).then(res => {
+				if (res.code == 200) {
+					if (res.data.length === 0) {
+						uni.showToast({
+							title: '该批次未周转到当前工段',
+							icon: 'none'
+						})
+					} else {
+						// console.log(res.data)
+						// console.log(res.data.filter(v => allData.value.findIndex(e => e.id === v.id) < 0))
+						allData.value.push(...res.data.filter(v => allData.value.findIndex(e => e.id === v.id) <
+							0))
+						// const filtered = res.data.filter(v => listData.value.findIndex(e => e.id === v.id) < 0 && (
+						// 	v.lotCode.includes(keywords.value == null ? '' : keywords.value) ||
+						// 	v.productDescription.includes(keywords.value == null ? '' : keywords.value)))
+						// console.log(filtered)
+						// listData.value.push(...filtered)
+						// console.log(listData.value)
+						// console.log(allData.value)
+						handleSearch()
+					}
+				} else {
+					// console.log(res)
+					uni.showToast({
+						icon: 'none',
+						title: res.msg,
+						duration: 2000
+					})
+				}
+			}).catch(err => {
+				console.log(err)
+			})
+		}
+	}
+
 
 	function handleSearch() {
 		listData.value = allData.value.filter(v =>