ezhizao_zx 10 月之前
父節點
當前提交
ca63a76a23

+ 33 - 0
api/business/auxiliaryDaywork.js

@@ -12,4 +12,37 @@ export function getDayWorkList(data) {
 		method: 'POST',
 		data: data
 	})
+}
+
+export function getInfoByCarrierCode(data) {
+	return req.request({
+		url: '/business/auxiliaryDaywork/getInfoByCarrierCode',
+		// header: reqHeader,
+		method: 'POST',
+		data: data
+	})
+}
+
+export function getAuxiliaryProcesses() {
+	return req.request({
+		url: '/business/auxiliaryDaywork/getProcesses',
+		// header: reqHeader,
+		method: 'Get'
+	})
+}
+
+export function saveAuxiliaryDayowrk(data) {
+	return req.request({
+		url: '/business/auxiliaryDaywork/save',
+		method: 'post',
+		data: data
+	})
+}
+
+export function getAuxiliaryDayworkItemById(data) {
+	return req.request({
+		url: '/business/auxiliaryDaywork/getInfoById',
+		method: 'post',
+		data: data
+	})
 }

+ 149 - 0
components/dialog-daywork-choice/dialog-daywork-choice.vue

@@ -0,0 +1,149 @@
+<template>
+	<dialog-base ref="baseDialog" title="请选择报工批次">
+		<view>
+			<uni-section title="批次" type="line">
+				<uni-data-select v-model="selectedLot" :localdata="lotList" :clear="false"
+					@change="handleLotChange"></uni-data-select>
+			</uni-section>
+		</view>
+
+		<view class="add-btn-container uni-row">
+			<button type="primary" class="btn" @click="handleStart">确定</button>
+		</view>
+	</dialog-base>
+</template>
+
+<script setup>
+	import {
+		ref
+	} from 'vue'
+	import {
+		onLoad
+	} from '@dcloudio/uni-app'
+	import {
+		store
+	} from '@/store/index.js'
+
+	const baseDialog = ref(null)
+	const selectedLot = ref("")
+	const lotList = ref([])
+	const infos = ref([])
+	const emit = defineEmits(['handleSelectDaywork'])
+
+
+	// onLoad(() => {
+
+	// })
+
+	function open(data) {
+		lotList.value = data.map(v => ({
+			text: v.lotCode,
+			value: v.lotCode,
+		}))
+		infos.value = data
+		baseDialog.value.open();
+	}
+
+	function handleLotChange() {
+		console.log("选中", selectedLot.value);
+	}
+
+	function handleStart() {
+		const info = infos.value.find(e => e.lotCode === selectedLot.value)
+		emit('handleSelectDaywork', info);
+		close()
+	}
+
+	function close() {
+		baseDialog.value.close()
+	}
+
+	defineExpose({
+		open
+	})
+</script>
+
+<style lang="scss">
+	.dialog-body {
+		.equipment-container {
+			height: 300rpx;
+			overflow: auto;
+			flex-wrap: wrap;
+			justify-content: flex-start;
+			margin: 24rpx 0 0 7%;
+
+			.item {
+				width: 236rpx;
+				height: 60rpx;
+				text-align: center;
+				line-height: 60rpx;
+				border-radius: 6rpx;
+				margin: 16rpx;
+				flex: 0 0 40%;
+				border: 1px solid #000000;
+			}
+
+			.selected {
+				background-color: #1684fc;
+				color: #FFF;
+			}
+		}
+
+		.add-btn-container {
+			margin-top: 32rpx;
+
+			.btn {
+				flex: 1;
+			}
+		}
+
+		.switch {
+			font-size: 26rpx;
+			align-items: center;
+			justify-content: space-between;
+			margin: 16rpx;
+		}
+
+		.userList {
+			border: 1rpx solid #1684fc;
+			border-radius: 8rpx;
+			max-height: 300rpx;
+			overflow: auto;
+			width: 100%;
+
+			.showUser {
+				justify-content: flex-start;
+				flex-wrap: wrap;
+
+				.user {
+					border: 1rpx solid #999;
+					border-radius: 8rpx;
+					width: 150rpx;
+					height: 50rpx;
+					text-align: center;
+					line-height: 50rpx;
+					margin: 10rpx;
+					overflow: auto;
+				}
+			}
+		}
+
+		.selectedUserList {
+			width: 100%;
+			justify-content: flex-start;
+			flex-wrap: wrap;
+
+			.selectedUser {
+				border: 1rpx solid #999;
+				border-radius: 8rpx;
+				width: 150rpx;
+				height: 50rpx;
+				text-align: center;
+				line-height: 50rpx;
+				margin: 20rpx 20rpx 0 0;
+				justify-content: space-around;
+
+			}
+		}
+	}
+</style>

+ 775 - 1
pages/auxiliaryDaywork/form.vue

