guoyujia 9 months ago
parent
commit
8398026fe0

+ 4 - 4
pages/dashboard/index.vue

@@ -57,12 +57,12 @@
 		<view class="business-btn uni-row"  @click="handleToInspectionDetails">
 			<text class="label">检查列表</text>
 		</view>
-<!-- 		<view class="business-btn uni-row" v-if="showOutsourcedInspector" @click="handleToOutsourcedInspection">
+		<view class="business-btn uni-row" v-if="showOutsourcedInspector" @click="handleToOutsourcedInspection">
 			<text class="label">外协检查</text>
-		</view> -->
-		<view class="business-btn uni-row" v-if="showDeliveryInspection" @click="handleToDeliveryInspection">
-			<text class="label">交检</text>
 		</view>
+<!-- 		<view class="business-btn uni-row" v-if="showDeliveryInspection" @click="handleToDeliveryInspection">
+			<text class="label">交检</text>
+		</view> -->
 <!-- 		<view class="business-btn uni-row" v-if="showInspector" @click="handleToFirstInspection">
 			<text class="label">首件检</text>
 		</view> -->

+ 32 - 21
pages/deliveryInspection/form.vue

@@ -68,23 +68,23 @@
 			</view> -->
 			<view class="resu uni-row">
 				<view class="label">检查结果</view>
-				<input v-if="editable()" v-model="item.checkResult" placeholder="请输入检查结果" maxlength="50" />
-				<view v-else class="value">{{ item.checkResult }}</view>
+				<input :disabled="!editable()" v-model="item.checkResult" placeholder="请输入检查结果" maxlength="50" />
+				<!-- <view v-else class="value">{{ item.checkResult }}</view> -->
 			</view>
 			<view class="resu uni-row">
 				<view class="label">超差范围</view>
-				<input v-if="editable()" v-model="item.exceedLimits" placeholder="请输入超差范围" maxlength="50" />
-				<view v-else class="value">{{ item.exceedLimits }}</view>
+				<input :disabled="!editable()" v-model="item.exceedLimits" placeholder="请输入超差范围" maxlength="50" />
+				<!-- <view v-else class="value">{{ item.exceedLimits }}</view> -->
 			</view>
 			<view class="resu uni-row">
 				<view :class="!editable() ? 'label' : ''">检查量</view>
-				<input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
+				<input :disabled="!editable()" class="number" type="number" @blur="rejectNumberChange"
 					v-model="item.examiningNum" placeholder="" />
-				<view v-else class="number value">{{ item.examiningNum }}</view>
+				<!-- <view v-else class="number value">{{ item.examiningNum }}</view> -->
 				<view :class="!editable() ? 'label' : ''">不良品量</view>
-				<input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
+				<input :disabled="!editable()" class="number" type="number" @blur="rejectNumberChange"
 					v-model="item.disqualificationNum" placeholder="" />
-				<view v-else class="value">{{ item.disqualificationNum }}</view>
+				<!-- <view v-else class="value">{{ item.disqualificationNum }}</view> -->
 			</view>
 			</view>
 		</view>
@@ -115,23 +115,25 @@
 		<view class="daywork-container">
 			<view class="result uni-row">
 				<view class="label" style="margin-top: 20rpx; margin-right: 10rpx;">交检状态</view>
-				<uni-data-checkbox style="margin-top: 20rpx;" v-model="processInspecion.status"
+				<uni-data-checkbox :disabled="!editable()" style="margin-top: 20rpx;" v-model="processInspecion.status"
 					:localdata="range"></uni-data-checkbox>
 			</view>
+			<view v-if="editable()">
 			<view v-if="showTransfer" class="list-title uni-row" style="margin-top: 16rpx;">
 				<text class="label">是否移交仪器室</text><text>&nbsp;否</text>
-				<switch class="switch" @change="switchChange"  style="transform:scale(0.7)" color="rgba(255,85,85,1)" />
+				<switch class="switch" @change="switchChange"  style="transform:scale(0.7);margin-top: -16rpx;" color="rgba(255,85,85,1)" />
 				<text>是</text>
 			</view>
 			<view v-else class="list-title uni-row" style="margin-top: 16rpx;">
 				<text class="label">已经移交给仪器室</text>
 			</view>
