guoyujia пре 1 година
родитељ
комит
64af90c532

+ 4 - 4
components/dialog-selectEquipment/dialog-selectEquipment.vue

@@ -4,12 +4,12 @@
 			<view v-for="(item, index) in equipments" :class="{'item':true,'selected': isSelected(item)}" :key="index"
 				@click="handleSelection(item)"><text class="label">{{item['equipmentDetailCode']}}</text></view>
 		</view> -->
-		<view v-if="showProcessList">
+<!-- 		<view v-if="showProcessList">
 			<uni-section title="工序" type="line">
 				<uni-data-select v-model="selectedProcess" :localdata="processList" :clear="false"
 					@change="handleProcessChange"></uni-data-select>
 			</uni-section>
-		</view>
+		</view> -->
 		<view>
 			<uni-section title="设备" type="line">
 				<uni-data-select v-model="selectedEquipment" :localdata="equipmentList" :clear="false"
@@ -285,7 +285,7 @@
 				/* 20240408 前版本
 				processId: selectedProcess.value,
 				*/
-				technologicalProcessDetailId: selectedProcess.value,
+				technologicalProcessDetailId: store.dayworkInfo.processSequence.filter(v=>v.processStepNumber ==store.dayworkInfo.currentProcess.processStepNumber)[0].technologicalProcessDetailId,
 				processId: store.dayworkInfo.currentProcess.id,
 				equipmentDetailId: selectedEquipment.value.commonId,
 				processStepNumber:store.dayworkInfo.currentProcess.processStepNumber,
@@ -301,7 +301,7 @@
 				/* 20240408 前版本
 				processId: selectedProcess.value,
 				*/
-				technologicalProcessDetailId: selectedProcess.value,
+				technologicalProcessDetailId: store.dayworkInfo.processSequence.filter(v=>v.processStepNumber ==store.dayworkInfo.currentProcess.processStepNumber)[0].technologicalProcessDetailId,
 				processId: store.dayworkInfo.currentProcess.id,
 				// processId: store.dayworkInfo.processSequence.findIndex(v => v.technologicalProcessDetailId === selectedProcess.value) >= 0 ? store.dayworkInfo.processSequence.find(v => v.technologicalProcessDetailId === selectedProcess.value).id : null,
 				equipmentDetailId: selectedEquipment.value.commonId,

+ 1 - 1
components/dialog-selectProduction/dialog-selectProduction.vue

@@ -91,7 +91,7 @@
 			}
 			else {
 				uni.showToast({
-					icon: "error",
+					icon: "none",
 					title: "没有周转到该工段批次",
 					duration: 1000
 				})

+ 65 - 66
pages/addNewBatch/index.vue

@@ -63,9 +63,11 @@
 				<text class='title' style="margin-bottom: 40rpx;">基础信息</text>
 				<view class="uni-row info" style="align-items: center;">
 					<label for="HeatNo">炉号:</label>
-					<uni-data-select id="incomingInfo" class="uni-input data-select" v-model="basicInfo"
+					<uni-data-select v-if="isWasteRecyclingFlag" id="incomingInfo" class="uni-input data-select" v-model="basicInfo"
 						:localdata="furnaceNumberInfoList" :clear="false"
 						@change="handleFurnaceNumberChange"></uni-data-select>
+						<text id="incomingInfo" v-else
+							class="uni-input">废品回用</text>
 				</view>
 				<!-- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view> -->
 				<view class="uni-row info">
@@ -169,9 +171,11 @@
 	const vehicleList = ref([])
 	const basicInfo = ref({}) // 基础信息对象
 	const dayWork = ref({})
+	const furnaceInfo = ref({})
 	const wasteRecyclingList = ref([]) //废品回用批次
 	const curPlan = ref({})
 	const furnaceNumberInfoList = ref([])
+	const isWasteRecyclingFlag = ref(true)
 	const emit = defineEmits(['batchReporting-addBatch']);
 	const inpValue = ref('')
 
@@ -211,6 +215,7 @@
 						store.planDetails.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
 					}
 					getProcessInfo(batchNoList.value[0])
+					getFurnaceInfo(batchNoList.value[0])
 				} else {
 					batchNoList.value = res.rows;
 				}
@@ -227,6 +232,7 @@
 					//如果废品回用的批次领料部门是当前计划的领料部门,则加到lotList
 						lotList.value = res.rows
 						batchNoList.value = [res.rows[0]];
+						isWasteRecyclingFlag.value = false
 						dayWork.value.lotId = batchNoList.value[0].id;
 						dayWork.value.lotCode = batchNoList.value[0].lotCode;
 						if (dayWork.value.technologicalProcessId != batchNoList.value[0].technologicalProcessId) {
@@ -249,70 +255,16 @@
 							duration: 2000
 						})
 					}
+					getFurnaceInfo(batchNoList.value[0])
 				} else {
-					batchNoList.value = res.rows;
+					uni.showToast({
+						icon: "none",
+						title: "没有废品回用或单批单改批次",
+						duration: 2000
+					})
 				}
 			})
 		}
