guoyujia 3 kuukautta sitten
vanhempi
commit
7aa8958927

+ 8 - 1
api/dict/dict.js

@@ -6,7 +6,14 @@ import req from '../../utils/request.js'
  */
 export function getDictInfoByType(data) {
 	return req.request({
-		url:'/system/dict/data/type/' + data,
+		url: '/system/dict/data/type/' + data,
 		method: 'GET',
 	})
 }
+export function getDictInfoByTypes(data) {
+	return req.request({
+		url: '/system/dict/data/dictTypes',
+		method: 'POST',
+		data: data
+	})
+}

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

@@ -125,7 +125,7 @@
 						specialDeptProcessList.value[i] = res.data[i].processId;
 					}
 					for (let i = 0; i < response.rows.length; i++) {
-						if (response.rows[i].processId == workInfo.value.processId) {
+						if (response.rows[i].processStepNumber == workInfo.value.processStepNumber) {
 							lotPreSumReject.value += response.rows[i].rejectSum;
 							lotPreSumQualifiedNum.value += response.rows[i].qualifiedNum;
 						}

+ 45 - 13
components/dialog-end-work/dialog-end-work.vue

@@ -27,6 +27,11 @@
 				<switch class="switch" @change="switchChange" color="rgba(103, 195, 55, 1.0)" />
 				<text>是</text>
 			</view>
+			<view class="list-title uni-row" v-if="workInfo.status == 3">
+				<text class="label">废品损失率</text>
+				<view class="uni-row" style="justify-content: flex-end;"><text class="label">{{rejectRatio}}</text>
+				</view>
+			</view>
 			<view v-if="showCarrierList && !store.isPreProcess" class="confirmCarrier">
 				<text class="label">确认载具</text>
 				<view class="vehicleList uni-row">
@@ -86,11 +91,15 @@
 		listItem,
 		getIsFirstOrder,
 	} from '@/api/business/dayWorkItem.js'
+	import {
+		Decimal
+	} from 'decimal.js'
 
 	const baseDialog = ref(null)
 	const workInfo = ref({})
 	const showQrCodeReader = ref(false);
 	const wasteInfo = ref([])
+	const qualifiedNumRatio = ref(1)
 	const reasonList = ref([])
 	const emit = defineEmits(['resflushItem'])
 	const showCarrierList = ref(false) // 工序是否完成显示载具列表
@@ -98,6 +107,7 @@
 	const confirmCarrierList = ref([])
 	const isFirstOrder = ref(true); //是否为首序
 	const endFlag = ref(0)
+	const rejectRatio = ref(0)
 	const isLoading = ref(false);
 	const specialDeptProcessList = ref([])
 	const temp = ref(0) // 保存workInfo.value.qualifiedNum的值(还原用)
@@ -115,6 +125,8 @@
 			...data,
 		};
 		console.log("数据data", workInfo);
+		//获取报工数量限制
+		getReportLimit()
 		//查看是否为首序
 		getIsFirst(store.dayworkInfo.id);
 		workInfo.value.qualifiedNum = 0;