@@ -1 +1,775 @@
-<template></template>
+<template>
+	<view class="page-container uni-column">
+		<view class="carrier-info uni-column">
+			<view class="carrier-code uni-row">
+				<text>箱号</text>
+				<text style="margin-left: 24rpx;">{{auxiliaryDayworkItem.carrierName}}</text>
+			</view>
+			<view class="info-row uni-row">
+				<view class="label">批次号</view>
+				<view class="value">{{ auxiliaryDayworkItem.lotCode }}</view>
+			</view>
+			<view class="info-row uni-row">
+				<view class="label">产品描述</view>
+				<view class="value">{{ auxiliaryDayworkItem.product.description }}</view>
+			</view>
+			<view class="info-row uni-row">
+				<view class="label">生产工序</view>
+				<view class="value">{{ auxiliaryDayworkItem.process.processAlias }}</view>
+			</view>
+			<view class="info-row uni-row">
+				<view class="label">辅助工序</view>
+				<view class="value">{{ auxiliaryDayworkItem.auxiliaryProcess.name }}</view>
+			</view>
+		</view>
+
+		<!-- 废品信息 -->
+		<view class="title unfit-title uni-row">
+			<text>报工信息</text>
+		</view>
+		<view class="unfit-container">
+			<view class="unfit-item-container uni-column" v-for="(item, index) in oldUnfitInfos" :key="index">
+				<view class="resu uni-row">
+					<view class="label">检查标准</view>
+					<view class="value">{{ item.checkStandard }}</view>
+				</view>
+				<view class="resu uni-row">
+					<view class="label">检查结果</view>
+					<view class="value">{{ item.checkResult }}</view>
+				</view>
+				<view class="resu uni-row">
+					<view class="label">超差范围</view>
+					<view class="value">{{ item.exceedLimits }}</view>
+				</view>
+				<view class="resu uni-row">
+					<view :class="'label'">检查量</view>
+					<view class="number value">{{ item.examiningNum }}</view>
+					<view :class="'label'">不良品量</view>
+					<view class="value">{{ item.disqualificationNum }}</view>
+					<view :class="'label'">废品量</view>
+					<view class="value">{{ item.rejectNum }}</view>
+				</view>
+			</view>
+			<view class="unfit-item-container uni-column" v-for="(item, index) in unfitInfos" :key="index">
+				<view class="resu uni-row">
+					<view class="label">报工人</view>
+					<view class="value">{{ item.dayworkItem.nickName }}</view>
+				</view>
+				<view class="resu uni-row">
+					<view class="label">开始时间</view>
+					<view class="value">{{ item.dayworkItem.startTime }}</view>
+				</view>
+				<view class="resu uni-row">
+					<view class="label">结束时间</view>
+					<view class="value">{{ item.dayworkItem.endTime }}</view>
+				</view>
+				<view class="resu uni-row">
+					<view :class="!editable() ? 'label' : ''">投产数量</view>
+					<view class="number value">{{ item.prodNum }}</view>
+					<view :class="!editable() ? 'label' : ''">合格数量</view>
+					<view class="value">{{ item.qualificationNum }}</view>
+					<view :class="!editable() ? 'label' : ''">废品量</view>
+					<input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
+						v-model="item.rejectNum" placeholder="" />
+					<view v-else class="value">{{ item.rejectNum }}</view>
+				</view>
+			</view>
+		</view>
+		<!-- 报工部分 -->
+		<view class="daywork-container">
+			<view class="result uni-row">
+				<view class="label">废品总数</view>
+				<view class="value" style="margin-left: 10px;">{{ auxiliaryDayworkItem.rejectNum }}</view>
+			</view>
+			<view class="remark uni-row">
+				<view class="label">备注</view>
+				<textarea v-if="editable()" v-model="auxiliaryDayworkItem.remark" />
+				<view v-else class="value">{{ auxiliaryDayworkItem.remark }}</view>
+			</view>
+
+			<view class="btns-container uni-row">
+				<view v-if="editable()" class="finished-btn" @click="endWork">结束报工</view>
+				<view v-if="editable()" class="pause-btn" @click="pauseWork">暂停报工</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		ref,
+		onMounted,
+		getCurrentInstance
+
+	} from 'vue'
+	import {
+		onLoad,
+		onReady,
+		onUnload,
+		onShow
+	} from '@dcloudio/uni-app'
+	import {
+		store
+	} from '@/store/index.js'
+	import {
+		getAuxiliaryDayworkItemById,
+		finishedDaywork,
+		pauseDaywork
+	} from '@/api/business/auxiliaryDaywork.js'
+	const lot = ref({})
+	const unfitInfos = ref([]) //废品信息
+	const oldUnfitInfos = ref([])
+	const isEventTriggered = ref(false); // 创建一个标志位
+	// 创建一个引用来存储最后一次请求的时间戳
+	const lastRequestTimestamp = ref(0);
+	const consultations = ref([]) //咨询信息
+	const auxiliaryDayworkItem = ref({
+		remark: "",
+		rejectNum: 0,
+		examiningNum: 0,
+		status: 0,
+		product: {},
+		process: {},
+		auxiliaryProcess: {}
+	})
+	const initStatus = ref(0)
+	const editable = () => {
+		if (store.userInfo.permissions.some(item => item === 'business:outsourcedInspection:edit')) {
+			return true
+		}
+		if (initStatus.value == 0) {
+			return true
+		}
+		if (auxiliaryDayworkItem.value.firstUpdaterId == store.userInfo.userId) {
+			return true
+		}
+		return false
+	}
+
+	const consul = [{
+		value: 0,
+		text: "待确认",
+		type: "color: #fcab53"
+	}, {
+		value: 2,
+		text: "合格",
+		type: "color: #55ff7f"
+	}, {
+		value: 1,
+		text: "不合格",
+		type: "color: #ff0c2c"
+	}]
+
+	const range = [{
+		value: 0,
+		text: "待确认",
+		type: "color: #fcab53"
+	}, {
+		value: 1,
+		text: "合格",
+		type: "color: #55ff7f"
+	}, {
+		value: 2,
+		text: "不合格",
+		type: "color: #ff0c2c"
+	}]
+
+	/***************************** 页面生命周期函数 *****************************/
+
+	onMounted(() => {
+		const instance = getCurrentInstance().proxy
+		const eventChannel = instance.getOpenerEventChannel();
+		eventChannel.on('outsourcedInspectionFrom', function(data) {
+			console.log('outsourcedInspectionFrom', data)
+			if (data && data.data) {
+				auxiliaryDayworkItem.value.lot = data.data;
+
+			}
+		})
+
+	})
+
+	onShow(() => {
+		if (store.auxiliaryDaywork != null) {
+			uni.showLoading({
+				title: '加载中'
+			});
+			auxiliaryDayworkItem.value = store.auxiliaryDaywork
+			getAuxiliaryDayworkItemById(auxiliaryDayworkItem.value).then(res => {
+				console.log("res", res);
+				if (res.code == 200) {
+					auxiliaryDayworkItem.value = res.data;
+					initStatus.value = res.data.status
+					unfitInfos.value = res.data.rejectList;
+					console.log("res", res);
+					uni.hideLoading();
+					// getInspecion();
+				} else {
+					uni.showToast({
+						icon: 'none',
+						title: res.msg,
+						duration: 2000
+					})
+				}
+			});
+		}
+	})
+
+	/***************************** 定义了一些方法 *****************************/
+	//咨询文本
+	function selectText(item) {
+		for (var i = 0; i < consul.length; i++) {
+			if (item.status == consul[i].value) {
+				return consul[i].text
+			}
+		}
+	}
+
+
+	//打开电子图纸
+	function handleDrawingMenu() {
+		var outsourceOrderDetailId = encodeURIComponent(auxiliaryDayworkItem.value.outsourceOrderDetailId);
+		var lotCode = encodeURIComponent(auxiliaryDayworkItem.value.lot.lotCode);
+		// 构建查询参数字符串
+		var queryParam = `param1=${outsourceOrderDetailId}&param2=${lotCode}`;
+
+		// 使用模板字符串构建完整的URL
+		var navigateUrl = `/pages/outsourcedDrawingMenu/index?${queryParam}`;
+
+		// 导航到指定页面
+		uni.navigateTo({
+			url: navigateUrl
+		});
+
+	}
+	const rejectNumberChange = () => {
+		let sumReject = 0
+		let sumDisqualificationNum = 0
+		let sumExaminingNum = 0
+		unfitInfos.value.forEach(v => {
+			sumReject += (v.rejectNum != null ? Number(v.rejectNum) : 0)
+			sumDisqualificationNum += (v.disqualificationNum != null ? Number(v.disqualificationNum) : 0)
+			sumExaminingNum += (v.examiningNum != null ? Number(v.examiningNum) : 0)
+		})
+		auxiliaryDayworkItem.value.rejectNum = sumReject
+		auxiliaryDayworkItem.value.disqualificationNum = sumDisqualificationNum
+		auxiliaryDayworkItem.value.examiningNum = sumExaminingNum
+		console.log(auxiliaryDayworkItem.value)
+	}
+
+	//查询咨询列表
+	function getInspecion() {
+		auxiliaryDayworkItem.value = store.processInspection
+		selectInspecion(auxiliaryDayworkItem.value).then(res => {
+			console.log("咨询", res);
+			if (res.code == 200) {
+				console.log("res", res);
+			} else {
+				uni.showToast({
+					icon: 'none',
+					title: res.msg,
+					duration: 2000
+				})
+			}
+		});
+	}
+
+	//结束报工按钮
+	function endWork() {
+		let unf = unfitInfos.value;
+		for (var i = 0; i < unfitInfos.value.length; i++) {
+			console.log("废品信息");
+			// if (!unf[i].checkStandard && !unf[i].checkResult && !unf[i].rejectNum) {
+			// 	uni.showToast({
+			// 		icon: 'none',
+			// 		title: "废品信息不能为空",
+			// 		duration: 2000
+			// 	})
+			// 	return;
+			// }
+			if (unf[i].checkStandard == '' || unf[i].checkStandard == null) {
+				uni.showToast({
+					icon: 'none',
+					title: "检查标准不能为空",
+					duration: 2000
+				})
+				return;
+			}
+			// if (unf[i].checkResult == '' || unf[i].checkResult == null) {
+			// 	uni.showToast({
+			// 		icon: 'none',
+			// 		title: "检查结果不能为空",
+			// 		duration: 2000
+			// 	})
+			// 	return;
+
+			// }
+			if (unf[i].rejectNum == null) {
+				uni.showToast({
+					icon: 'none',
+					title: "废品量不能为空",
+					duration: 2000
+				})
+				return;
+			}
+			if (unf[i].rejectNum < 0 || unf[i].examiningNum < 0 || unf[i].disqualificationNum < 0) {
+				uni.showToast({
+					icon: 'none',
+					title: '检查量,不良品量,废品量不能小于0',
+					duration: 2000
+				})
+				return
+			}
+			if (unf[i].examiningNum > auxiliaryDayworkItem.value.lot.pudName) {
+				uni.showToast({
+					icon: 'none',
+					title: '检查量不能大于投产量'
+				})
+				return
+			}
+		}
+
+		let sumReject = 0
+		unfitInfos.value.forEach(v => {
+			sumReject += Number(v.rejectNum)
+		})
+		if (auxiliaryDayworkItem.value.rejectNum != sumReject) {
+			uni.showToast({
+				icon: 'none',
+				title: "废品量与废品信息不一致",
+				duration: 2000
+			})
+			return;
+		}
+		if (auxiliaryDayworkItem.value.rejectNum > auxiliaryDayworkItem.value.lot.pudName) {
+			uni.showToast({
+				icon: 'none',
+				title: '废品量不能大于投产量'
+			})
+			return
+		}
+		if (auxiliaryDayworkItem.value.disqualificationNum > auxiliaryDayworkItem.value.lot.pudName) {
+			uni.showToast({
+				icon: 'none',
+				title: '不良品量不能大于投产量'
+			})
+			return
+		}
+
+		save();
+
+
+	}
+
+
+	function save() {
+		const currentTime = Date.now();
+
+		// 检查是否已经过去了 2 秒
+		if (currentTime - lastRequestTimestamp.value < 2000) {
+			// 如果在 2 秒 内已经点击,那么不执行
+			uni.showToast({
+				icon: 'none',
+				title: `请勿重复点击`,
+				duration: 2000
+			})
+			return;
+		}
+
+		let pages = getCurrentPages();
+		auxiliaryDayworkItem.value.dayworkItemConsults = consultations.value;
+		auxiliaryDayworkItem.value.dayworkItemRejects = unfitInfos.value;
+		auxiliaryDayworkItem.value.user = store.userInfo;
+
+		saveOutsourcedInspecion(auxiliaryDayworkItem.value).then(res => {
+			if (res.code == 200) {
+				let index = 0;
+
+				for (let i = 0; i < pages.length; i++) {
+
+					if (pages[i].$page.fullPath == "/pages/outsourcedInspection/index") {
+
+						index = pages.length - i - 1;
+					}
+				}
+				console.log("index", index);
+				uni.navigateBack({
+					delta: index
+				});
+			} else {
+				uni.showToast({
+					icon: 'none',
+					title: res.msg,
+					duration: 2000
+				})
+			}
+		});
+	}
+
+
+
+
+	//咨询样式
+	function selectType(item) {
+		for (var i = 0; i < consul.length; i++) {
+			if (item.status == consul[i].value) {
+				return consul[i].type
+			}
+		}
+	}
+
+	const addWasteInfo = (data) => {
+		const info = {
+			title: data.title,
+			checkStandard: data.standard
+		}
+		unfitInfos.value.push(info)
+	}
+	const addConsultation = (data) => {
+		console.log(data)
+		let info = data
+		info.forEach(item => {
+			item.status = 0
+		})
+		consultations.value = info
+		isEventTriggered.value = true; // 更新标志位状态
+	}
+
+	/***************************** 定义了一些事件 *****************************/
+	// 添加不合格信息
+	const handleAddWaste = () => {
+		let info = {}
+		unfitInfos.value.push(info)
+
+		// 监听事件,暂时不用,后续会使用
+		// uni.$once('addWasteInfoEvent', (data) => {
+		// 	addWasteInfo(data)
+		// })
+		// uni.navigateTo({
+		// 	url: "/pages/processInspection/options"
+		// })
+	}
+	// 删除不合格信息
+	const handleDelWaste = (index) => {
+		uni.showModal({
+			title: '提示',
+			content: '确定删除该项?',
+			success: function(res) {
+				if (res.confirm) {
+					unfitInfos.value.splice(index, 1)
+					rejectNumberChange()
+				} else if (res.cancel) {
+					return
+				}
+			}
+		})
+	}
+
+	// 咨询
+	const handleAddConsultation = () => {
+		isEventTriggered.value = false;
+		// 监听事件
+		uni.$once('wasteConsultationEvent', (data) => {
+			if (!isEventTriggered.value) {
+				// 如果事件尚未触发,则执行事件触发逻辑
+				addConsultation(data)
+			}
+		})
+
+		uni.navigateTo({
+			url: "/pages/outsourcedInspection/consultation",
+			success: (res) => {
+				// 通过eventChannel向被打开页面传送数据
+				res.eventChannel.emit("outsourcedInspectionConsultation", {
+					data: auxiliaryDayworkItem.value.lot
+				})
+			}
+		})
+	}
+</script>
+
+<style lang="scss">
+	.page-container {
+		// height: 100%;
+		background-color: #ececec;
+		font-size: 28rpx;
+
+		>.title {
+			font-weight: 700;
+			margin: 24rpx 16rpx;
+		}
+	}
+
+	.carrier-info {
+		margin: 32rpx 16rpx 0 16rpx;
+		padding: 24rpx;
+		background-color: #ffffff;
+		border-radius: 8rpx;
+
+		.carrier-code {
+			font-size: 32rpx;
+			font-weight: 700;
+		}
+
+		.info-row {
+			margin-top: 16rpx;
+			color: #767676;
+
+			.label {
+				width: 160rpx;
+			}
+
+			.drawing-btn {
+				padding: 12rpx 32rpx;
+				background-color: #0055ff;
+				color: #ffffff;
+				border-radius: 12rpx;
+				margin-left: auto;
+				font-size: 28rpx;
+			}
+
+			.value {
+				flex: 1;
+
+				textarea {
+					flex: 1;
+					border: 1px solid #888888;
+					box-sizing: border-box;
+					padding: 16rpx;
+				}
+			}
+		}
+	}
+
+	.unfit-title {
+		margin-bottom: 24rpx;
+		justify-content: space-between;
+		align-items: center;
+
+		text {
+			font-size: 28rpx;
+			font-weight: 700;
+		}
+
+		.add-btn {
+			margin-right: 26rpx;
+			padding: 12rpx 32rpx;
+			background-color: #a4adb3;
+			color: #ffffff;
+			border-radius: 12rpx;
+			font-size: 24rpx;
+		}
+	}
+
+	.unfit-container {
+		padding: 24rpx;
+		margin: 0 16rpx;
+		background-color: #ffffff;
+		border-radius: 12rpx;
+
+		.unfit-item-container {
+			position: relative;
+
+			>* {
+				margin-bottom: 24rpx;
+			}
+
+			.title {
+				font-weight: 700;
+				justify-content: space-between;
+				align-items: center;
+
+				image {
+					width: 40rpx;
+					height: 40rpx;
+				}
+			}
+
+			.standard {}
+
+			.resu {
+				width: 100%;
+				align-items: center;
+
+				input {
+					margin-left: 20rpx;
+					width: 200rpx;
+					height: 56rpx;
+					flex: 1;
+					border: 1px solid #9f9f9f;
+					font-size: 28rpx;
+				}
+
+				.label {
+					width: 160rpx;
+				}
+
+				.value {
+					flex: 1;
+
+					textarea {
+						flex: 1;
+						border: 1px solid #888888;
+						box-sizing: border-box;
+						padding: 16rpx;
+					}
+				}
+			}
+
+			.result {
+				border-bottom: 1px solid #9f9f9f;
+				padding-bottom: 32rpx;
+				align-items: center;
+
+				.label {
+					width: 160rpx;
+				}
+
+				.value {
+					flex: 1;
+
+					textarea {
+						flex: 1;
+						border: 1px solid #888888;
+						box-sizing: border-box;
+						padding: 16rpx;
+					}
+				}
+
+				input {
+					width: 280rpx;
+					height: 56rpx;
+					border: 1px solid #9f9f9f;
+					font-size: 28rpx;
+
+					&.number {
+						width: 104rpx;
+						text-align: center;
+					}
+				}
+			}
+		}
+
+		.unfit-item-container:last-child {
+			.result {
+				border-bottom: none;
+				padding-bottom: 0;
+			}
+		}
+	}
+
+	.consultation-container {
+		margin: 0 16rpx;
+		padding: 24rpx;
+		background-color: #ffffff;
+		border-radius: 8rpx;
+
+		.consultation-item-container {
+			margin-bottom: 24rpx;
+			border-bottom: 2px solid #888888;
+			padding-bottom: 24rpx;
+		}
+
+		.consultation-item-container:last-child {
+			margin-bottom: 0;
+			border-bottom: 0;
+			padding-bottom: 0;
+		}
+
+		.question,
+		.answer {
+			.label {
+				justify-content: space-between;
+				margin-bottom: 16rpx;
+				font-weight: 700;
+			}
+
+			.content {
+				line-height: 40rpx;
+			}
+		}
+
+		.answer {
+			margin-top: 24rpx;
+		}
+	}
+
+	.daywork-container {
+		margin-top: 24rpx;
+		padding: 24rpx;
+		background-color: #ffffff;
+		border: 1px solid #bcbcbc;
+
+		.result {
+			align-items: center;
+
+			.label {
+				width: 112rpx;
+			}
+
+			input {
+				flex: 1;
+				height: 56rpx;
+				border: 1px solid #9f9f9f;
+				font-size: 28rpx;
+				text-align: center;
+			}
+		}
+
+		.remark {
+			margin-top: 24rpx;
+
+			.label {
+				width: 112rpx;
+			}
+
+			textarea {
+				flex: 1;
+				border: 1px solid #9f9f9f;
+				height: 168rpx;
+			}
+		}
+
+		.btns-container {
+			margin-top: 24rpx;
+
+			.finished-btn {
+				display: flex;
+				flex: 1;
+				height: 80rpx;
+				background-color: #fc6565;
+				color: #ffffff;
+				text-align: center;
+				justify-content: center;
+				align-items: center;
+				border-radius: 8rpx;
+			}
+
+			.pause-btn {
+				display: flex;
+				flex: 1;
+				height: 80rpx;
+				background-color: #393cfc;
+				color: #ffffff;
+				text-align: center;
+				justify-content: center;
+				align-items: center;
+				border-radius: 8rpx;
+			}
+
+			.question-btn {
+				width: 80rpx;
+				align-items: flex-end;
+
+				image {
+					width: 48rpx;
+					height: 48rpx;
+				}
+
+				text {
+					font-size: 24rpx;
+				}
+			}
+		}
+	}
+</style>