+			</view>
 			<view class="remark uni-row">
 				<view class="label">备注</view>
-				<textarea v-model="processInspecion.remark" />
+				<textarea :disabled="!editable()" v-model="processInspecion.remark" />
 			</view>
 
-			<view class="btns-container uni-row">
+			<view v-if="editable()" class="btns-container uni-row">
 				<view class="finished-btn" @click="endWork">提交</view>
 				<view class="question-btn uni-column" @click.stop="handleAddConsultation">
 					<uni-icons type="headphones" size="24" />
@@ -253,6 +255,7 @@
 			selectInspecion(processInspecion.value).then(res => {
 				if (res.code == 200) {
 					processInspecion.value = res.data;
+					processInspecion.value.flag = false
 					unfitInfos.value = res.data.processInspectionDetails;
 					initStatus.value = res.data.status
 					consultations.value = res.data.dayworkItemConsults;
@@ -319,6 +322,13 @@
 			url: navigateUrl
 		  });
 	}
+	function switchChange(event) {
+		if (event.detail.value) {
+			processInspecion.value.flag = true
+		} else {
+			processInspecion.value.flag = false
+		}
+	}
 
 	const rejectNumberChange = () => {
 	let sumDisqualificationNum = 0
@@ -363,14 +373,6 @@
 	function endWork() {
 		let unf = unfitInfos.value;
 		for (var i = 0; i < unfitInfos.value.length; i++) {
-			if (!unf[i].checkResult) {
-				uni.showToast({
-					icon: 'none',
-					title: unf[i].checkStandard+ "检查结果不能为空",
-					duration: 2000
-				})
-				return;
-			}
 
 			if (unf[i].examiningNum < 0 || unf[i].disqualificationNum < 0) {
 				uni.showToast({
@@ -425,7 +427,11 @@
 		processInspecion.value.inspectionCarrierId = processInspecion.value.lot.inspectionCarrierId
 		processInspecion.value.inspectionCarrierCode = processInspecion.value.lot.inspectionCarrierCode
 		console.log(processInspecion.value)
-
+		if(processInspecion.value.flag) {
+			//打开选择仪器室的弹窗
+			selectInspectionChamber.value.open()
+			console.log(processInspecion.value)
+		}else{
 		saveDeliveryInspecion(processInspecion.value).then(res => {
 			if (res.code == 200) {
 				let index = 0;
@@ -449,6 +455,7 @@
 				})
 			}
 		});
+		}
 	}
 
 
@@ -743,6 +750,10 @@
 				text-align: center;
 			}
 		}
+		.switch {
+			margin-top: -8rpx;
+			align-items: center;
+		}
 
 		.remark {
 			margin-top: 24rpx;

+ 140 - 116
pages/deliveryInspection/scan.vue

@@ -96,114 +96,114 @@
 	onLoad(() => {})
 	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
-		// 			}
-		// 			//判断该箱是否绑定批次
+		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;
-		// 			// console.log(result.processCode)
-		// 			/************************ 根据扫码查询到的数据和需要检查的工序查询信息 ************************/
-		// 			getCarrierInfo(result).then(response => {
-		// 				if (response.code == 200) {
-		// 					// 判断是哪种返回值 假设是想信息则给lot附检查箱信息
-		// 					// 假设是dayworkCarriers 则 判断是几个批次,假设为多批,则弹出选择框。
-		// 				if (response.data.dayworkCarriers != null) {
-		// 						if (response.data.dayworkCarriers.length > 1) {
-		// 							query.value = result;
-		// 							selectProcessInspection.value.open(response.data.dayworkCarriers)
-		// 						} else {
-		// 							// console.log(response)
-		// 							uni.showLoading({
-		// 								title: '加载中'
-		// 							});
-		// 							// 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
-		// 							// 需要定义一个请求方法, 从后端获取
-		// 							getLotInfo(result).then(res => {
-		// 								if (res.code == 200) {
-		// 									console.log(res)
+					result.processCode = store.outsourcedCode;
+					// console.log(result.processCode)
+					/************************ 根据扫码查询到的数据和需要检查的工序查询信息 ************************/
+					getCarrierInfo(result).then(response => {
+						if (response.code == 200) {
+							// 判断是哪种返回值 假设是想信息则给lot附检查箱信息
+							// 假设是dayworkCarriers 则 判断是几个批次,假设为多批,则弹出选择框。
+						if (response.data.dayworkCarriers != null) {
+								if (response.data.dayworkCarriers.length > 1) {
+									query.value = result;
+									selectProcessInspection.value.open(response.data.dayworkCarriers)
+								} else {
+									// console.log(response)
+									uni.showLoading({
+										title: '加载中'
+									});
+									// 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
+									// 需要定义一个请求方法, 从后端获取
+									getLotInfo(result).then(res => {
+										if (res.code == 200) {
+											console.log(res)
 											
-		// 									if(res.data.dayworkItemList.length == 0) {
-		// 										uni.showToast({
-		// 											icon: 'none',
-		// 											title: "该批次当天没有报工",
-		// 											duration: 2000
-		// 										})
-		// 									}else{
-		// 										getUser(res.data.dayworkItemList)
-		// 										getEquipment(res.data.dayworkItemList)	
-		// 														lot.value = {
-		// 															...lot.value,
-		// 															...res.data
-		// 														};	
-		// 									lot.value.carrierCode = result.carrierCode
-		// 									carrierCode.value = result.carrierCode;
-		// 									// console.log("res", res);
-		// 									uni.hideLoading();
-		// 									// 判断是否批次号和检查箱码都扫完
-		// 									checkSave()
-		// 									}
-		// 								} else {
-		// 									uni.showToast({
-		// 										icon: 'none',
-		// 										title: res.msg,
-		// 										duration: 2000
-		// 									})
-		// 								}
-		// 							}).catch(err => {
-		// 								uni.showToast({
-		// 									icon: 'none',
-		// 									title: err.message,
-		// 									duration: 2000
-		// 								})
-		// 							})
+											if(res.data.dayworkItemList.length == 0) {
+												uni.showToast({
+													icon: 'none',
+													title: "该批次当天没有报工",
+													duration: 2000
+												})
+											}else{
+												getUser(res.data.dayworkItemList)
+												getEquipment(res.data.dayworkItemList)	
+																lot.value = {
+																	...lot.value,
+																	...res.data
+																};	
+											lot.value.carrierCode = result.carrierCode
+											carrierCode.value = result.carrierCode;
+											// console.log("res", res);
+											uni.hideLoading();
+											// 判断是否批次号和检查箱码都扫完
+											checkSave()
+											}
+										} else {
+											uni.showToast({
+												icon: 'none',
+												title: res.msg,
+												duration: 2000
+											})
+										}
+									}).catch(err => {
+										uni.showToast({
+											icon: 'none',
+											title: err.message,
+											duration: 2000
+										})
+									})
 						
-		// 						}
-		// 					} else if (response.data.inspectionCarrier != null) {
-		// 						console.log(response)
-		// 						lot.value.inspectionCarrierCode = response.data.inspectionCarrier.code
-		// 						lot.value.inspectionCarrierId = response.data.inspectionCarrier.id
-		// 						// 判断是否批次号和检查箱码都扫完
-		// 						checkSave()
-		// 					}
-		// 				} else {
-		// 					uni.showToast({
-		// 						icon: 'none',
-		// 						title: response.msg,
-		// 						duration: 2000
-		// 					})
-		// 				}
-		// 			}).catch(err => {
-		// 				uni.showToast({
-		// 					icon: 'none',
-		// 					title: err.message,
-		// 					duration: 2000
-		// 				})
-		// 			})
-		// 		}
-		// 	)
-		// } else {
+								}
+							} else if (response.data.inspectionCarrier != null) {
+								console.log(response)
+								lot.value.inspectionCarrierCode = response.data.inspectionCarrier.code
+								lot.value.inspectionCarrierId = response.data.inspectionCarrier.id
+								// 判断是否批次号和检查箱码都扫完
+								checkSave()
+							}
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: response.msg,
+								duration: 2000
+							})
+						}
+					}).catch(err => {
+						uni.showToast({
+							icon: 'none',
+							title: err.message,
+							duration: 2000
+						})
+					})
+				}
+			)
+		} else {
 			const result = {
 				carrierCode: '000257'
 			}
@@ -285,7 +285,7 @@
 					duration: 2000
 				})
 			})
