mao 1 年間 前
コミット
e9673aed37

+ 8 - 0
api/business/dayWork.js

@@ -52,4 +52,12 @@ export function checkBizDayworkCarriers(data) {
 		method: 'POST',
 		data: data
 	})
+}
+
+export function getAvailableCarrierList(data) {
+	return req.request({
+		url:'/business/daywork/getAvailableCarrierList',
+		method: 'GET',
+		data: data
+	})
 }

+ 101 - 55
components/dialog-selectProduction/dialog-selectProduction.vue

@@ -1,15 +1,14 @@
 <template>
-	<dialog-base class="dialog-body" ref="baseDialog" title="搜索产品">
-		<view class="box-bg uni-row">
-			<view class="input-view uni-row">
-				<uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
-				<input class="nav-bar-input" type="text" v-model="keywords" placeholder="请输入产品描述" />
-			</view>
-			<view class="search" @click="handleSearch">
-				搜索
-			</view>
+	<dialog-base class="dialog-body" ref="baseDialog" title="选择工序查看箱号">
+		<view class="selectedProcess">
+			<uni-section title="选择工序" type="square">
+				<uni-data-select v-model="selectedProcess" :localdata="processList" :clear="false"
+					@change="handleProcessChange"></uni-data-select>
+			</uni-section>
+		</view>
+		<view class="carrierList" v-for="(item,index) in carrierList">
+			<view>{{ item.carrierCode }}</view>
 		</view>
-		
 	</dialog-base>
 </template>
 
@@ -21,17 +20,103 @@
 	import {
 		store
 	} from '../../store';
+	import {
+		getAvailableCarrierList
+	} from '@/api/business/dayWork.js'
+	import {
+		getProcessList
+	} from '@/api/business/deptProcess.js'
 
 	const baseDialog = ref(null)
+	const selectedProcess = ref(0)
+	const processList = ref([])
+	const curProcessId = ref(0)
+	const carrierList = ref([])
 
 	function open() {
-		baseDialog.value.open();
+		reset();
+		// getProcessList({
+		// 	deptId: store.curDeptDetails.deptId
+		// }).then(res => {
+		// 	if (res.code == 200) {
+		// 		//过滤出工序交集
+		// 		let filteredData = store.planDetails.processSequence.filter((item1) =>
+		// 			res.data.some((item2) => item2.processCode === item1.processCode)
+		// 		);
+		// 		for (let i = 0; i < filteredData.length; i++) {
+		// 			processList.value[i] = {
+		// 				text: filteredData[i].processAlias,
+		// 				value: filteredData[i].id
+		// 			}
+		// 		}
+
+		// 		console.log(processList.value)
+		// 	}
+		// 	baseDialog.value.open();
+		// })
+
+		// getAvailableCarrierList(store.planDetails.id, store.curDeptDetails.deptId).then(res => {
+		// 	if (res.code == 200) {
+		// 		carrierList.value = res.data;
+		// 	}
+		// })
+
+		Promise.all([getProcessList({
+			deptId: store.curDeptDetails.deptId
+		}), getAvailableCarrierList({
+			planDetailId: store.planDetails.id,
+			deptId: store.curDeptDetails.deptId
+		})]).then(([res, response]) => {
+			if (res.code == 200) {
+				//过滤出工序交集
+				let filteredData = store.planDetails.processSequence.filter((item1) =>
+					res.data.some((item2) => item2.processCode === item1.processCode)
+				);
+				for (let i = 0; i < filteredData.length; i++) {
+					processList.value[i] = {
+						text: filteredData[i].processAlias,
+						value: filteredData[i].id
+					}
+				}
+
+				console.log(processList.value)
+			}
+			carrierList.value = response.data;
+			baseDialog.value.open();
+		})
 	}
 
 	function close() {
 		baseDialog.value.close()
 	}
 
+	function reset() {
+		selectedProcess.value = 0;
+		processList.value = [];
+		curProcessId.value = 0;
+		carrierList.value = [];
+	}
+
+	function handleProcessChange() {
+		for (let i = 1; i < store.planDetails.processSequence.length; i++) {
+			if (store.planDetails.processSequence[i].id == selectedProcess.value) {
+				curProcessId.value = store.planDetails.processSequence[i - 1].id;
+				console.log(curProcessId.value)
+				break;
+			}
+		}
+		getAvailableCarrierList({
+			planDetailId: store.planDetails.id,
+			deptId: store.curDeptDetails.deptId,
+			proccessId: curProcessId.value
+		}).then(res => {
+			if(res.code == 200){
+				carrierList.value = res.data;
+			}
+			console.log(res)
+		})
+	}
+
 	defineExpose({
 		open
 	})
@@ -39,52 +124,13 @@
 
 <style lang="scss">
 	$nav-height: 60rpx;
