Просмотр исходного кода

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_app

ezhizao_zx 11 месяцев назад
Родитель
Сommit
47beb3b2c4
2 измененных файлов с 223 добавлено и 29 удалено
  1. 62 5
      pages/batchReporting/index.vue
  2. 161 24
      pages/reportHistory/index.vue

+ 62 - 5
pages/batchReporting/index.vue

@@ -130,6 +130,8 @@
 					<text>{{ index + 1 }}.{{item.processAlias}}</text>
 				</view>
 			</scroll-view>
+			<view><button v-if="!editStatus" class="view-end-btn" type="primary"  @click="handleOpenDrawing">查看本工序图纸</button></view>
+
 		</uni-drawer>
 		<!-- <view v-if="bottomStatus" class="bottom uni-row">
 			<button class="start-batch-btn" type="primary" @click="handleStartNewBatch">开始新批次</button>
@@ -203,7 +205,10 @@
 	const wasteRecyclingList = ref([]) //废品回用批次
 	// 在数据中定义一个变量来控制遮罩层的显示
 	const isMaskShow = ref(false);
-
+	//打开图纸
+	//选中的daywork
+	const currentDaywork = ref({})
+	const editStatus = ref(false)
 	const notPreProcess = ref(true)
 	const curProcessAfte = ref([])
 	const showRight = ref(null) // 抽屉
@@ -360,11 +365,20 @@
 	function handleClickProcessList(item) {
 		let curProcessAfterList = [];
 		console.log("工序列表", item)
-
+		currentDaywork.value = item
+		if(item.isWasteRecycling ==1 || item.isAmend ==1){
+			editStatus.value = true
+		}else{
+			editStatus.value = false
+		}
 		let nextIndex = 0;
 		for (let i = 0; i < item.processSequence.length; i++) {
-			if (item.nextProcess.processStepNumber == item.processSequence[i].processStepNumber) {
-				nextIndex = i;
+			if(item.nextProcess){
+							if (item.nextProcess.processStepNumber == item.processSequence[i].processStepNumber) {
+								nextIndex = i;
+							}
+						}else{
+							nextIndex = item.processSequence.length
 			}
 		}
 		for (let i = 0; i < item.processSequence.length; i++) {
@@ -486,6 +500,15 @@
 					console.log(response)
 					console.log(response.data[0].productionPlanDetailId)
 					console.log(store.planDetails.id)
+					console.log(response.data[0].deptId !== store.curDeptDetails.deptId)
+								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);
@@ -523,7 +546,32 @@
 	function handleDoIt(data) {
 		handleAddDaywork(data);
 	}
-
+	function handleOpenDrawing(){
+		console.log(currentDaywork.value,"444")
+		
+		var filteredProcess = currentDaywork.value.processSequence.filter(item => item.processStepNumber == currentDaywork.value.currentProcess.processStepNumber);
+		
+		// 检查 filteredProcess 是否有元素,并选择第一个元素
+		if (filteredProcess.length > 0) {
+		  var firstMatch = filteredProcess[0]; // 获取第一个匹配的对象
+		
+		  // 对 technologicalProcessDetailId 进行URL编码
+		  var encodedId = encodeURIComponent(firstMatch.technologicalProcessDetailId);
+		  var encodeCode = encodeURIComponent(currentDaywork.value.lotCode);
+		  // 构建查询参数字符串
+		  var queryParam = `param1=${encodedId}&param2=${encodeCode}`;
+		
+		  // 使用模板字符串构建完整的URL
+		  var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
+		
+		  // 导航到指定页面
+		  uni.navigateTo({
+			url: navigateUrl
+		  });
+		} else {
+		  console.log('No process matched the current process step number.');
+		}
+	}
 	function handleDoTurnoverAfter() {
 		reflush();
 	}
@@ -774,6 +822,15 @@
 			border-radius: 8rpx;
 			color: #FFFFFF;
 			font-size: 28rpx;
+					}
+		.view-end-btn {
+			flex: 1;
+			height: 80rpx;
+			line-height: 80rpx;
+			border-radius: 8rpx;
+			color: #FFFFFF;
+			font-size: 28rpx;
+
 		}
 	}
 </style>

+ 161 - 24
pages/reportHistory/index.vue

@@ -14,6 +14,7 @@
 	</view>
 
 	<view v-if="show" class="uni-column container">
+		
 		<view class="uni-row" style="position: fixed;
 		top: 0;width: 100%;
 		height: 120rpx;
@@ -24,19 +25,25 @@
 		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-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>
-			<uni-section title="总数:" type="square" class="uni-row" style="justify-content: center;align-items: center;">
+			</uni-section> -->
+			<!-- <uni-section title="总数:" type="square" class="uni-row" style="justify-content: center;align-items: center;">
 				{{ total }}
 			</uni-section>
 			<uni-section title="条数:" type="square" class="uni-row" style="justify-content: center;align-items: center;">
 				{{ listDataItem.length }}
-			</uni-section>
+			</uni-section> -->
+			<view class="tab-container">
+				<view :class="['tab-item', editStatus === false ? 'active': '']" @click="handleCheckTabHis()">历史报工</view>
+				<view :class="['tab-item', editStatus === true ? 'active': '']" @click="handleCheckTab()">已完成报工</view>
+			</view>
 		</view>
-		<view class="scroll-container">
+		
+		<view class="scroll-container" v-if="!editStatus">
 
 			<view v-for="(item, index) in listDataItem" :key="index" class="list-item">
 				<view class="title-container">
@@ -89,7 +96,62 @@
 				</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">