-		// }
+		}
 		
 	}
 	function checkSave() {
@@ -347,21 +347,45 @@
 		uni.showLoading({
 			title: '加载中'
 		});
-		getLotInfo(query.value).then(res => {
-			if (res.code == 200) {
-				lot.value = res.data;
-				lot.value.carrierCode = query.value.carrierCode
-				carrierCode.value = query.value.carrierCode;
-				console.log("res", res);
-				uni.hideLoading();
-			} else {
+	getLotInfo(query.value).then(res => {
+		if (res.code == 200) {
+			console.log(res)
+			
+			if(res.data.dayworkItemList.length == 0) {
 				uni.showToast({
 					icon: 'none',
-					title: res.msg,
+					title: "该批次当天没有报工",
 					duration: 2000
 				})
+			}else{
+				console.log("888")
+				getUser(res.data.dayworkItemList)
+				getEquipment(res.data.dayworkItemList)	
+								lot.value = {
+									...lot.value,
+									...res.data
+								};	
+			lot.value.carrierCode = query.value.carrierCode
+			carrierCode.value = query.value.carrierCode;
+			// console.log("res", res);
+			uni.hideLoading();
+			// 判断是否批次号和检查箱码都扫完
+			checkSave()
 			}
-		});
+		} else {
+			uni.showToast({
+				icon: 'none',
+				title: res.msg,
+				duration: 2000
+			})
+		}
+	}).catch(err => {
+		uni.showToast({
+			icon: 'none',
+			title: err.message,
+			duration: 2000
+		})
+	})
 	}
 
 	//确定后,将批次id,批次号,传递过去

+ 33 - 8
pages/factoryInspection/form.vue

@@ -196,7 +196,20 @@
 	}]
 
 	/***************************** 页面生命周期函数 *****************************/