-
-		// 拉取炉号信息from p2
-		let token = 'Bearer ' + getToken();
-		let header = {
-			Authorization: token
-		}
-		uni.request({
-			url: path.furnaceNoURL + '/business/furnaceNoInfo/getFurnaceNoInfo',
-			data: {
-				productionPlanNo: store.planDetails.productionPlanNo,
-				lineNumber: store.planDetails.lineNumber
-			},
-			method: 'GET',
-			header,
-			sslVerify: false,
-			success: (res) => {
-				console.log(res.data);
-				if (res.data.code == 200 && res.data.data.length > 0) {
-					for (let i = 0; i < res.data.data.length; i++) {
-						furnaceNumberInfoList.value[i] = {
-							text: res.data.data[i].furnaceNumber,
-							value: res.data.data[i]
-						}
-					}
-
-					basicInfo.value = res.data.data[0];
-					dayWork.value.furnaceNoInfo = basicInfo.value;
-					console.log(basicInfo.value);
-					console.log(furnaceNumberInfoList.value)
-				}
-			}
-		})
-
-		// getProcessList({
-		// 	deptId: store.curDeptDetails.deptId,
-		// }).then(res => {
-		// 	if (res.code == 200) {
-		// 		//过滤出工序交集
-		// 		//因为废品回用对工序进行单独的修改。所以重新查产品的工艺,如果该批不是废品回用,则查产品工序,如果是,则到
-		// 		//对应表查
-		// 		//通过批次号查
-		// 		console.log(batchNoList.value)
-		// 		 getProcessListByLot(batchNoList.value[0]).then(res => {
-		// 			 let lotProcessList = res.data
-		// 			 let filteredData = lotProcessList.filter((item1) =>
-		// 			 		res.data.some((item2) => item2.processCode === item1.processCode)
-		// 			 	);
-		// 			 	processList.value = filteredData.map(v => ({
-		// 			 		text: v.processAlias,
-		// 			 		value: v.technologicalProcessDetailId,
-		// 			 		processId: v.id
-		// 			     }))
-		// 			 	console.log(processList.value)
-		// 			 	selectedProcess.value = filteredData[0].technologicalProcessDetailId;
-		// 			 	dayWork.value.processId = filteredData[0].id;
-		// 			 	dayWork.value.technologicalProcessDetailId = selectedProcess.value
-		// 		 })
-		// }
-		// })
 	}
 
 	// function handleCheckBatchNo(item) {
@@ -331,7 +283,42 @@
 	// 		return false;
 	// 	}
 	// }
-
+	function getFurnaceInfo(data) {
+		if(data.isWasteRecycling==0) {
+			let token = 'Bearer ' + getToken();
+			let header = {
+				Authorization: token
+			}
+			uni.request({
+				url: path.furnaceNoURL + '/business/furnaceNoInfo/getFurnaceNoInfo',
+				data: {
+					productionPlanNo: store.planDetails.productionPlanNo,
+					lineNumber: store.planDetails.lineNumber
+				},
+				method: 'GET',
+				header,
+				sslVerify: false,
+				success: (res) => {
+					console.log(res.data);
+					if (res.data.code == 200 && res.data.data.length > 0) {
+						for (let i = 0; i < res.data.data.length; i++) {
+							furnaceNumberInfoList.value[i] = {
+								text: res.data.data[i].furnaceNumber,
+								value: res.data.data[i]
+							}
+						}
+			
+						// basicInfo.value = res.data.data[0];
+						// dayWork.value.furnaceNoInfo = basicInfo.value;
+						}
+					}
+			})
+		}else{
+			furnaceInfo.value.furnaceNumber = "废品回用"
+			dayWork.value.furnaceNoInfo = furnaceInfo.value
+			basicInfo.value = dayWork.value.furnaceNoInfo
+		}
+	}
 	function iconClick() {
 		checkLotCode(inpValue.value);
 	}
@@ -347,6 +334,7 @@
 					dayWork.value.lotId = lotList.value[i].id;
 					dayWork.value.lotCode = lotList.value[i].lotCode;
 					if (batchNoList.value.isWasteRecycling == 1) {
+						isWasteRecyclingFlag.value = false
 						uni.showToast({
 							icon: "none",
 							title: "该批次号可用,该批是废品回用",
@@ -401,9 +389,12 @@
 						processStepNumber: v.processStepNumber,
 						index: index
 					}))
-					selectedProcess.value = filteredData[0].technologicalProcessDetailId;
-					dayWork.value.processId = filteredData[0].id;
+					console.log(processList.value)
+					selectedProcess.value = processList.value[0].value;
+					dayWork.value.processId = processList.value[0].processId;
 					dayWork.value.technologicalProcessDetailId = selectedProcess.value
+					dayWork.value.processStepNumber = processList.value.findIndex(v => v.value === selectedProcess.value) >= 0 ?
+						processList.value.find(v => v.value === selectedProcess.value).processStepNumber : null
 				})
 			}
 		})
@@ -478,6 +469,7 @@
 			.value.find(v => v.value === selectedProcess.value).processId : null
 		dayWork.value.processStepNumber = processList.value.findIndex(v => v.value === selectedProcess.value) >= 0 ?
 			processList.value.find(v => v.value === selectedProcess.value).processStepNumber : null
+			dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
 	}
 
 	// function handleScanCode() {
@@ -521,7 +513,7 @@
 	// }
 
 	function handleAdd() {
-		console.log(batchNoList.value)
+		console.log(dayWork.value)
 		if (selectedProcess.value == null) {
 			uni.showToast({
 				icon: 'none',
@@ -529,9 +521,16 @@
 			})
 			return;
 		}
+		if(basicInfo.value ==null) {
+			uni.showToast({
+				icon: 'none',
+				title: '请选择炉号再开始批次'
+			})
+			return;
+		}
 	  dayWork.value.isWasteRecycling = batchNoList.value[0].isWasteRecycling
 	  dayWork.value.isAmend = batchNoList.value[0].isAmend
-	  dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
+	  
 		store.furnaceNumberInfo = basicInfo.value;
 		if (checkLotCode(dayWork.value.lotCode)) {
 			saveDayWork(dayWork.value).then(res => {