From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

---
 pages/product/outputRegister/shiftProductOut.vue |  392 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 392 insertions(+), 0 deletions(-)

diff --git a/pages/product/outputRegister/shiftProductOut.vue b/pages/product/outputRegister/shiftProductOut.vue
new file mode 100644
index 0000000..5491c2a
--- /dev/null
+++ b/pages/product/outputRegister/shiftProductOut.vue
@@ -0,0 +1,392 @@
+<template>
+	<view class="wrap">
+		<view class="row-list" v-if="info.type!='shift'">
+			<u-row justify="space-between" class="shift-product-out-main-row">
+				<u-col span="4">
+					<span class="span-lable">浜哄憳</span>
+				</u-col>
+				<u-col span="8">
+					<view class="shift-product-out-main-info">
+						<view>
+							<u-button size="mini" @click="toDutyPerson">鐐瑰嚮閫夋嫨</u-button>
+						</view>
+					</view>
+				</u-col>
+			</u-row>
+		</view>
+		<view class="row-list">
+			<u-form class="shift-product-out-form" :model="productOutForm" ref="productOutForm" label-width="180"
+				:label-style="{paddingLeft:'10rpx'}">
+				<u-form-item label="闆朵欢缂栧彿">
+					<u-input v-model="productOutForm.partNo" disabled placeholder="" />
+				</u-form-item>
+				<u-form-item label="闆朵欢鍚嶇О">
+					<u-input v-model="productOutForm.partName" disabled placeholder="" />
+				</u-form-item>
+				<u-form-item label="璧峰绫虫爣">
+					<u-input v-model="productOutForm.startMeterMark" placeholder="璇疯緭鍏ヨ捣濮嬬背鏍�" type="digit" />
+				</u-form-item>
+				<u-form-item label="鎴绫虫爣">
+					<u-input v-model="productOutForm.endMeterMark" placeholder="璇疯緭鍏ユ埅姝㈢背鏍�" type="digit" />
+				</u-form-item>
+				<u-form-item label="姣忕洏浜ч噺">
+					<u-input v-model="productOutForm.productQty" placeholder="璇疯緭鍏ユ瘡鐩樹骇閲�" type="digit" />
+				</u-form-item>
+				<u-form-item label="鎶ュ簾鏁伴噺">
+					<u-input v-model="productOutForm.scrapQty" placeholder="璇疯緭鍏ユ姤搴熸暟閲�" type="digit" />
+				</u-form-item>
+				<u-form-item label="杞藉叿缂栧彿">
+					<u-input v-model="productOutForm.reelNumber" placeholder="璇疯緭鍏ヨ浇鍏风紪鍙�" />
+				</u-form-item>
+				<u-form-item label="鍗曚綅">
+					<u-input v-model="productOutForm.unit" disabled placeholder="" />
+				</u-form-item>
+				<u-form-item label="鍒嗘鎻忚堪">
+					<u-input v-model="productOutForm.segmentDesc" />
+				</u-form-item>
+				<u-form-item label="鐢熶骇浜哄憳">{{productOutForm.staffName}}</u-form-item>
+				<u-form-item label="浜у嚭鏃ユ湡">
+					<u-input v-model="productOutForm.date" disabled/>
+				</u-form-item>
+			</u-form>
+		</view>
+		<view class="shift-product-out-bottom-view">
+			<u-button text="纭畾" type="success" size="medium" :customStyle="{width:'150rpx'}" @click="addShiftProudctOut">
+				纭畾</u-button>
+		</view>
+	</view>
+</template>
+<script>
+	export default {
+		data() {
+			const currentDateTime = this.getDateTime();
+			return {
+				productOutForm: {
+					workstationId: null,
+					operationTaskId: null,
+					partId: null,
+					partNo: null,
+					partName: null,
+					unit: null,
+					outBatchNo: null,
+					reelNumber: null,
+					ifsBatchNo: null,
+					startMeterMark: null,
+					endMeterMark: null,
+					productQty: null,
+					segmentDesc: null,
+					scrapQty: null,
+					remark: null,
+					staffName: null,
+					date: currentDateTime,
+					status: null,
+					disNumber: null
+				},
+				info: {},
+				personInitList: [],
+				personBoardList: [],
+				products: []
+
+			};
+		},
+		onLoad(option) {
+			//type:shift  鎸夌彮缁�  person 鎸変汉鍛� 
+			this.info.type = option.type
+			this.info.dutyId = option.dutyId
+			this.info.workstationId = option.workstationId
+
+			this.productOutForm.workstationId = option.workstationId
+			this.productOutForm.operationTaskId = option.operationTaskId
+			this.productOutForm.partId = option.partId
+			this.productOutForm.partName = option.partName == "null" ? "" : option.partName
+			this.productOutForm.partNo = option.partNo == "null" ? "" : option.partNo
+			this.productOutForm.unit = option.unit == "null" ? "" : option.unit
+			this.productOutForm.outBatchNo = option.outBatchNo
+			this.productOutForm.startMeterMark = option.endMeterMark
+			this.productOutForm.endMeterMark = option.endMeterMark
+			this.getPerson()
+		},
+		onShow() {
+
+		},
+		methods: {
+			getDateTime() {
+				let year = new Date().getFullYear(); //骞�
+				let month = new Date().getMonth() + 1; //娉ㄦ剰锛佹湀浠芥槸浠�0鏈堝紑濮嬭幏鍙栫殑锛屾墍浠ヨ+1;
+				let day = new Date().getDate(); //鏃�
+				let hour = new Date().getHours(); //鏃�
+				let minute = new Date().getMinutes(); //鍒�
+				let second = new Date().getSeconds(); //绉�
+				//鎷兼帴鏃ユ湡 YYYY/MM/DD HH:mm
+				let currentDate =
+					year +
+					'/' +
+					(month >= 10 ? month : '0' + month) +
+					'/' +
+					(day >= 10 ? day : '0' + day);
+				let currentTime =
+					(hour >= 10 ? hour : '0' + hour) +
+					':' +
+					(minute >= 10 ? minute : '0' + minute) +
+					':' +
+					(second >= 10 ? second : '0' + second);
+			
+				return currentDate + " " + currentTime
+			},
+			async getPerson() {
+				let queryUserParam = {
+					id: this.info.dutyId
+				}
+				console.log(queryUserParam)
+				let resUser = await this.$u.api.outputRegister.getPersonByDutyRecordId(queryUserParam)
+
+				let userList = resUser.data
+				if (userList.length > 0) {
+					this.personInitList = []
+					let staffName = ""
+					userList.map((item, index) => {
+
+						if (index == userList.length - 1) {
+							staffName = staffName + item.staffName
+						} else {
+							staffName = staffName + item.staffName + ","
+						}
+
+						let data = {
+							staffId: item.staffId,
+							staffName: item.staffName,
+							staffNo: item.staffNo,
+							checked: false
+						}
+
+						this.personInitList.push(data)
+					});
+
+					//type:shift  鎸夌彮缁�  person 鎸変汉鍛�
+					if (this.info.type == "shift") {
+						this.personBoardList = this.personInitList
+						this.productOutForm.staffName = staffName
+					} else {
+						this.personBoardList = []
+						this.productOutForm.staffName = ''
+					}
+
+				}
+
+			},
+			toDutyPerson() {
+				if (this.personInitList.length > 0) {
+					uni.navigateTo({
+						url: '/pages/product/outputRegister/dutyPersonList?item=' + encodeURIComponent(JSON
+							.stringify(this.personInitList))
+					})
+				}
+			},
+			setProductPerson(userList) {
+				//type:shift  鎸夌彮缁�  person 鎸変汉鍛�
+				if (this.info.type == "person") {
+					//杩囨护鎺夐�変腑鐨勪汉鍛樹俊鎭�
+					userList = userList.filter(item => item.checked == true)
+					this.personBoardList = []
+
+					if (userList.length > 0) {
+						let staffName = ""
+						userList.map((item, index) => {
+
+							if (index == userList.length - 1) {
+								staffName = staffName + item.staffName
+							} else {
+								staffName = staffName + item.staffName + ","
+							}
+
+							let data = {
+								staffId: item.staffId,
+								staffName: item.staffName,
+								staffNo: item.staffNo,
+								checked: item.checked
+							}
+
+							this.personBoardList.push(data)
+						});
+						this.productOutForm.staffName = staffName
+					}
+				}
+			},
+			async addShiftProudctOut() {
+				// 璧峰绫虫爣鏍¢獙
+				if (!this.isNumber(this.productOutForm.startMeterMark)) {
+					this.$u.toast('銆愯捣濮嬬背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒')
+					return
+				}
+				// 鎴绫虫爣鏍¢獙
+				if (!this.isNumber(this.productOutForm.endMeterMark)) {
+					this.$u.toast('銆愭埅姝㈢背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒')
+					return
+				}
+				// 鎴绫虫爣闇�澶т簬寮�濮嬬背鏍�
+				if (
+					Number(this.productOutForm.endMeterMark) <
+					Number(this.productOutForm.startMeterMark)
+				) {
+					this.$u.toast('銆愭埅姝㈢背鏍囥�戦渶澶т簬銆愯捣濮嬬背鏍囥��')
+					return
+				}
+				let productStaffs = []
+				let productStaffIds = []
+				this.personBoardList.forEach((item) => {
+					productStaffs.push(item.staffNo)
+					productStaffIds.push(item.staffId)
+				})
+				let productOuts = []
+				let productVo = {
+					isChangeShift: true,
+					id: null,
+					workstationId: this.productOutForm.workstationId,
+					operationTaskId: this.productOutForm.operationTaskId,
+					productOutputList: productOuts
+				}
+				if (this.info.type == "person") {
+					let productOut = null
+					this.personBoardList.forEach((item) => {
+						productOut = {
+							workstationId: this.productOutForm.workstationId,
+							operationTaskId: this.productOutForm.operationTaskId,
+							partId: this.productOutForm.partId,
+							startMeterMark: this.productOutForm.startMeterMark,
+							endMeterMark: this.productOutForm.endMeterMark,
+							productQty: null,
+							productStaffs: [item.staffNo],
+							productStaffIds: [item.staffId],
+							outBatchNo: this.productOutForm.outBatchNo,
+							reelNumber: this.productOutForm.reelNumber,
+							status: true,
+							dutyRecordId: this.info.dutyId,
+							ifsBatchNo: this.productOutForm.ifsBatchNo,
+							scrapQty: this.productOutForm.scrapQty,
+							segmentDesc: this.productOutForm.segmentDesc,
+							remark: this.productOutForm.remark
+						}
+						productOuts.push(productOut)
+					})
+				} else {
+					let productOut = {
+						workstationId: this.productOutForm.workstationId,
+						operationTaskId: this.productOutForm.operationTaskId,
+						partId: this.productOutForm.partId,
+						startMeterMark: this.productOutForm.startMeterMark,
+						endMeterMark: this.productOutForm.endMeterMark,
+						productQty: null,
+						productStaffs: productStaffs,
+						productStaffIds: productStaffIds,
+						outBatchNo: this.productOutForm.outBatchNo,
+						reelNumber: this.productOutForm.reelNumber,
+						status: false,
+						dutyRecordId: this.info.dutyId,
+						ifsBatchNo: this.productOutForm.ifsBatchNo,
+						scrapQty: this.productOutForm.scrapQty,
+						segmentDesc: this.productOutForm.segmentDesc,
+						remark: this.productOutForm.remark
+					}
+					productOuts.push(productOut)
+				}
+				let res = await this.$u.api.outputRegister.saveProductOutput(productVo)
+				let that = this
+				if (res.code == 0) {
+					uni.showModal({
+						title: '鎻愮ず',
+						content: '淇濆瓨鎴愬姛',
+						showCancel: false,
+						success: function() {
+							that.refreshLastPage()
+						}
+					})
+				
+				} else {
+					uni.showModal({
+						title: '鎻愮ず',
+						content: '淇濆瓨澶辫触',
+						showCancel: false,
+						success: function() {}
+					})
+				}
+				
+			},
+			isNumber(value) {
+				var reg = /^[0-9]+(.[0-9]{1,4})?$/
+				if (
+					value == undefined ||
+					value == null ||
+					value === '' ||
+					value.trim === ''
+				) {
+					return false
+				} else {
+					if (!reg.test(value)) {
+						return false
+					} else {
+						return true
+					}
+				}
+			},
+			isPositiveIntegerNumber(value) {
+				var reg = /^[1-9]\d*$/
+				if (
+			 	value == undefined ||
+					value == null ||
+					value === '' ||
+					value.trim === ''
+				) {
+					return false
+				} else {
+					if (!reg.test(value)) {
+						return false
+					} else {
+						return true
+			 	}
+				}
+			},
+			//鍒锋柊涓婁竴涓〉闈�
+			refreshLastPage() {
+				// 鍛婄煡 A.vue 鏇存柊鏁版嵁
+				// 鑾峰彇椤甸潰鏍�
+				let pages = getCurrentPages()
+
+				// 鑾峰彇涓婁竴椤垫爤
+				let prevPage = pages[pages.length - 2]
+
+				// 瑙﹀彂涓婁竴椤� upData 鍑芥暟(骞舵惡甯﹀弬鏁�)
+				prevPage.$vm.refreshTrackingRecord()
+
+				// 杩斿洖涓婁竴椤�
+				uni.navigateBack({
+					delta: 1
+				})
+			}
+		}
+	};
+</script>
+<style lang="scss">
+	.shift-product-out-main-info {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+	}
+
+	.shift-product-out-main-row {
+		padding-bottom: 2px;
+		padding-top: 2px;
+	}
+
+	.shift-product-out-form {
+		.u-form-item {
+			padding: 7rpx;
+		}
+	}
+
+	.shift-product-out-bottom-view {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		height: calc(100vh - var(--window-top) - var(--window-bottom) - 1062rpx);
+	}
+</style>

--
Gitblit v1.9.3