@@ -128,7 +140,7 @@
 						specialDeptProcessList.value[i] = res.data[i].processId;
 					}
 					for (let i = 0; i < response.rows.length; i++) {
-						if (response.rows[i].processId == workInfo.value.processId) {
+						if (response.rows[i].processStepNumber == workInfo.value.processStepNumber) {
 							lotPreSumReject.value += response.rows[i].rejectSum;
 							lotPreSumQualifiedNum.value += response.rows[i].qualifiedNum;
 						}
@@ -155,6 +167,17 @@
 		baseDialog.value.open()
 	}
 
+	function getReportLimit() {
+		getDictInfoByType("report_up_limit").then(res => {
+			if (res.data && res.data.length > 0) {
+				qualifiedNumRatio.value = parseInt(res.data[0].dictValue)
+			}
+		}).catch(err => {
+			console.log(err)
+			console.log('369 err')
+		})
+	}
+
 	function close() {
 		baseDialog.value.close()
 	}
@@ -223,6 +246,16 @@
 
 	function handleInputQualifiedNum() {
 		workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^-+|[^\d]/g, '');
+		let temQualifiedNum = workInfo.value.qualifiedNum
+		if (workInfo.value.qualifiedNum === null || workInfo.value.qualifiedNum === '') {
+			temQualifiedNum = 0
+		}
+		//计算损失率
+		let sunm = parseInt(temQualifiedNum) + lotPreSumQualifiedNum.value; //计算总合格数
+		rejectRatio.value = (((parseInt(workInfo.value.prodNum) - sunm) / parseInt(workInfo.value.prodNum)) *
+			100).toFixed(2) + '%';
+		console.log(((parseInt(temQualifiedNum) - sunm) / parseInt(temQualifiedNum)) *
+			100)
 	}
 
 	function handleInputRejectNum(item) {
@@ -393,17 +426,15 @@
 			.processQualifiedNum;
 		workInfo.value.prodNum = number
 
-		let max = parseInt(number * 1.03);
-		// max = parseInt(String(max).split("."));
-		console.log("maxawdjkkaljdalkw", max);
+		let max = parseInt(number * (qualifiedNumRatio.value / 100));
 		let sunm = parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value; //计算总合格数
-		let percent = (sunm / number) * 100; //合格率
-
-		percent = Math.ceil(percent * 100) / 100; //只入不舍
+		let percent = new Decimal(sunm).div(number).mul(100); // 使用 Decimal.js 计算
+		// 保留两位小数
+		percent = percent.toDecimalPlaces(2, Decimal.ROUND_DOWN).toString();
 		console.log("合格量", percent)
 		// let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(2);
 
-		let num = 103;
+		let num = qualifiedNumRatio.value;
 		// 填入数大于剩余量情况
 		if (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number > 0) {
 			// 判断当前是否为首序
@@ -420,6 +451,7 @@
 				})
 			} else {
 				if (percent > num) {
+					console.log("999")
 					uni.showToast({
 						icon: 'none',
 						title: '合格数总量为投产量的' + percent + "%,请重新输入!"
@@ -430,7 +462,6 @@
 				}
 			}
 		} 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) {
@@ -451,12 +482,12 @@
 		let number = workInfo.value.prodNum;
 		let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(
 			2);
-		let num = 103;
+		let num = qualifiedNumRatio.value;
 		//lotPreSumQualifiedNum当前序的所有合格数
 		if (parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value - number > 0) {
 			if (isFirstOrder.value) {
-				if (percent == 103) {
-					percent = 103.1
+				if (percent == qualifiedNumRatio.value) {
+					percent = qualifiedNumRatio.value
 				}
 				uni.showModal({
 					title: '提示',
@@ -482,9 +513,10 @@
 				})
 			} else {
 				if (percent == num) {
-					percent = 103.01
+					percent = qualifiedNumRatio.value
 				}
 				if (percent > num) {
+					console.log("888")
 					uni.showToast({
 						icon: 'none',
 						title: '合格数总量为投产量的' + percent + "%,请重新输入!"

+ 10 - 3
components/dialog-lotInfo/dialog-lotInfo.vue

@@ -26,11 +26,11 @@
 					class="label right">{{lotData['processQualifiedNum'] == 0 ? lotData['productionQuantity'] : lotData['processQualifiedNum']}}</text>
 			</view>
 			<view class="item-info uni-row">
-				<text class="label">上道工序</text>
+				<text class="label">已完成工序</text>
 				<text class="label right">{{ lotData.prevProcess ? lotData['prevProcess'].processAlias : '-'}}</text>
 			</view>
 			<view class="item-info uni-row">
-				<text class="label">当前工序</text>
+				<text class="label">待加工工序</text>
 				<text
 					class="label right">{{ lotData.currentProcess ? lotData['currentProcess'].processAlias : '-'}}</text>
 			</view>
@@ -40,7 +40,7 @@
 			</view>
 			<view class="item-info uni-row">
 				<text class="label">所在区域</text>
-				<text class="label right">{{ lotData['place'] ? lotData['place'] : '-' }}</text>
+				<text class="label right">{{ getPlaceText(lotData) }}</text>
 			</view>
 			<view class='middle'>
 				<view class='segment'></view>
@@ -139,6 +139,13 @@
 		})
 	}
 
+	function getPlaceText(item) {
+		let place = item.dayworkItemList[0].place == "" ? item.dayworkItemList[0].turnoverArea == "" ?
+			'-' : '默认周转区' : item.dayworkItemList[0].place
+		let deptName = item.dayworkItemList[0].deptName
+		return place == "-" ? deptName == "" ? "-" : deptName : deptName + "-" + place
+	}
+
 	function close() {
 		baseDialog.value.close()
 	}

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
 	"name": "(测试)德迈仕数字生产管理平台",
 	"appid": "__UNI__54D8B02",
 	"description": "",
-	"versionName": "1.0.37",
-	"versionCode": 137,
+	"versionName": "1.0.45",
+	"versionCode": 45,
 	"transformPx": false,
 	/* 5+App特有相关 */
 	"app-plus": {

+ 1 - 0
package.json

@@ -1,5 +1,6 @@
 {
   "dependencies": {
+    "decimal.js": "^10.5.0",
     "vue3-qr-reader": "^1.0.0",
     "vuex": "^4.1.0"
   }

+ 10 - 3
pages/assistDaywork/index.vue

@@ -76,11 +76,11 @@
 						class="label right">{{ item.prevProcess == null ? item['productionQuantity']  : item['processQualifiedNum']}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">上道工序</text>
+					<text class="label">已完成工序</text>
 					<text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">当前工序</text>
+					<text class="label">待加工工序</text>
 					<!-- <text
 						class="label right">{{ item.currentProcess ? item.prevProcess && item['currentProcess'].processAlias == item['prevProcess'].processAlias ? '-' : item['currentProcess'].processAlias : '-'}}</text> -->
 					<text
@@ -100,7 +100,7 @@
 				</view>
 				<view v-if="notPreProcess" class="item-info uni-row">
 					<text class="label">所在区域</text>
-					<text class="label right">{{ item['place'] ? item['place'] : '-' }}</text>
+					<text class="label right">{{ getPlaceText(item) }}</text>
 				</view>
 				<view
 					v-if="item['dayworkItemList'] && item['dayworkItemList'].length >0 && item['dayworkItemList'][0].status >3"
@@ -275,6 +275,13 @@
 		init();
 	}
 
+	function getPlaceText(item) {
+		let place = item.dayworkItemList[0].place == "" ? item.dayworkItemList[0].turnoverArea == "" ?
+			'-' : '默认周转区' : item.dayworkItemList[0].place
+		let deptName = item.dayworkItemList[0].deptName
+		return place == "-" ? deptName == "" ? "-" : deptName : deptName + "-" + place
+	}
+
 	function qrReaderClose() {
 		showQrCodeReader.value = false;
 	}

+ 10 - 3
pages/batchReporting/index.vue

@@ -71,11 +71,11 @@
 						class="label right">{{ item.prevProcess == null ? item['productionQuantity']  : item['processQualifiedNum']}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">上道工序</text>
+					<text class="label">已完成工序</text>
 					<text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">当前工序</text>
+					<text class="label">待加工工序</text>
 					<!-- <text
 						class="label right">{{ item.currentProcess ? item.prevProcess && item['currentProcess'].processAlias == item['prevProcess'].processAlias ? '-' : item['currentProcess'].processAlias : '-'}}</text> -->
 					<text
@@ -95,7 +95,7 @@
 				</view> -->
 				<view v-if="notPreProcess" class="item-info uni-row">
 					<text class="label">所在区域</text>
-					<text class="label right">{{ item['place'] ? item['place'] : '-' }}</text>
+					<text class="label right">{{ getPlaceText(item) }}</text>
 				</view>
 				<view
 					v-if="item['dayworkItemList'] && item['dayworkItemList'].length >0 && item['dayworkItemList'][0].status >3"
@@ -273,6 +273,13 @@
 
 	})
 
+	function getPlaceText(item) {
+		let place = item.dayworkItemList[0].place == "" ? item.dayworkItemList[0].turnoverArea == "" ?
+			'-' : '默认周转区' : item.dayworkItemList[0].place
+		let deptName = item.dayworkItemList[0].deptName
+		return place == "-" ? deptName == "" ? "-" : deptName : deptName + "-" + place
+	}
+
 	// 页面下拉刷新操作
 	onPullDownRefresh(() => {
 		uni.stopPullDownRefresh();

+ 10 - 3
pages/batchReportingOutsource/index.vue

@@ -70,11 +70,11 @@
 						class="label right">{{ item.prevProcess == null ? item['productionQuantity']  : item['processQualifiedNum']}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">上道工序</text>
+					<text class="label">已完成工序</text>
 					<text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">当前工序</text>
+					<text class="label">待加工工序</text>
 					<!-- <text
 						class="label right">{{ item.currentProcess ? item.prevProcess && item['currentProcess'].processAlias == item['prevProcess'].processAlias ? '-' : item['currentProcess'].processAlias : '-'}}</text> -->
 					<text
@@ -94,7 +94,7 @@
 				</view> -->
 				<view v-if="notPreProcess" class="item-info uni-row">
 					<text class="label">所在区域</text>
-					<text class="label right">{{ item['place'] ? item['place'] : '-' }}</text>
+					<text class="label right">{{ getPlaceText(item) }}</text>
 				</view>
 				<view
 					v-if="item['dayworkItemList'] && item['dayworkItemList'].length >0 && item['dayworkItemList'][0].status >3"
@@ -280,6 +280,13 @@
 		init(store.planDetails.id);
 	}
 
+	function getPlaceText(item) {
+		let place = item.dayworkItemList[0].place == "" ? item.dayworkItemList[0].turnoverArea == "" ?
+			'-' : '默认周转区' : item.dayworkItemList[0].place
+		let deptName = item.dayworkItemList[0].deptName
+		return place == "-" ? deptName == "" ? "-" : deptName : deptName + "-" + place
+	}
+
 	function handleShowTurnoverApplication(data) {
 		console.log(data)
 		//如果这批废了,则不能周转申请

+ 58 - 5
pages/notification/index.vue

@@ -2,8 +2,17 @@
 	<view class="informantion_mask">
 		<view class="informantion_content" @tap.stop.prevent>
 			<view class="informantion-title">
-				<p class="informantion-title-p">公告</p>
-				<span class="informantion-title-span">{{message}}</span>
+				<view>
+					<view @click="showCloseempty" style="height: 10%;">
+						<p class="informantion-title-p">公告</p>
+					</view>
+					<view v-if="showClose >2" class="close-btn uni-column">
+						<uni-icons class="icon-gear" type="closeempty" size="30" style="z-index: 5;"
+							@click="close"></uni-icons>
+					</view>
+				</view>
+				<div v-html="message" class="informantion-title-span"></div>
+				<!-- {{message}} -->
 			</view>
 
 		</view>
@@ -12,8 +21,6 @@
 
 <script setup>
 	import {
-		normalizeProps,
-		reactive,
 		onMounted,
 		ref,
 		getCurrentInstance
@@ -23,13 +30,15 @@
 		onReady,
 		onUnload,
 		onShow,
-		onReachBottom
+		onReachBottom,
+
 	} from '@dcloudio/uni-app'
 
 	import {
 		store
 	} from '@/store/index.js'
 	const message = ref('')
+	const showClose = ref(0)
 	onMounted(() => {
 		uni.hideLoading();
 		const instance = getCurrentInstance().proxy
@@ -43,6 +52,29 @@
 		})
 
 	})
+
+
+	function showCloseempty() {
+		showClose.value += 1
+	}
+
+	function close() {
+		store.isNotification = true
+		let pages = getCurrentPages();
+		let index = 0
+		for (let i = pages.length - 1; i >= 0; i--) {
+
+			if (pages[i].$page.fullPath != "/pages/notification/index") {
+
+				index = pages.length - i - 1;
+				break
+			}
+		}
+		uni.navigateBack({
+			delta: index
+		});
+		console.log(pages)
+	}
 </script>
 
 <style lang="scss">
@@ -64,6 +96,7 @@
 	.informantion_content {
 		width: 600rpx;
 		height: 820rpx;
+		// height: 70%;
 		overflow: hidden;
 		border-radius: 10rpx;
 		background-color: white;
@@ -73,6 +106,12 @@
 		padding-bottom: 20rpx;
 	}
 
+	.informantion-title-span {
+		height: 82%;
+		overflow: auto;
+		margin-bottom: -20px;
+	}
+
 	.mask-header {
 		height: 400rpx;
 		position: relative;
@@ -89,7 +128,21 @@
 		}
 	}
 
+	.close-btn {
+		position: absolute;
+		right: 24rpx;
+		top: 24rpx;
+		width: 40rpx;
+		height: 40rpx;
+		z-index: 1003;
+
+		.close-btn-icon {
+			width: 40rpx;
+		}
+	}
+
 	.informantion-title {
+		overflow: auto;
 		text-align: center;
 		padding: 0 40rpx;
 

+ 15 - 2
pages/queryLotInfo/index.vue

@@ -38,12 +38,12 @@
 						<text class="label right">{{ lotData['totalQuantityNum']}}</text>
 					</view>
 					<view class="item-info uni-row">
-						<text class="label">上道工序:</text>
+						<text class="label">已完成工序:</text>
 						<text
 							class="label right">{{ lotData.prevProcess && lotData['prevProcess'] != "" ? lotData['prevProcess'].processAlias : '-'}}</text>
 					</view>
 					<view class="item-info uni-row">
-						<text class="label">当前工序:</text>
+						<text class="label">待加工工序:</text>
 						<view class="label right uni-row">
 							<text
 								class="label right">{{ lotData.currentProcess && lotData['currentProcess'] != "" ? lotData['currentProcess'].processAlias : '-'}}</text>
@@ -71,6 +71,10 @@
 						<text
 							class="label right">{{ lotData['status'] == 1 ?"进行中":lotData['status'] == 3?"周转中":lotData['status'] == 2?"待领取":lotData['status'] == 4?"已送达":lotData['status'] == 5?"已完成":"未开始"}}</text>
 					</view>
+					<view class="item-info uni-row">
+						<text class="label">所在区域:</text>
+						<text class="label right">{{getPlaceText(lotData)}}</text>
+					</view>
 				</view>
 			</view>
 			<!-- 领料信息 -->
@@ -664,6 +668,15 @@
 			});
 		}
 	}
+
+	function getPlaceText(item) {
+		let place = item.dayworkItemList[item.dayworkItemList.length - 1].place == "" ? item.dayworkItemList[item
+				.dayworkItemList.length - 1].turnoverArea == "" ?
+			'-' : '默认周转区' : item.dayworkItemList[item
+				.dayworkItemList.length - 1].place
+		let deptName = item.dayworkItemList[item.dayworkItemList.length - 1].deptName
+		return place == "-" ? deptName == "" ? "-" : deptName : deptName + "-" + place
+	}
 	const handleScrollToUpper = () => {
 		isActiveId.value = 1
 	}

+ 9 - 4
pages/sortBatchInnerReporting/index.vue

@@ -67,11 +67,11 @@
 						class="label right">{{item.prevProcess == null ?  item['productionQuantity']  : item['processQualifiedNum']}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">上道工序</text>
+					<text class="label">已完成工序</text>
 					<text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">当前工序</text>
+					<text class="label">待加工工序</text>
 					<!-- <text
 						class="label right">{{ item.currentProcess ? item.prevProcess && item['currentProcess'].processAlias == item['prevProcess'].processAlias ? '-' : item['currentProcess'].processAlias : '-'}}</text> -->
 					<text class="label right">{{ item.currentProcess ?item['currentProcess'].processAlias : '-'}}</text>
@@ -89,7 +89,7 @@
 				</view> -->
 				<view v-if="notPreProcess" class="item-info uni-row">
 					<text class="label">所在区域</text>
-					<text class="label right">{{ item['place'] ? item['place'] : '-' }}</text>
+					<text class="label right">{{ getPlaceText(item) }}</text>
 				</view>
 				<view class="status-btn uni-row">
 					<view v-if="item.dayworkItemList[0].status < 3" class=" uni-row">
@@ -250,7 +250,12 @@
 		console.log(wasteRecyclingList.value.length)
 	})
 
-
+	function getPlaceText(item) {
+		let place = item.dayworkItemList[0].place == "" ? item.dayworkItemList[0].turnoverArea == "" ?
+			'-' : '默认周转区' : item.dayworkItemList[0].place
+		let deptName = item.dayworkItemList[0].deptName
+		return place == "-" ? deptName == "" ? "-" : deptName : deptName + "-" + place
+	}
 	/**	
 	 * 监听下拉刷新
 	 */

+ 9 - 3
pages/sortBatchReporting/index.vue

@@ -67,11 +67,11 @@
 						class="label right">{{item.prevProcess == null ?  item['productionQuantity']  : item['processQualifiedNum']}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">上道工序</text>
+					<text class="label">已完成工序</text>
 					<text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
 				</view>
 				<view class="item-info uni-row">
-					<text class="label">当前工序</text>
+					<text class="label">待加工工序</text>
 					<!-- <text
 						class="label right">{{ item.currentProcess ? item.prevProcess && item['currentProcess'].processAlias == item['prevProcess'].processAlias ? '-' : item['currentProcess'].processAlias : '-'}}</text> -->
 					<text class="label right">{{ item.currentProcess ?item['currentProcess'].processAlias : '-'}}</text>
@@ -89,7 +89,7 @@
 				</view> -->
 				<view v-if="notPreProcess" class="item-info uni-row">
 					<text class="label">所在区域</text>
-					<text class="label right">{{ item['place'] ? item['place'] : '-' }}</text>
+					<text class="label right">{{ getPlaceText(item) }}</text>
 				</view>
 				<view class="status-btn uni-row">
 					<view v-if="item.dayworkItemList[0].status < 3" class=" uni-row">
@@ -252,6 +252,12 @@
 		console.log(wasteRecyclingList.value.length)
 	})
 