+ 20 - 26
pages/auxiliaryDaywork/index.vue

@@ -21,36 +21,30 @@
 				<text :style="selectType(item)">{{ selectText(item) }}</text>
 				<!-- <uni-icons type="right" size="16" /> -->
 				<!-- item.creatorId === userId && item.status == 0 -->
-				<text v-if="delable(item)" class="fa fa-trash" style="font-size: 16; color: red;"
-					@click.stop="deleteItem(item)"></text>
-				<text v-else class="fa fa-trash" style="font-size: 16; color: white;"></text>
+				<!-- <text v-if="delable(item)" class="fa fa-trash" style="font-size: 16; color: red;"
+					@click.stop="deleteItem(item)"></text> -->
+				<!-- <text v-else class="fa fa-trash" style="font-size: 16; color: white;"></text> -->
 			</view>
 			<view class="info">
 				<view class="info-row uni-row">
-					<view class="label">序检箱号:</view>
-					<view class="value">{{ item.carrierCode }}</view>
-					<view class="label">检察员:</view>
+					<view class="label">报工人员:</view>
 					<view class="value">{{ item.nickName }}</view>
 				</view>
-				<view class="info-row uni-row">
-					<view class="label">检查数量:</view>
-					<view class="value">{{ item.examiningNum }}</view>
-					<view class="label">不良品量:</view>
-					<view class="value">{{ item.disqualificationNum }}</view>
-					<view class="label">废品量:</view>
-					<view class="value">{{ item.rejectNum }}</view>
-				</view>
 				<view class="info-row uni-row">
 					<view class="label">产品描述:</view>
 					<view class="value">{{ item.productDescription }}</view>
 				</view>