+						<view class="uni-row">
+							<text class="label">批次号:</text>
+							<text class="label code"> {{ item['lotCode'] }}</text>
+						</view>
+						<!-- <view style="color: #1684fc; margin-right: 0;" @click="handleOpenLonInfo">
+							<text>批次详情</text>
+						</view> -->
+					</view>
+					<view class="uni-row" style="margin: 10rpx 0 0;">
+						<!-- <view class="right-info uni-row"> <text class="label">工时</text>
+							<text class="label time">{{ item['taskTime'] }}</text>
+						</view> -->
+						<view class="right-info uni-row"> <text class="label">工序</text>
+							<text class="label time">{{ item['processAlias'] }}</text>
+						</view>
+						<view class="right-info uni-row" style="margin-left: 50rpx;"> <text class="label">合格数</text>
+							<text class="label number ">{{ item['qualifiedNum'] }}</text>
+						</view>
+					</view>
+				</view>
+				<view class="item-info uni-row">
+					<text class="label">产品描述</text>
+					<text class="label right">{{ item['productDescription'] }}</text>
+				</view>
+				<!-- <view class="item-info uni-row">
+					<text class="label">操作者</text>
+					<text class="label right">{{ item['nickName'] }}</text>
+				</view> -->
+			<!-- 	<view class="item-info uni-row">
+					<text class="label">开始时间</text>
+					<text class="label right">{{ item['startTime'] ? item['startTime'] : '-' }}</text>
+				</view> -->
+				<view class="item-info uni-row">
+					<text class="label">结束时间</text>
+					<text class="label right">{{ item['endTime'] ? item['endTime'] : '-'}}</text>
+				</view>
+				<view class="item-info uni-row">
+					<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>
+			</view>
+		</view>
 	</view>
+	
+	
 	<!-- <dialog-lotInfo ref="lotInfo"></dialog-lotInfo> -->
 </template>
 
@@ -111,7 +173,7 @@
 		toHHmmss
 	} from '@/utils/common.js'
 
-
+	const listDaywork = ref([])
 	const listData = ref([]) // 回显 	
 	const listDataItem = ref([])
 	const lotInfo = ref(null) // 详情弹窗
@@ -121,7 +183,7 @@
 	const startTime = ref('')
 	const endTime = ref('')
 	const total = ref(0)
-
+	const editStatus = ref(false)
 	onLoad(() => {
 		
 		
@@ -192,15 +254,17 @@
 		getDayWorkItemHistory(startTime.value,endTime.value).then(res => {
 			if (res.code == 200) {
 				listData.value = res.rows || [];
+				listDataItem.value = res.rows || [];
+				console.log(listData.value)
 				total.value = res.rows.length;
 				// 时间戳转工时
-				for (var i = 0; i < listData.value.length; i++) {
-					let timeStamp = listData.value[i].workingHours;
-					listData.value[i].taskTime = toHHmmss(timeStamp);
+				for (var i = 0; i < listDataItem.value.length; i++) {
+					let timeStamp = listDataItem.value[i].workingHours;
+					listDataItem.value[i].taskTime = toHHmmss(timeStamp);
 				}
 				// 转为二维数组
-				console.log(listData.value)
-				const groupedData = listData.value.reduce((accumulator, currentItem) => {
+				console.log(listDataItem.value)
+				const groupedData = listDataItem.value.reduce((accumulator, currentItem) => {
 					// 获取当前对象的日期字符串
 					const dateString = currentItem.startTime.split(' ')[0];
 					// 如果有这个日期,则 push 到对应的数组中,否则创建一个新的数组
@@ -211,19 +275,63 @@
 					}
 					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
+		    });
+		  }
+		}
+		
+		console.log(listData.value);
+		console.log(listDaywork.value);
+				
 				// 时间下拉
-				for (let i = 0; i < Object.keys(groupedData).length; i++) {
-					dateList.value[i] = {
-						text: Object.keys(groupedData)[i],
-						value: Object.keys(groupedData)[i]
-					}
-				}
-				listData.value = groupedData;
-				if(dateList.value.length > 0){
-					listDataItem.value = listData.value[dateList.value[0].value]
-					selectDate.value = dateList.value[0].value;
-				}	
-				console.log(groupedData)
+				// for (let i = 0; i < Object.keys(groupedData).length; i++) {
+				// 	dateList.value[i] = {
+				// 		text: Object.keys(groupedData)[i],
+				// 		value: Object.keys(groupedData)[i]
+				// 	}
+				// }
+				// listData.value = groupedData;
+				// if(dateList.value.length > 0){
+				// 	listDataItem.value = listData.value[dateList.value[0].value]
+				// 	selectDate.value = dateList.value[0].value;
+				// }	
+				// console.log(groupedData)
 				uni.hideLoading();
 			} else {
 				uni.showToast({
@@ -236,6 +344,12 @@
 		})
 	}
 
+	function handleCheckTab(){
+		editStatus.value = true
+	}
+	function handleCheckTabHis(){
+		editStatus.value = false
+	}
 	function change() {
 		listDataItem.value = listData.value[selectDate.value]
 	}
@@ -246,6 +360,7 @@
 </script>
 
 <style lang="scss">
+	
 	.time-controls {
 		.title {
 			margin: 20% auto 40% auto; 
@@ -374,4 +489,26 @@
 
 		}
 	}
+	.tab-container {
+		display: flex;
+		flex-direction: row;
+		width: 100%;
+		height: 32px;
+		justify-content: space-around;
+	
+		.table-item {
+			display: flex;
+			flex-direction: row;
+			flex: 1;
+			font-size: 14px;
+			color: #666;
+			align-items: center;
+			justify-content: center;
+		}
+	}
+	.tab-item.active {
+		color: rgba(25, 137, 250, 1);
+		
+		font-weight: 700;
+	}
 </style>