guoyujia 5 月之前
父節點
當前提交
61463a6e3d

+ 35 - 100
components/dialog-end-inner-work/dialog-end-inner-work.vue

@@ -351,51 +351,23 @@
 	}
 
 	function handlePreFinishReporting() {
+		console.log("999")
 		//投产数
 		let number = store.dayworkInfo.prevProcess == null ? store.dayworkInfo.productionQuantity : store.dayworkInfo
 			.processQualifiedNum;
 		workInfo.value.prodNum = number
-
-		let max = parseInt(number * 1.03);
-		// max = parseInt(String(max).split("."));
-		console.log("maxawdjkkaljdalkw", max);
-		let sunm = parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value; //计算总合格数
-		let percent = (sunm / number) * 100; //合格率
-
-		percent = Math.ceil(percent * 100) / 100; //只入不舍
-		console.log("合格量", percent)
-		// let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(2);
-
-		let num = 103;
+		console.log(parseInt(workInfo.value.qualifiedNum))
+		console.log(lotPreSumQualifiedNum.value)
+		console.log(number)
 		// 填入数大于剩余量情况
 		if (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number > 0) {
-			// 判断当前是否为首序
-			if (isFirstOrder.value) {
-				uni.showModal({
-					title: '提示',
-
-					content: `合格数总量超出投入量${percent}%,是否继续保存?`,
-					success: function(res) {
-						if (res.confirm) {
-							handleSave();
-						} else if (res.cancel) {}
-					}
-				})
-			} else {
-				if (percent > num) {
-					uni.showToast({
-						icon: 'none',
-						title: '合格数总量为投产量的' + percent + "%,请重新输入!"
-					})
-					return;
-				} else {
-					handleSave();
-				}
-			}
+			console.log("555")
+			uni.showToast({
+				icon: 'none',
+				title: '当前序合格总数不能超过投产数'
+			})
 		} else {
-			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',
@@ -412,74 +384,37 @@
 		console.log(store.isPreProcess)
 		//投产数
 		let number = workInfo.value.prodNum;
-		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) {
-					percent = 103.1
-				}
-				uni.showModal({
-					title: '提示',
-					content: `合格数总量超出投入量${percent}%,是否继续保存?`,
-					success: function(res) {
-						if (res.confirm) {
-							if (showCarrierList.value) {
-								if (endFlag.value >= bindList.value.length) {
-									handleSave();
-								} else {
-									uni.showToast({
-										icon: "none",
-										title: "请先扫码确认载具",
-										duration: 2000
-									})
-									return;
-								}
-							} else {
-								handleSave();
-							}
-						} else if (res.cancel) {}
-					}
-				})
+		//判断当前序合格总数为0 ,不允许保存
+		if (workInfo.value.status == "3" && parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0) {
+			uni.showToast({
+				icon: 'none',
+				title: '当前序合格总数不能为0'
+			})
+			return;
+		}
+		console.log(parseInt(workInfo.value.qualifiedNum))
+		console.log(lotPreSumQualifiedNum.value)
+		console.log(number)
+		if (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value > number) {
+			uni.showToast({
+				icon: 'none',
+				title: '当前序合格总数不能超过投产数'
+			})
+			return;
+		}
+		if (showCarrierList.value) {
+			if (endFlag.value >= bindList.value.length) {
+				handleSave();
 			} else {
-				if (percent == num) {
-					percent = 103.01
-				}
-				if (percent > num) {
-					uni.showToast({
-						icon: 'none',
-						title: '合格数总量为投产量的' + percent + "%,请重新输入!"
-					})
-					return;
-				} else {
-					handleSave();
-				}
-			}
-		} else {
-			//判断当前序合格总数为0 ,不允许保存
-			if (workInfo.value.status == "3" && parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0) {
 				uni.showToast({
-					icon: 'none',
-					title: '当前序合格总数不能为0'
+					icon: "none",
+					title: "请先扫码确认载具",
+					duration: 2000
 				})
 				return;
 			}
-			if (showCarrierList.value) {
-				if (endFlag.value >= bindList.value.length) {
-					handleSave();
-				} else {
-					uni.showToast({
-						icon: "none",
-						title: "请先扫码确认载具",
-						duration: 2000
-					})
-					return;
-				}
-			} else {
-				handleSave();
-			}
+		} else {
+			handleSave();
 		}
 	}
 