+				<view class="info-row uni-row">
+					<view class="label">生产工序:</view>
+					<view class="value">{{ item.processAlias }}</view>
+					<view class="label">辅助工序:</view>
+					<view class="value">{{ item.auxiliaryProcessAlias }}</view>
+				</view>
 				<view class="info-row uni-row" style="justify-content: space-between;">
-					<view class="label">检测载具:</view>
-					<view class="value">{{ item.inspectionCarrierCode }}
-						{{ item.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
-					</view>
+					<view class="label">箱号:</view>
+					<view class="value">{{ item.carrierName }}</view>
 					<button class="reporting-tag" size="mini" type="primary"
-						@click.stop="changeCheckCarrier(item)">检测载具</button>
+						@click.stop="changeCheckCarrier(item)">载具变更</button>
 				</view>
 			</view>
 		</view>
@@ -94,15 +88,15 @@
 
 	const range = [{
 		value: 0,
-		text: "待确认",
+		text: "未开始",
 		type: "color: #fcab53"
 	}, {
 		value: 1,
-		text: "合格",
+		text: "进行中",
 		type: "color: #55ff7f"
 	}, {
-		value: 2,
-		text: "不合格",
+		value: 3,
+		text: "已完成",
 		type: "color: #ff0c2c"
 	}]
 
@@ -112,7 +106,7 @@
 	/***************************** 页面生命周期函数 *****************************/
 	onShow(() => {
 		getList();
-		getP2();
+		// getP2();
 	})
 
 	/***************************** 定义了一些方法 *****************************/
@@ -190,9 +184,9 @@
 
 	//查看序捡详情
 	function handleSelection(item) {
-		store.processInspection = item;
+		store.auxiliaryDaywork = item;
 		uni.navigateTo({
-			url: '/pages/outsourcedInspection/form'
+			url: '/pages/auxiliaryDaywork/form'
 		})
 	}
 

+ 146 - 161
pages/auxiliaryDaywork/scan.vue

@@ -13,7 +13,17 @@
 			<!-- 选择被辅助工序 -->
 			<view class="info-row uni-row">
 				<view class="label">生产工序</view>
-				<view class="value">{{ lot.productDescription }}</view>
+				<view class="value">
+					<uni-data-select style="margin-left: 40rpx;width: 70%;" v-model="lot.technologicalProcessDetailId"
+						:localdata="processes" @change="handleProcessChange"></uni-data-select>
+				</view>
+			</view>
+			<view class="info-row uni-row">
+				<view class="label">辅助工序</view>
+				<view class="value">
+					<uni-data-select style="margin-left: 40rpx;width: 70%;" v-model="lot.auxiliaryProcessId"
+						:localdata="auxiliaryProcesses" @change="handleAuxiliaryProcessChange"></uni-data-select>
+				</view>
 			</view>
 			<!-- 选择辅助工序 -->
 			<view class="info-row uni-row">
@@ -34,8 +44,9 @@
 			</view>
 			<!-- <view class="btn uni-row" style="margin-top: 48rpx;" @click.stop="handleSave">保存</view> -->
 		</view>
-		<dialog-processInspection ref='selectProcessInspection'
-			@handleSelectProcessInspection='handleSelectProcessInspection'></dialog-processInspection>
+		<!-- <dialog-processInspection ref='selectProcessInspection'
+			@handleSelectProcessInspection='handleSelectProcessInspection'></dialog-processInspection> -->
+		<dialog-daywork-choice ref="selectDaywork" @handleSelectDaywork="handleSelectDaywork"></dialog-daywork-choice>
 	</view>
 </template>
 
@@ -51,10 +62,14 @@
 	} from '@dcloudio/uni-app'
 	import {
 		saveOutsourcedInspecion,
-		getLotInfo,
 		getCarrierInfo,
 		getLotOutsourcedInfo
 	} from '@/api/business/processInspection.js'
+	import {
+		getInfoByCarrierCode,
+		getAuxiliaryProcesses,
+		saveAuxiliaryDayowrk
+	} from '@/api/business/auxiliaryDaywork.js'
 	import {
 		store
 	} from '../../store';
@@ -66,6 +81,8 @@
 	const query = ref({})
 	const selectProcessInspection = ref(null)
 	const lastRequestTimestamp = ref(0);
+	const auxiliaryProcesses = ref([])
+	const processes = ref([])
 
 	// 页面生命周期函数
 	onLoad(() => {})
@@ -101,54 +118,27 @@
 					result.processCode = store.outsourcedCode;
 					// console.log(result.processCode)
 					/************************ 根据扫码查询到的数据和需要检查的工序查询信息 ************************/
-					getCarrierInfo(result).then(response => {
+					getInfoByCarrierCode(result).then(response => {
 						if (response.code == 200) {
 							// 判断是哪种返回值 假设是想信息则给lot附检查箱信息
 							// 假设是dayworkCarriers 则 判断是几个批次,假设为多批,则弹出选择框。
-							if (response.data.dayworkCarriers != null) {
-								if (response.data.dayworkCarriers.length > 1) {
+							if (response.data != null) {
+								if (response.data.length > 1) {
 									query.value = result;
-									selectProcessInspection.value.open(response.data.dayworkCarriers)
+									selectProcessInspection.value.open(response.data)
 								} else {
 									// console.log(response)
-									uni.showLoading({
-										title: '加载中'
-									});
-									// 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
-									// 需要定义一个请求方法, 从后端获取
-									getLotOutsourcedInfo(result).then(res => {
-										if (res.code == 200) {
-											lot.value = {
-												...lot.value,
-												...res.data,
-												processNames: res.data.processList
-											};
-											lot.value.carrierCode = result.carrierCode
-											carrierCode.value = result.carrierCode;
-											// console.log("res", res);
-											uni.hideLoading();
-											checkSave()
-										} else {
-											uni.showToast({
-												icon: 'none',
-												title: res.msg,
-												duration: 2000
-											})
-										}
-									}).catch(err => {
-										uni.showToast({
-											icon: 'none',
-											title: err.message,
-											duration: 2000
-										})
-									})
-
+									// uni.showLoading({
+									// 	title: '加载中'
+									// })
+									uni.hideLoading()
+									lot.value = response.data[0]
+									processes.value = lot.value.processSequence.map(v => ({
+										text: v.processAlias,
+										value: v.technologicalProcessDetailId,
+										...v
+									}))
 								}
-							} else if (response.data.inspectionCarrier != null) {
-								console.log(response)
-								lot.value.inspectionCarrierCode = response.data.inspectionCarrier.code
-								lot.value.inspectionCarrierId = response.data.inspectionCarrier.id
-								checkSave()
 							}
 						} else {
 							uni.showToast({
@@ -171,57 +161,27 @@
 				carrierCode: '000657',
 				processCode: store.outsourcedCode
 			}
-			getCarrierInfo(result).then(response => {
+			getInfoByCarrierCode(result).then(response => {
 				if (response.code == 200) {
 					// 判断是哪种返回值 假设是想信息则给lot附检查箱信息
 					// 假设是dayworkCarriers 则 判断是几个批次,假设为多批,则弹出选择框。
-					if (response.data.dayworkCarriers != null) {
-						if (response.data.dayworkCarriers.length > 1) {
+					if (response.data != null) {
+						if (response.data.length > 1) {
 							query.value = result;
-							selectProcessInspection.value.open(response.data.dayworkCarriers)
+							selectProcessInspection.value.open(response.data)
 						} else {
 							// console.log(response)
-							uni.showLoading({
-								title: '加载中'
-							});
-							// 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
-							// 需要定义一个请求方法, 从后端获取
-							getLotOutsourcedInfo(result).then(res => {
-								if (res.code == 200) {
-									console.log(res)
-									lot.value = {
-										...lot.value,
-										...res.data,
-										processNames: res.data.processList
-									};
-									lot.value.carrierCode = result.carrierCode
-									carrierCode.value = result.carrierCode;
-									// console.log("res", res);
-									uni.hideLoading();
-									// 判断是否批次号和检查箱码都扫完
-									checkSave()
-								} else {
-									uni.showToast({
-										icon: 'none',
-										title: res.msg,
-										duration: 2000
-									})
-								}
-							}).catch(err => {
-								uni.showToast({
-									icon: 'none',
-									title: err.message,
-									duration: 2000
-								})
-							})
-
+							// uni.showLoading({
+							// 	title: '加载中'
+							// })
+							uni.hideLoading()
+							lot.value = response.data[0]
+							processes.value = lot.value.processSequence.map(v => ({
+								text: v.processAlias,
+								value: v.technologicalProcessDetailId,
+								...v
+							}))
 						}
-					} else if (response.data.inspectionCarrier != null) {
-						console.log(response)
-						lot.value.inspectionCarrierCode = response.data.inspectionCarrier.code
-						lot.value.inspectionCarrierId = response.data.inspectionCarrier.id
-						// 判断是否批次号和检查箱码都扫完
-						checkSave()
 					}
 				} else {
 					uni.showToast({
@@ -241,28 +201,35 @@
 	}
 
 	//选择批号弹窗带回
-	function handleSelectProcessInspection(data) {
-		// console.log("带回", data)
-		query.value.lotCode = data
-		uni.showLoading({
-			title: '加载中'
-		});
-		getLotOutsourcedInfo(query.value).then(res => {
-			if (res.code == 200) {
-				lot.value = res.data;
-				console.log(res)
-				lot.value.carrierCode = query.value.carrierCode
-				carrierCode.value = query.value.carrierCode;
-				// console.log("res", res);
-				uni.hideLoading();
-			} else {
-				uni.showToast({
-					icon: 'none',
-					title: res.msg,
-					duration: 2000
-				})
-			}
-		});
+	function handleSelectDaywork(data) {
+		console.log("带回", data)
+		lot.value = data
+		processes.value = lot.value.processSequence.map(v => ({
+			text: v.processAlias,
+			value: v.technologicalProcessDetailId,
+			...v
+		}))
+		uni.hideLoading()
+		// query.value.lotCode = data
+		// uni.showLoading({
+		// 	title: '加载中'
+		// });
+		// getLotOutsourcedInfo(query.value).then(res => {
+		// 	if (res.code == 200) {
+		// 		lot.value = res.data;
+		// 		console.log(res)
+		// 		lot.value.carrierCode = query.value.carrierCode
+		// 		carrierCode.value = query.value.carrierCode;
+		// 		// console.log("res", res);
+		// 		uni.hideLoading();
+		// 	} else {
+		// 		uni.showToast({
+		// 			icon: 'none',
+		// 			title: res.msg,
+		// 			duration: 2000
+		// 		})
+		// 	}
+		// });
 	}
 
 	function checkSave() {
@@ -296,54 +263,27 @@
 			}
 			result.processCode = store.outsourcedCode;
 			// console.log(result.processCode)
-			getCarrierInfo(result).then(response => {
+			getInfoByCarrierCode(result).then(response => {
 				if (response.code == 200) {
 					// 判断是哪种返回值 假设是想信息则给lot附检查箱信息
 					// 假设是dayworkCarriers 则 判断是几个批次,假设为多批,则弹出选择框。
-					if (response.data.dayworkCarriers != null) {
-						if (response.data.dayworkCarriers.length > 1) {
+					if (response.data != null) {
+						if (response.data.length > 1) {
 							query.value = result;
-							selectProcessInspection.value.open(response.data.dayworkCarriers)
+							selectProcessInspection.value.open(response.data)
 						} else {
 							// console.log(response)
 							uni.showLoading({
 								title: '加载中'
-							});
-							// 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
-
-							// 需要定义一个请求方法, 从后端获取
-							getLotOutsourcedInfo(result).then(res => {
-								if (res.code == 200) {
-									console.log(res)
-									lot.value = {
-										...lot.value,
-										...res.data,
-										processNames: res.data.processList
-									};
-									lot.value.carrierCode = result.carrierCode
-									carrierCode.value = result.carrierCode;
-									// console.log("res", res);
-									uni.hideLoading();
-								} else {
-									uni.showToast({
-										icon: 'none',
-										title: res.msg,
-										duration: 2000
-									})
-								}
-							}).catch(err => {
-								uni.showToast({
-									icon: 'none',
-									title: err.message,
-									duration: 2000
-								})
 							})
-
+							uni.hideLoading()
+							lot.value = response.data[0]
+							processes.value = lot.value.processSequence.map(v => ({
+								text: v.processAlias,
+								value: v.technologicalProcessDetailId,
+								...v
+							}))
 						}
-					} else if (response.data.inspectionCarrier != null) {
-						console.log(response)
-						lot.value.inspectionCarrierCode = response.data.inspectionCarrier.code
-						lot.value.inspectionCarrierId = response.data.inspectionCarrier.id
 					}
 				} else {
 					uni.showToast({
@@ -369,6 +309,20 @@
 		}
 	}
 
+	const getProcesses = () => {
+		getAuxiliaryProcesses().then(res => {
+			if (res.code == 200) {
+				auxiliaryProcesses.value = res.data.map(v => ({
+					text: v.name,
+					value: v.id,
+					...v
+				}))
+
+				console.log(auxiliaryProcesses.value)
+			}
+		})
+	}
+
 	const handleSave = () => {
 		// 判断是否已有批次和检查载具
 		if (lot.value.lotCode == '' || lot.value.lotCode == null) {
@@ -379,11 +333,19 @@
 			})
 			return
 		}
-		if (lot.value.inspectionCarrierId == null) {
+
+		if (lot.value.technologicalProcessDetailId == null) {
 			uni.showToast({
 				icon: 'none',
-				title: "请先扫检查载具",
-				duration: 2000
+				title: '请先选择生产工序'
+			})
+			return
+		}
+
+		if (lot.value.auxiliaryProcessId == null) {
+			uni.showToast({
+				icon: 'none',
+				title: '请先选择辅助工序'
 			})
 			return
 		}
@@ -404,19 +366,23 @@
 
 		let pages = getCurrentPages();
 
-		saveOutsourcedInspecion({
-			lot: lot.value,
-			user: store.userInfo,
-			status: 0,
-			inspectionCarrierCode: lot.value.inspectionCarrierCode,
-			inspectionCarrierId: lot.value.inspectionCarrierId,
-			outsourceOrderDetailId: lot.value.outsourceOrderDetailId,
-			processNames: lot.value.processNames
+		saveAuxiliaryDayowrk({
+			productId: lot.value.productId,
+			userId: store.userInfo.userId,
+			nickName: store.userInfo.nickName,
+			userName: store.userInfo.userName,
+			deptId: store.curDeptDetails.deptId,
+			deptName: store.curDeptDetails.deptName,
+			processId: lot.value.currentProcess.id,
+			processStepNumber: lot.value.currentProcess.processStepNumber,
+			technologicalProcessDetailId: lot.value.technologicalProcessDetailId,
+			auxiliaryProcessId: lot.value.auxiliaryProcessId,
+			daywork: lot.value
 		}).then(res => {
 			if (res.code == 200) {
 				let index = 0;
 				for (let i = 0; i < pages.length; i++) {
-					if (pages[i].$page.fullPath == "/pages/outsourcedInspection/index") {
+					if (pages[i].$page.fullPath == "/pages/auxiliaryDaywork/index") {
 						index = pages.length - i - 1;
 					}
 				}
@@ -433,6 +399,25 @@
 			}
 		});
 	}
+
+	function handleProcessChange() {
+		console.log(lot.value.processId)
+		// 获取投产数量
+		const process = processes.value.find(v => v.technologicalProcessDetailId == lot.value.technologicalProcessDetailId)
+		console.log(process)
+		const item = lot.value.dayworkItemList.find(e => e.processId == process.id && process.processStepNumber == e
+			.processStepNumber)
+		console.log(item)
+		lot.value.pudName = item.prodNum
+		lot.value.currentProcess = process
+
+	}
+
+	function handleAuxiliaryProcessChange() {
+		console.log(lot.value.auxiliaryProcessId)
+	}
+
+	getProcesses()
 </script>
 
 <style lang="scss">

+ 14 - 9
pages/dashboard/index.vue

@@ -30,7 +30,7 @@
 		<view v-if="showQuick" class="business-btn uni-row" @click="handleFastToProductionPlan">
 			<text class="label">快速报工</text>
 		</view>
-		<view class="business-btn uni-row" v-if="showTakeStock"  @click="handleToTakeStock">
+		<view class="business-btn uni-row" v-if="showTakeStock" @click="handleToTakeStock">
 			<text class="label">盘点</text>
 		</view>
 		<view class="business-btn uni-row" v-if="showOther && !showSizing" @click="handleToProductionPlan">
@@ -66,7 +66,7 @@
 		<view class="business-btn uni-row" v-if="showOnSiteInspector" @click="handleToOnSiteInspection">
 			<text class="label">巡检</text>
 		</view>
-<!-- 		<view class="business-btn uni-row" v-if="showInspector" @click="handleToInstrumentInspection">
+		<!-- 		<view class="business-btn uni-row" v-if="showInspector" @click="handleToInstrumentInspection">
 			<text class="label">仪器室</text>
 		</view>
 		<view class="business-btn uni-row" v-if="showInspector" @click="handleToFactoryInspection">
@@ -166,21 +166,21 @@
 			showTurn.value = false;
 			showOther.value = true;
 		}
-		if(store.userInfo.roles.some(item =>item.roleKey == 'patrolInspection')) {
+		if (store.userInfo.roles.some(item => item.roleKey == 'patrolInspection')) {
 			showOnSiteInspector.value = true
 		} else {
 			showOnSiteInspector.value = false
 		}
 		//交检
-		if(store.userInfo.roles.some(item =>item.roleKey == 'deliveryInspection')) {
+		if (store.userInfo.roles.some(item => item.roleKey == 'deliveryInspection')) {
 			showDeliveryInspection.value = true
-		}else{
+		} else {
 			showDeliveryInspection.value = false
 		}
 		//交检审核
-		if(store.userInfo.roles.some(item =>item.roleKey == 'adjuster')) {
+		if (store.userInfo.roles.some(item => item.roleKey == 'adjuster')) {
 			showAdjust.value = true
-		}else{
+		} else {
 			showAdjust.value = false
 		}
 		if (store.userInfo.permissions.some(item => item === 'business:outsource:checkBox') || store.userInfo
@@ -202,7 +202,12 @@
 			// showOther.value = true;
 		}
 		showAuxiliary.value = true
-
+		//盘点状态
+		if (store.userInfo.takeStock) {
+			showTakeStock.value = true
+		} else {
+			showTakeStock.value = false
+		}
 		init();
 	})
 
@@ -407,7 +412,7 @@
 			})
 		}
 	}
-   //交检
+	//交检
 	function handleToDeleveryInspection() {
 		if (curSelectedDeptId.value) {
 			uni.navigateTo({