-	
+
 	.dialog-body {
-		// height: 60%;
-		// margin: auto auto;
 		overflow: auto;
-	}
-	
-	.box-bg {
-		width: 94%;
-		background-color: #F5F5F5;
-		padding: 5rpx 16rpx;
-		justify-content: space-around;
-		align-items: center;
-		margin: 24rpx auto 0;
-	
-		.input-view {
-			width: 100%;
-			flex: 4;
-			background-color: #f8f8f8;
-			height: $nav-height;
-			border: 1rpx solid #999;
-			border-radius: 15rpx;
-			padding: 0 15rpx;
-			flex-wrap: nowrap;
-			margin: 0 10rpx 0;
-			line-height: $nav-height;
-	
-			.input-uni-icon {
-				line-height: $nav-height;
-			}
-	
-			.nav-bar-input {
-				width: 80%;
-				height: $nav-height;
-				line-height: $nav-height;
-				padding: 0 5rpx;
-				background-color: #f8f8f8;
-			}
-		}
-	
-		.search {
-			width: 20%;
-			text-align: center;
-			color: #808080;
+
+		.selectedProcess {
+			width: 88%;
+			margin: 20rpx auto 40rpx;
 		}
 	}
-	
-
 </style>

+ 58 - 52
pages/batchReporting/index.vue

@@ -88,7 +88,7 @@
 				</view>
 			</view>
 		</view>
-<!-- 		<view v-if="bottomStatus" class="bottom uni-row">
+		<!-- 		<view v-if="bottomStatus" class="bottom uni-row">
 			<button class="start-batch-btn" type="primary" @click="handleStartNewBatch">开始新批次</button>
 		</view>
 		<view v-if="!bottomStatus" class="bottom uni-row">
@@ -98,7 +98,7 @@
 			<button v-if="bottomStatus" class="start-batch-btn" style="margin-right: 10rpx;flex: 1;" type="primary"
 				@click="handleStartNewBatch">开始新批次</button>
 			<button class="start-batch-btn" style="margin-left: 10rpx;flex: 1;" type="primary"
-				@click="handleScanCode">扫一扫开始新批次</button>
+				@click="handleScanCode">查箱号 | 扫码开始批次</button>
 		</view>
 		<dialog-lot ref="lotDialog" @submit="handleDoIt" />
 		<dialog-turnoverApplication ref="turnoverApplicationDialog" @confirm="handleDoTurnoverAfter" />
@@ -195,25 +195,29 @@
 		};
 
 		getDayWorkList(reqData).then(res => {
-			listData.value = res.data;
-
-			// 计算总工时
-			// for (let i = 0; i < listData.value.length; i++) {
-			// 	listData.value[i].totalWorkingHours = 0;
-			// 	if (listData.value[i].dayworkItemList) {
-			// 		for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
-			// 			if (listData.value[i].dayworkItemList[j].status == 2 || listData.value[i].dayworkItemList[
-			// 					j].status == 3) {
-			// 				listData.value[i].totalWorkingHours += Number(listData.value[i].dayworkItemList[j]
-			// 					.workingHours);
-			// 			}
-			// 		}
-			// 		listData.value[i].totalWorkingHours = toHHmmss(listData.value[i].totalWorkingHours);
-			// 	}
-			// }
-
-			console.log(listData.value)
-			uni.hideLoading();
+			if(res.code == 200){
+				listData.value = res.data;
+				
+				// 计算总工时
+				// for (let i = 0; i < listData.value.length; i++) {
+				// 	listData.value[i].totalWorkingHours = 0;
+				// 	if (listData.value[i].dayworkItemList) {
+				// 		for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
+				// 			if (listData.value[i].dayworkItemList[j].status == 2 || listData.value[i].dayworkItemList[
+				// 					j].status == 3) {
+				// 				listData.value[i].totalWorkingHours += Number(listData.value[i].dayworkItemList[j]
+				// 					.workingHours);
+				// 			}
+				// 		}
+				// 		listData.value[i].totalWorkingHours = toHHmmss(listData.value[i].totalWorkingHours);
+				// 	}
+				// }
+				
+				console.log(res)
+				uni.hideLoading();
+			}else {
+				uni.hideLoading();
+			}
 		})
 	}
 
@@ -230,40 +234,42 @@
 
 	function handleScanCode() {
 		uni.showModal({
-			title: '提示',
-			content: '点击确认搜索产品,点击取消继续扫码',
-			success: function (res) {
-					if (res.confirm) {
-						selectProduction.value.open();
-					} else if (res.cancel) {
-						uni.scanCode({
-							scanType: ['qrCode'],
-							onlyFromCamera: true, // 只允许相机扫码
-							autoZoom: false,
-							success: function(res) {
-								console.log(res.result)
-								let vehicleObj = JSON.parse(res.result);
-								if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
-									uni.showToast({
-										icon: "error",
-										title: "请扫载具码",
-										duration: 1000
-									})
-									return;
-								}
-								showDaywork({
-									carrierId: vehicleObj.carrierId,
-									status: 7
-								}).then(response => {
-									if (response.code == 200) {
-										console.log(response)
-										lotDialog.value.open(response.data);
-									}
+			title: '扫一扫开始新批次',
+			confirmText: '查看箱号', //这块是确定按钮的文字
+			cancelText: '扫码', //这块是取消的文字
+			cancelColor:'#1684fc',//删除按钮颜色
+			success: function(res) {
+				if (res.confirm) {
+					selectProduction.value.open();
+				} else if (res.cancel) {
+					uni.scanCode({
+						scanType: ['qrCode'],
+						onlyFromCamera: true, // 只允许相机扫码
+						autoZoom: false,
+						success: function(res) {
+							console.log(res.result)
+							let vehicleObj = JSON.parse(res.result);
+							if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
+								uni.showToast({
+									icon: "error",
+									title: "请扫载具码",
+									duration: 1000
 								})
+								return;
 							}
-						});
-					}
+							showDaywork({
+								carrierId: vehicleObj.carrierId,
+								status: 7
+							}).then(response => {
+								if (response.code == 200) {
+									console.log(response)
+									lotDialog.value.open(response.data);
+								}
+							})
+						}
+					});
 				}
+			}
 		})
 	}