+	function getPlaceText(item) {
+		let place = item.dayworkItemList[0].place == "" ? item.dayworkItemList[0].turnoverArea == "" ?
+			'-' : '默认周转区' : item.dayworkItemList[0].place
+		let deptName = item.dayworkItemList[0].deptName
+		return place == "-" ? deptName == "" ? "-" : deptName : deptName + "-" + place
+	}
 
 	/**	
 	 * 监听下拉刷新

+ 143 - 34
pages/sorting/form.vue

@@ -178,7 +178,7 @@
 		getTakeStockPeriod
 	} from '@/api/business/taksStackLot.js'
 	import {
-		getDictInfoByType
+		getDictInfoByTypes
 	} from '@/api/dict/dict.js'
 	import {
 		onLoad,
@@ -199,6 +199,7 @@
 	const consultations = ref([])
 	const dayworkInfo = ref({})
 	const retrievalInfo = ref([])
+	const qualifiedNumDownRatio = ref(0)
 	// 创建一个引用来存储最后一次请求的时间戳
 	const lastRequestTimestamp = ref(0);
 	const selectTypeList = ref([])
@@ -207,7 +208,7 @@
 	const saveFlag = ref(false)
 	const storageNum = ref('')
 	const storageInfo = ref(null)
-	const qualifiedNumRatio = ref(0)
+	const qualifiedNumUpRatio = ref(0)
 	const isFinish = ref(false)
 	const column1 = [{
 			name: 'lotCode',
@@ -281,27 +282,44 @@
 
 	/***************************** 定义了一些方法 *****************************/
 	const init = (data) => {
+		let dics = ['sort_report_up_limit', 'sort_report_down_limit', 'select_type']
 		//获取当前跟选报工合格数最大值
-		// 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')
-		// })
-		//获取选别类型
-		getDictInfoByType("select_type").then(res => {
-			console.log(res.data && res.data.length > 0)
-			selectTypeList.value = res.data.map(v => {
-				return {
-					value: v.dictValue,
-					text: v.dictLabel
-				};
-			});
-		})
-		console.log("dayworkInfo", dayworkInfo.value);
+		getDictInfoByTypes(dics).then(res => {
+			console.log(res.data);
+
+			if (res.data) {
+				// 遍历返回的 Map 对象
+				Object.entries(res.data).forEach(([key, list]) => {
+					if (list && list.length > 0) {
+						// 根据 key 的名称,将 value 存储到对应的数组中
+						list.forEach(item => {
+							switch (key) {
+								case 'sort_report_up_limit':
+									qualifiedNumUpRatio.value = item.dictValue;
+									break;
+								case 'sort_report_down_limit':
+									qualifiedNumDownRatio.value = item.dictValue;
+									break;
+								case 'select_type':
+									selectTypeList.value.push({
+										value: item.dictValue,
+										text: item.dictLabel
+									})
+
+									break;
+							}
+						});
+					}
+				});
+
+				console.log('sortReportUpLimitValues:', qualifiedNumUpRatio.value);
+				console.log('sortReportDownLimitValues:', qualifiedNumDownRatio.value);
+				console.log('selectTypeValues:', selectTypeList.value);
+			}
+		}).catch(err => {
+			console.log(err);
+			console.log('369 err');
+		});
 		// 获取当前报工信息
 		getSortingDayworkItem(data).then(res => {
 			console.log(res)
@@ -596,6 +614,77 @@
 			return item.result
 		}
 	}
+	const promiseDownModal = () => new Promise((resolve) => {
+		uni.showModal({
+			title: '提示',
+			content: `合格数过低,最低应为投产量的${qualifiedNumDownRatio.value}%, 是否确定保存`,
+			showCancel: true,
+			cancelText: '取消',
+			confirmText: '确定',
+			confirmColor: '#ff0000',
+			cancelColor: '#55aa00',
+			complete: (res) => { // 使用 complete 回调
+				console.log("Modal complete callback triggered:", res);
+				if (res.confirm) {
+					resolve(true);
+				} else {
+					resolve(false);
+				}
+			}
+		});
+	});
+	const promiseUpModal = () => new Promise((resolve) => {
+		uni.showModal({
+			title: '提示',
+			content: `合格数过高,最高应为投产量的${qualifiedNumUpRatio.value}%, 是否确定保存`,
+			showCancel: true,
+			cancelText: '取消',
+			confirmText: '确定',
+			confirmColor: '#ff0000',
+			cancelColor: '#55aa00',
+			complete: (res) => { // 使用 complete 回调
+				console.log("Modal complete callback triggered:", res);
+				if (res.confirm) {
+					resolve(true);
+				} else {
+					resolve(false);
+				}
+			}
+		});
+	});
+
+	const validDownNum = async () => {
+		// 只在结束报工的时候判断
+		if (isFinish.value && dayworkItem.value.qualifiedNum < (dayworkItem.value.prodNum * (qualifiedNumDownRatio
+				.value / 100))) {
+			try {
+				const promiseDown = await promiseDownModal(); // 等待用户确认或取消
+				console.log(promiseDown);
+				return promiseDown; // 返回用户的选择
+			} catch (error) {
+				console.log("用户取消操作", error);
+				return false; // 用户取消,返回 false
+			}
+		} else {
+			return true; // 合格数正常,直接返回 true
+		}
+	};
+	const validUpNum = async () => {
+		// 只在结束报工的时候判断
+		if (isFinish.value && dayworkItem.value.qualifiedNum > (dayworkItem.value.prodNum * (qualifiedNumUpRatio
+				.value / 100))) {
+			try {
+				const promiseUp = await promiseUpModal(); // 等待用户确认或取消
+				console.log(promiseUp);
+				return promiseUp; // 返回用户的选择
+			} catch (error) {
+				console.log("用户取消操作", error);
+				return false; // 用户取消,返回 false
+			}
+		} else {
+			return true; // 合格数正常,直接返回 true
+		}
+	};
 
 	const showStatusColor = (status) => {
 		// console.log(status)
@@ -620,7 +709,7 @@
 		console.log(dayworkItem.value)
 	}
 
-	const validHandle = () => {
+	const validHandle = async () => {
 		console.log(storageNum.value == "")
 		if (storageNum.value != null && storageNum.value != "" && storageNum.value <= 0) {
 			uni.showToast({
@@ -630,7 +719,8 @@
 			})
 			return false;
 		}
-		if (storageNum.value != null && storageNum.value != "" && storageNum.value > 0 && storageNum.value > 0 && type
+		if (storageNum.value != null && storageNum.value != "" && storageNum.value > 0 && storageNum.value > 0 &&
+			type
 			.value == null) {
 			uni.showToast({
 				icon: 'none',
@@ -674,15 +764,33 @@
 			})
 			return false;
 		}
-		//只在结束报工的时候判断
-		// if(isFinish.value &&dayworkItem.value.qualifiedNum > (dayworkItem.value.prodNum * (qualifiedNumRatio.value/100))){
-		// 	uni.showToast({
-		// 		icon: 'none',
-		// 		title: "合格数不能超过投产量的"+qualifiedNumRatio.value+"%",
-		// 		duration: 2000
-		// 	})
-		// 	return false;
-		// }
+		if (isFinish.value && dayworkItem.value.qualifiedNum > (dayworkItem.value.prodNum * (qualifiedNumUpRatio
+				.value / 100))) {
+			// let flag = await validUpNum()
+			// if (!flag) {
+			// 	return false
+			// }
+			uni.showToast({
+				icon: 'none',
+				title: `合格数过高,最高应为投产量的${qualifiedNumUpRatio.value}%`,
+				duration: 2000
+			})
+			return false;
+		}
+		if (isFinish.value && dayworkItem.value.qualifiedNum < (dayworkItem.value.prodNum * (qualifiedNumDownRatio
+				.value / 100))) {
+			console.log("666")
+			let flag = await validDownNum()
+			if (!flag) {
+				return false
+			}
+			// uni.showToast({
+			// 	icon: 'none',
+			// 	title: `合格数过低,最低应为投产量的${qualifiedNumDownRatio.value}%`,
+			// 	duration: 2000
+			// })
+			// return false;
+		}
 		return true
 		// unfitInfos.value.forEach((e, i) => {
 		// 	if (e.name)
@@ -722,7 +830,8 @@
 
 	async function handleFinishDaywork() {
 		isFinish.value = true
-		if (!validHandle()) {
+		const res = await validHandle()
+		if (!res) {
 			return
 		}
 		//判断当前批次是否在盘点,如果盘点未结束,则不能结束报工

+ 3 - 3
store/index.js

@@ -15,9 +15,9 @@ export const store = reactive({
 	normalStatus: true,
 	processInspection: null,
 	outsourcedCode: null,
-	takeStockDetails:null,
-	isReviewer:false,
-
+	takeStockDetails: null,
+	isReviewer: false,
+	isNotification: false,
 	itemStatus: {
 		/**
 		 *  待周转

+ 1 - 1
utils/request.js

@@ -89,7 +89,7 @@ function preRequest() {
 			method: 'GET',
 			success: (res) => {
 				console.log(res)
-				if (res.data.code == 200) {
+				if (res.data.code == 200 && !store.isNotification) {
 					uni.navigateTo({
 						url: "/pages/notification/index",
 						success: (resqust) => {