guoyujia 6 miesięcy temu
rodzic
commit
58275c09e8

+ 7 - 0
api/dept/dept.js

@@ -11,6 +11,13 @@ export function getDeptList(data) {
 		data: data
 	})
 }
+export function getDeptListInfo(data) {
+	return req.request({
+		url:'/system/dept/getDeptListInfo',
+		method: 'GET',
+		data: data
+	})
+}
 /**
  * 获取生产子计划列表
  * @param {Object} data

+ 22 - 2
components/dialog-end-work/dialog-end-work.vue

@@ -391,8 +391,19 @@
 				}
 			}
 		} else {
-			handleSave();
-		}
+			console.log("999")
+			//判断当前序合格总数为0 ,不允许保存
+				console.log(parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0)
+			if (workInfo.value.status == "3" && parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0) {
+				uni.showToast({
+					icon: 'none',
+					title: '当前序合格总数不能为0',
+					duration: 2000
+				})
+			}else{
+				handleSave();
+			}
+	}
 	}
 
 	function handleFinishReporting() {
@@ -402,6 +413,7 @@
 		let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(
 			2);
 		let num = 103;
+		//lotPreSumQualifiedNum当前序的所有合格数
 		if (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number > 0) {
 			if (isFirstOrder.value) {
 				if (percent == 103) {
@@ -444,6 +456,14 @@
 				}
 			}
 		} else {
+			//判断当前序合格总数为0 ,不允许保存
+			if (workInfo.value.status == "3" && parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0) {
+				uni.showToast({
+					icon: 'none',
+					title: '当前序合格总数不能为0'
+				})
+				return;
+				}
 			if (showCarrierList.value) {
 				if (endFlag.value >= bindList.value.length) {
 					handleSave();

+ 35 - 3
components/dialog-turnoverApplication/dialog-turnoverApplication.vue

@@ -80,7 +80,7 @@
 		turnoverOutsource
 	} from '@/api/business/dayWorkItem.js'
 	import {
-		getDeptList
+		getDeptListInfo
 	} from '@/api/dept/dept.js'
 	import {
 		getTurnoverListByDeptId,
@@ -94,6 +94,8 @@
 
 	const baseDialog = ref(null)
 	const turnoverDoorChecked = ref([])
+	// 创建一个引用来存储最后一次请求的时间戳
+	const lastRequestTimestamp = ref(0);
 	const turnoverType = ref([])
 	const outTurnArea = ref([])
 	const turnoverArea = ref([])
@@ -186,7 +188,7 @@
 				deptId: null
 			};
 		})
-		getDeptList({
+		getDeptListInfo({
 			tenantId: store.tenantId,
 			productionPlanDetailId: store.planDetails.id,
 			lotId: dayworkInfo.value.lotId,
@@ -273,7 +275,21 @@
 				title: '请选择完整信息'
 			});
 		} else {
+			const currentTime = Date.now();
+			
+			// 检查是否已经过去了 2 秒
+			if (currentTime - lastRequestTimestamp.value < 2000) {
+				// 如果在 2 秒 内已经有请求发出,那么不执行
+				uni.showToast({
+					icon: 'none',
+					title: `请勿重复点击`,
+					duration: 2000
+				})
+				return;
+			}
+		lastRequestTimestamp.value = currentTime;
 		curDayworkItem.value.id = null;
+		curDayworkItem.value.processStepNumber = dayworkInfo.value.currentProcess.processStepNumber
 		curDayworkItem.value.startTime = timestampToTime(new Date());
 		curDayworkItem.value.endTime = timestampToTime(new Date());
 		curDayworkItem.value.technologicalProcessId = dayworkInfo.value.technologicalProcessId;
@@ -304,6 +320,7 @@
 					icon: 'none',
 					title: res.msg
 				});
+				emit('reflushDaywork');
 			}
 		})
 		}
@@ -313,9 +330,23 @@
 		if (curDayworkItem.value.turnoverType == '3') {
 			handleConfirmOutsource();
 		} else {
-			//console.log(dayworkInfo.value)
+			const currentTime = Date.now();
+				
+				// 检查是否已经过去了 2 秒
+				if (currentTime - lastRequestTimestamp.value < 2000) {
+					// 如果在 2 秒 内已经有请求发出,那么不执行
+					uni.showToast({
+						icon: 'none',
+						title: `请勿重复点击`,
+						duration: 2000
+					})
+					return;
+				}
+			lastRequestTimestamp.value = currentTime;
+			console.log(dayworkInfo.value)
 			curDayworkItem.value.id = null;
 			curDayworkItem.value.status = '4';
+			curDayworkItem.value.processStepNumber = dayworkInfo.value.currentProcess.processStepNumber
 			curDayworkItem.value.startTime = timestampToTime(new Date());
 			curDayworkItem.value.endTime = timestampToTime(new Date());
 			curDayworkItem.value.technologicalProcessId = dayworkInfo.value.technologicalProcessId;
@@ -390,6 +421,7 @@
 							icon: 'none',
 							title: res.msg
 						});
+						emit('reflushDaywork');
 					}
 				})
 			}

+ 38 - 3
pages/sorting/form.vue

@@ -139,7 +139,7 @@
 					更换载具</view>
 				<view v-if="checkFinishable()&&Number(dayworkItem.status) < 3" class="finished-btn"
 					@click.stop="handleFinishDaywork">结束报工</view>
-				<view v-if="!checkFinishable()&&Number(dayworkItem.status) < 3" class="pause-btn"
+				<view v-if="Number(dayworkItem.status) < 3" class="pause-btn"
 					@click.stop="handleUpdateDaywork">暂停</view>
 				<view v-if="Number(dayworkItem.status) < 3" class="question-btn uni-column"
 					@click.stop="handleAddConsultation">
@@ -169,6 +169,9 @@
 	import {
 		getTakeStockPeriod
 	} from '@/api/business/taksStackLot.js'
+	import {
+		getDictInfoByType
+	} from '@/api/dict/dict.js'
 	import {
 		onLoad,
 		onReady,
@@ -194,6 +197,8 @@
 	const saveFlag = ref(false)
 	const storageNum = ref(null)
 	const storageInfo = ref(null)
+	const qualifiedNumRatio = ref(0)
+	const isFinish = ref(false)
 	const column1 = [
 	    { name: 'lotCode', label: '批次号',align:'center'},
 	    { name: 'storageNum', label: '数量',align:'center' },
@@ -239,6 +244,16 @@
 
 	/***************************** 定义了一些方法 *****************************/
 	const init = (data) => {
+		//获取当前跟选报工合格数最大值
+		// getDictInfoByType("sort_report_limit").then(res => {
+		// 	console.log(res.data && res.data.length >0)
+		// 	if(res.data && res.data.length >0) {
+		// 		qualifiedNumRatio.value =parseInt(res.data[0].dictValue) 
+		// 	}
+		// }).catch(err => {
+		// 	console.log(err)
+		// 	console.log('369 err')
+		// })
 		console.log("dayworkInfo", dayworkInfo.value);
 		// 获取当前报工信息
 		getSortingDayworkItem(data).then(res => {
@@ -252,7 +267,7 @@
 					saveFlag.value = false
 				}
 				console.log(dayworkItem.value)
-				if (dayworkItem.value.qualifiedNum === 0 && dayworkItem.value.rejectNum === 0) {
+				if (dayworkItem.value.status == 0 &&dayworkItem.value.qualifiedNum === 0 && dayworkItem.value.rejectNum === 0) {
 					dayworkItem.value.qualifiedNum = res.data.prodNum
 				}
 				retrievalInfo.value = res.data.retrievalInfo
@@ -572,6 +587,14 @@ uni.navigateTo({
 			})
 			return false;
 		}
+		if (isFinish.value &&dayworkItem.value.qualifiedNum == 0) {
+			uni.showToast({
+				icon: 'none',
+				title: "合格数不能为0",
+				duration: 2000
+			})
+			return false;
+		}
 
 		if (dayworkItem.value.qualifiedNum < 0) {
 			uni.showToast({
@@ -581,7 +604,16 @@ uni.navigateTo({
 			})
 			return false;
 		}
-		return true
+		//只在结束报工的时候判断
+		// if(isFinish.value &&dayworkItem.value.qualifiedNum > (dayworkItem.value.prodNum * (qualifiedNumRatio.value/100))){
+		// 	uni.showToast({
+		// 		icon: 'none',
+		// 		title: "合格数不能超过投产量的"+qualifiedNumRatio.value+"%",
+		// 		duration: 2000
+		// 	})
+		// 	return false;
+		// }
+		 return true
 		// unfitInfos.value.forEach((e, i) => {
 		// 	if (e.name)
 		// })
@@ -609,6 +641,7 @@ async function handleCheckStock() {
 	
 
 	 async function handleFinishDaywork() {
+		 isFinish.value = true
 		if (!validHandle()) {
 			return
 		}	
@@ -686,6 +719,7 @@ async function handleCheckStock() {
 		})
 	}
 	const handleUpdateDaywork = () => {
+		isFinish.value = false
 		if (!validHandle()) {
 			return
 		}
@@ -1013,6 +1047,7 @@ async function handleCheckStock() {
 				justify-content: center;
 				align-items: center;
 				border-radius: 8rpx;
+				margin-left: 12rpx;
 			}
 
 			.question-btn {