+	function init(){
+		const instance = getCurrentInstance().proxy
+		const eventChannel = instance.getOpenerEventChannel();
 
+		eventChannel.on('factoryInspectionFrom', function(data) {
+
+			console.log('acceptDataFromOpenerPage', data)
+			if (data && data.data) {
+				processInspecion.value.lot = data.data;
+				getOringicalList()
+			}
+		})
+
+	}
 	onShow(() => {
 		console.log(store.processInspection)
 		console.log(flag.value)
@@ -226,6 +239,8 @@
 					})
 				}
 			});
+		}else{
+			init()
 		}
 		}
 	})
@@ -257,6 +272,23 @@
 			url: navigateUrl
 		  });
 	}
+	function getOringicalList() {
+		console.log(processInspecion.value)
+			//查询该产品,当前工序,当前检查绑定的检查
+				getInspectionStandardsList({
+					productId:processInspecion.value.lot.productId,
+					processId:processInspecion.value.lot.processId,
+					inspectionCode:"factoryInspection"
+					}).then(res =>{
+						unfitInfos.value = res.rows.map(item => {
+						    // 映射新的数组,包含 inspectionStandardsId 和 checkStandard 属性
+						    return {
+						      inspectionStandardsId: item.id, // 从 item 中获取 id
+						      checkStandard: item.standard // 从 item 中获取 standard
+						    };
+						  });
+			})
+	}
 
 	const rejectNumberChange = () => {
 	let sumDisqualificationNum = 0
@@ -300,14 +332,6 @@
 	function endWork() {
 		let unf = unfitInfos.value;
 		for (var i = 0; i < unfitInfos.value.length; i++) {
-			if (!unf[i].checkResult) {
-				uni.showToast({
-					icon: 'none',
-					title: unf[i].checkStandard+ "检查结果不能为空",
-					duration: 2000
-				})
-				return;
-			}
 
 			if (unf[i].examiningNum < 0 || unf[i].disqualificationNum < 0) {
 				uni.showToast({
@@ -359,6 +383,7 @@
 		processInspecion.value.dayworkItemConsults = consultations.value;
 		processInspecion.value.processInspectionDetails = unfitInfos.value;
 		processInspecion.value.user = store.userInfo;
+		processInspecion.value.reviewerId = store.userInfo.userId
 		processInspecion.value.inspectionCarrierId = processInspecion.value.lot.inspectionCarrierId
 		processInspecion.value.inspectionCarrierCode = processInspecion.value.lot.inspectionCarrierCode
 		console.log(processInspecion.value)

+ 2 - 8
pages/factoryInspection/index.vue

@@ -12,7 +12,7 @@
 			</uni-section>
 		</view>
 
-		<view v-if="showAdd" class="scan-btn uni-row" style="min-height: 80rpx;" @click.stop="handleAddOnSiteInspection">新增出厂检</view>
+		<view class="scan-btn uni-row" style="min-height: 80rpx;" @click.stop="handleAddOnSiteInspection">新增出厂检</view>
 		<view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
 			@click="handleSelection(item)">
 			<view class="lot-code uni-row">
@@ -71,7 +71,6 @@
 		store
 	} from '@/store/index.js'
 	const keyword = ref('')
-	const showAdd = ref(false)
 	const inspecionList = ref([]); //时间后筛选数组
 	const original = ref([]); //原始数组
 	const startTime = ref(new Date().toISOString().split("T")[0])
@@ -95,11 +94,6 @@
 
 	/***************************** 页面生命周期函数 *****************************/
 	onShow(() => {
-		if(store.userInfo.roles.some(item =>item.roleKey == 'factoryInspection')) {
-			showAdd.value = false
-		}else{
-			showAdd.value = true
-		}
 		getList()
 		// uni.showLoading({
 		// 	title: '加载中'
@@ -231,7 +225,7 @@
 	}
 
 	/***************************** 定义了一些事件 *****************************/
-	// 新增
+	// 新增出厂
 	const handleAddOnSiteInspection = () => {
 		store.processInspection = null
 		uni.navigateTo({

+ 28 - 8
pages/factoryInspection/scan.vue

@@ -178,7 +178,7 @@
 			)
 		} else {
 			const result = {
-				carrierCode: '000316'
+				carrierCode: '000312'
 			}
 			getCarrierInfo(result).then(response => {
 				if (response.code == 200) {
@@ -205,8 +205,8 @@
 									};
 									lot.value.carrierCode = result.carrierCode
 									carrierCode.value = result.carrierCode;
-									lot.value.inspectionCarrierId = '1803605009579950084'
-									lot.value.inspectionCarrierCode = "300088"
+									lot.value.inspectionCarrierId = '1803605009542201348'
+									lot.value.inspectionCarrierCode = "300035"
 									// console.log("res", res);
 									uni.hideLoading();
 									// 判断是否批次号和检查箱码都扫完
@@ -305,14 +305,34 @@
 			store.processInspection = null
 			let processInspection = {}
 			processInspection.lot = lot.value
+			if(store.userInfo.roles.some(item =>item.roleKey == 'factoryInspection')) {
+				processInspection.reviewerId = store.userInfo.userId
+			}else{
+				processInspection.reviewerId = 0
+			}
 			//保存
 			console.log(processInspection)
 			lot.value = {}
-		  saveFactoryInspecion(processInspection).then(res =>{
-			  uni.navigateTo({
-			  	url: '/pages/factoryInspection/index'
-			  })
-		  })
+			if(store.userInfo.roles.some(item =>item.roleKey == 'factoryInspection')) {
+			uni.navigateTo({
+						url: "/pages/factoryInspection/form",
+						success: (res) => {
+							// 通过eventChannel向被打开页面传送数据
+							res.eventChannel.emit("factoryInspectionFrom", {
+								data: processInspection.lot
+							})
+						}
+					})
+			}else{
+				saveFactoryInspecion(processInspection).then(res =>{
+		
+						uni.navigateTo({
+					url: '/pages/factoryInspection/index'
+				})		 
+				})
+			
+			}
+		
 		} else {
 			if (lot.value.allCarrierName == undefined) {
 				uni.showToast({

+ 0 - 8
pages/instrumentRoomInspection/form.vue

@@ -311,14 +311,6 @@
 	function endWork() {
 		let unf = unfitInfos.value;
 		for (var i = 0; i < unfitInfos.value.length; i++) {
-			if (!unf[i].checkResult) {
-				uni.showToast({
-					icon: 'none',
-					title: unf[i].checkStandard+ "检查结果不能为空",
-					duration: 2000
-				})
-				return;
-			}
 
 			if (unf[i].examiningNum < 0 || unf[i].disqualificationNum < 0) {
 				uni.showToast({