+ 0 - 2
components/dialog-lot/dialog-lot.vue

@@ -187,7 +187,6 @@
 								//处理成功情况
 								close();
 								emit('submit', selection.value);
-								uni.$emit('dayworkItemUpdate');
 							} else {
 								uni.showModal({
 									title: '提示',
@@ -199,7 +198,6 @@
 				} else {
 					close();
 					emit('submit', selection.value);
-					uni.$emit('dayworkItemUpdate');
 				}
 
 				// 	console.log(selection.value)

+ 0 - 2
components/dialog-outsourceLot/dialog-outsourceLot.vue

@@ -163,7 +163,6 @@
 								//处理成功情况
 								close();
 								emit('submit', selection.value);
-								uni.$emit('dayworkItemUpdate');
 							} else {
 								uni.showModal({
 									title: '提示',
@@ -175,7 +174,6 @@
 				} else {
 					close();
 					emit('submit', selection.value);
-					uni.$emit('dayworkItemUpdate');
 				}
 
 				// 	console.log(selection.value)

+ 108 - 93
pages/reportHistory/index.vue

@@ -5,16 +5,16 @@
 			<view class="second">注意日期区间最长不超过31天</view>
 		</view>
 		<uni-section title="开始日期:" type="square" class="uni-row sta">
-			<input v-model="startTime" type="date"/>
+			<input v-model="startTime" type="date" />
 		</uni-section>
 		<uni-section title="结束日期:" type="square" class="uni-row end">
-			<input v-model="endTime" type="date"/>
+			<input v-model="endTime" type="date" />
 		</uni-section>
 		<button @click="handleSearch">查询</button>
 	</view>
 
 	<view v-if="show" class="uni-column container">
-		
+
 		<view class="uni-row" style="position: fixed;
 		top: 0;width: 100%;
 		height: 120rpx;
@@ -26,30 +26,32 @@
 		align-items: center;
 		border-top: 1rpx solid lightgray;
 		border-bottom: 1rpx solid lightgray;">
-		
+
 			<!-- <uni-section title="选择日期:" type="square" class="uni-row" style="margin-left: 16rpx;">
 				<uni-data-select v-model="selectDate" :localdata="dateList" @change="change" :clear="false"
 				placeholder="无报工记录"
 					style="width: 200rpx;"></uni-data-select>
 			</uni-section> -->
-			
+
 			<view class="tab-container">
-				<view :class="['tab-item', editStatus === false ? 'active': '']" @click="handleCheckTabHis()">历史报工</view>
+				<view :class="['tab-item', editStatus === false ? 'active': '']" @click="handleCheckTabHis()">历史报工
+				</view>
 				<view :class="['tab-item', editStatus === true ? 'active': '']" @click="handleCheckTab()">已完成报工</view>
 			</view>
-			
+
 			<view style="width: 100%;">
-			<uni-section title="时间范围:" type="square" class="uni-row" style="justify-content: start;align-items: center;margin-left: 20rpx;">
-				{{ startTime }}&nbsp; ~ &nbsp;{{endTime}}
-			</uni-section>
-			
-			<!-- <view style="width: 100%;font-size: 28rpx; text-align: left; margin-left: 16rpx;">时间范围:{{ startTime }}&nbsp; ~ &nbsp;{{endTime}}</view> -->
-			<!-- <uni-section title="条数:" type="square" class="uni-row" style="justify-content: center;align-items: center;">
+				<uni-section title="时间范围:" type="square" class="uni-row"
+					style="justify-content: start;align-items: center;margin-left: 20rpx;">
+					{{ startTime }}&nbsp; ~ &nbsp;{{endTime}}
+				</uni-section>
+
+				<!-- <view style="width: 100%;font-size: 28rpx; text-align: left; margin-left: 16rpx;">时间范围:{{ startTime }}&nbsp; ~ &nbsp;{{endTime}}</view> -->
+				<!-- <uni-section title="条数:" type="square" class="uni-row" style="justify-content: center;align-items: center;">
 				{{ listDataItem.length }}
 			</uni-section> -->
 			</view>
 		</view>
-		
+
 		<view class="scroll-container" v-if="!editStatus">
 
 			<view v-for="(item, index) in listDataItem" :key="index" class="list-item">
@@ -103,9 +105,9 @@
 				</view>
 			</view>
 		</view>
-		
+
 		<view class="scroll-container" v-if="editStatus">
-		
+
 			<view v-for="(item, index) in listDaywork" :key="index" class="list-item">
 				<view class="title-container">
 					<view class="title uni-row">
@@ -137,7 +139,7 @@
 					<text class="label">操作者</text>
 					<text class="label right">{{ item['nickName'] }}</text>
 				</view> -->
-			<!-- 	<view class="item-info uni-row">
+				<!-- 	<view class="item-info uni-row">
 					<text class="label">开始时间</text>
 					<text class="label right">{{ item['startTime'] ? item['startTime'] : '-' }}</text>
 				</view> -->
@@ -149,21 +151,22 @@
 					<text class="label">废品数</text>
 					<text class="label right">{{ item['rejectSum'] ? item['rejectSum'] : 0 }}</text>
 				</view>
-				
+
 				<view class="item-info uni-row">
 					<text class="label">设备</text>
 					<text class="label right">{{ item['equipmentDetailCode'] }}</text>
-					<view class="uni-row" style="justify-content: flex-end;margin-left: 20px;" v-if="item['adoptStatus'] && item['adoptStatus'] != null">
-						<text >交检状态:</text>
-						<text  v-if="item['adoptStatus'] == 1" style="color: #67c337;"	>正常</text>
-						<text  v-if="item['adoptStatus'] == 2" style="color: red;"	>反选</text>
+					<view class="uni-row" style="justify-content: flex-end;margin-left: 20px;"
+						v-if="item['adoptStatus'] && item['adoptStatus'] != null">
+						<text>交检状态:</text>
+						<text v-if="item['adoptStatus'] == 1" style="color: #67c337;">正常</text>
+						<text v-if="item['adoptStatus'] == 2" style="color: red;">反选</text>
 					</view>
 				</view>
 			</view>
 		</view>
 	</view>
-	
-	
+
+
 	<!-- <dialog-lotInfo ref="lotInfo"></dialog-lotInfo> -->
 </template>
 
@@ -197,8 +200,8 @@
 	const total = ref(0)
 	const editStatus = ref(false)
 	onLoad(() => {
-		
-		
+
+
 	})
 
 	onShow(() => {
@@ -219,7 +222,7 @@
 		let today = Date.parse(new Date());
 		let startTimestamp = Date.parse(new Date(startTime.value));
 		let endTimestamp = Date.parse(new Date(endTime.value));
-		if(endTimestamp - startTimestamp < 0){
+		if (endTimestamp - startTimestamp < 0) {
 			uni.showToast({
 				icon: 'none',
 				title: '开始日期不能超过结束日期',
@@ -227,7 +230,7 @@
 			})
 			return;
 		}
-		if(today - endTimestamp < 0 || today - startTimestamp < 0){
+		if (today - endTimestamp < 0 || today - startTimestamp < 0) {
 			uni.showToast({
 				icon: 'none',
 				title: '开始或结束日期不能超过今日',
@@ -235,7 +238,7 @@
 			})
 			return;
 		}
-		if(!startTime.value || !endTime.value){
+		if (!startTime.value || !endTime.value) {
 			uni.showToast({
 				icon: 'none',
 				title: '请选择开始或结束日期',
@@ -243,7 +246,7 @@
 			})
 			return;
 		}
-		if(endTimestamp - startTimestamp > 1000 * 60 * 60 * 24 * 30){
+		if (endTimestamp - startTimestamp > 1000 * 60 * 60 * 24 * 30) {
 			uni.showToast({
 				icon: 'none',
 				title: '日期区间最长不超过31天',
@@ -252,7 +255,7 @@
 			return;
 		}
 		show.value = !show.value
-		if(show.value) {
+		if (show.value) {
 			init();
 		}
 	}
@@ -263,7 +266,7 @@
 		});
 		console.log(startTime.value);
 		console.log(endTime.value)
-		getDayWorkItemHistory(startTime.value,endTime.value).then(res => {
+		getDayWorkItemHistory(startTime.value, endTime.value).then(res => {
 			if (res.code == 200) {
 				listData.value = res.rows || [];
 				listDataItem.value = res.rows || [];
@@ -287,52 +290,61 @@
 					}
 					return accumulator;
 				}, {});
-				
-				
-		// 0718
-		for (var i = 0; i < listData.value.length; i++) {
-		  var current = listData.value[i];
-		  var found = false;
-		  var endTimeStatus = "";
-		  for (var j = 0; j < listDaywork.value.length; j++) {
-		    if (listDaywork.value[j].dayworkId === current.dayworkId && listDaywork.value[j].processId === current.processId) {
-		      listDaywork.value[j].qualifiedNum += current.qualifiedNum;
-		      listDaywork.value[j].rejectSum += current.rejectSum;
-			  if(listDaywork.value[j].equipmentDetailCode != null && listDaywork.value[j].equipmentDetailCode != undefined && listDaywork.value[j].equipmentDetailCode != listDaywork.value[j].equipmentDetailCode){
-				  listDaywork.value[j].equipmentDetailCode = listDaywork.value[j].equipmentDetailCode+","+current.equipmentDetailCode
-			  }
-		      found = true;
-		      break;
-		    }
-		  }
-		
-		if (current.status == 3 ) {
-		        endTimeStatus = current.endTime;
-		        
-		      } else  {
-		        endTimeStatus= null;
-		      }
-		  if (!found) {
-		    listDaywork.value.push({
-			  processAlias:current.process.processAlias,
-			  equipmentDetailCode:current.equipmentDetailCode,
-			  lotCode:current.lotCode,
-			  productDescription:current.productDescription,
-			  daywork:current.daywork,
-		      dayworkId: current.dayworkId,
-		      processId: current.processId,
-		      qualifiedNum: current.qualifiedNum,
-		      rejectSum: current.rejectSum,
-		      endTime: endTimeStatus,
-			  adoptStatus:current.adoptStatus == null? null:current.adoptStatus
-			 
-		    });
-		  }
-		}
-		
-		console.log(listData.value);
-		console.log(listDaywork.value);
-				
+
+				var hasEndTime = false
+				// 0718
+				for (var i = 0; i < listData.value.length; i++) {
+					var current = listData.value[i];
+					var found = false;
+					var endTimeStatus = "";
+					for (var j = 0; j < listDaywork.value.length; j++) {
+						if (listDaywork.value[j].dayworkId === current.dayworkId && listDaywork.value[j]
+							.processId === current.processId) {
+							listDaywork.value[j].qualifiedNum += current.qualifiedNum;
+							listDaywork.value[j].rejectSum += current.rejectSum;
+							if (listDaywork.value[j].equipmentDetailCode != null && listDaywork.value[j]
+								.equipmentDetailCode != undefined && listDaywork.value[j].equipmentDetailCode !=
+								listDaywork.value[j].equipmentDetailCode) {
+								listDaywork.value[j].equipmentDetailCode = listDaywork.value[j]
+									.equipmentDetailCode + "," + current.equipmentDetailCode
+							}
+							found = true;
+							break;
+						}
+					}
+
+					if (current.status == 3) {
+						console.log("999")
+						hasEndTime = true
+						endTimeStatus = current.endTime;
+						console.log(endTimeStatus)
+					}
+					if (!hasEndTime && current.status != 3) {
+						console.log("777")
+						endTimeStatus = null;
+					}
+					if (!found && current.status == 3) {
+						console.log()
+						listDaywork.value.push({
+							processAlias: current.process.processAlias,
+							equipmentDetailCode: current.equipmentDetailCode,
+							lotCode: current.lotCode,
+							productDescription: current.productDescription,
+							daywork: current.daywork,
+							dayworkId: current.dayworkId,
+							processId: current.processId,
+							qualifiedNum: current.qualifiedNum,
+							rejectSum: current.rejectSum,
+							endTime: endTimeStatus,
+							adoptStatus: current.adoptStatus == null ? null : current.adoptStatus
+
+						});
+					}
+				}
+
+				console.log(listData.value);
+				console.log(listDaywork.value);
+
 				// 时间下拉
 				// for (let i = 0; i < Object.keys(groupedData).length; i++) {
 				// 	dateList.value[i] = {
@@ -358,12 +370,14 @@
 		})
 	}
 
-	function handleCheckTab(){
+	function handleCheckTab() {
 		editStatus.value = true
 	}
-	function handleCheckTabHis(){
+
+	function handleCheckTabHis() {
 		editStatus.value = false
 	}
+
 	function change() {
 		listDataItem.value = listData.value[selectDate.value]
 	}
@@ -374,49 +388,48 @@
 </script>
 
 <style lang="scss">
-	
 	.time-controls {
 		.title {
-			margin: 20% auto 40% auto; 
-			
+			margin: 20% auto 40% auto;
+
 			.first {
 				font-size: 48rpx;
 				margin: 0 auto;
 			}
-			
+
 			.second {
 				color: red;
 				font-size: 24rpx;
 				margin: 10rpx auto 0 auto;
 			}
 		}
-		
+
 		.sta {
 			justify-content: center;
 			align-items: center;
 			margin-bottom: 48rpx;
-			
+
 			input {
-				border:1rpx solid gray;
+				border: 1rpx solid gray;
 				border-radius: 8rpx;
 				width: 400rpx;
 				height: 64rpx;
 			}
 		}
-		
+
 		.end {
 			justify-content: center;
 			align-items: center;
 			margin-bottom: 64rpx;
-			
+
 			input {
-				border:1rpx solid gray;
+				border: 1rpx solid gray;
 				border-radius: 8rpx;
 				width: 400rpx;
 				height: 64rpx;
 			}
 		}
-		
+
 		button {
 			width: 78%;
 			background-color: #1684fc;
@@ -503,13 +516,14 @@
 
 		}
 	}
+
 	.tab-container {
 		display: flex;
 		flex-direction: row;
 		width: 100%;
 		height: 32px;
 		justify-content: space-around;
-	
+
 		.table-item {
 			display: flex;
 			flex-direction: row;
@@ -520,9 +534,10 @@
 			justify-content: center;
 		}
 	}
+
 	.tab-item.active {
 		color: rgba(25, 137, 250, 1);
-		
+
 		font-weight: 700;
 	}
 </style>

+ 8 - 0
pages/sortingOutsource/form.vue

@@ -617,6 +617,14 @@
 			})
 			return false;
 		}
+		if (dayworkItem.value.qualifiedNum > dayworkItem.value.prodNum) {
+			uni.showToast({
+				icon: 'none',
+				title: "合格数不能超过投产数",
+				duration: 2000
+			})
+			return false;
+		}
 
 		if (dayworkItem.value.qualifiedNum < 0) {
 			uni.showToast({