From d180226815a7436b6896e28ba9d0f5b369af9c06 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 29 十二月 2023 10:02:50 +0800
Subject: [PATCH] 1.上传模具组件

---
 pages/scgl/scbg.vue |  194 +++++++++++++++++++++++-------------------------
 1 files changed, 94 insertions(+), 100 deletions(-)

diff --git a/pages/scgl/scbg.vue b/pages/scgl/scbg.vue
index 01ed874..7f52dcc 100644
--- a/pages/scgl/scbg.vue
+++ b/pages/scgl/scbg.vue
@@ -11,7 +11,7 @@
 		</view>
 
 		<view v-show="topContent.length!==0">
-			<view class="mainContent" :style="{maxHeight:'1200rpx',overflow: 'scroll'}">
+			<view class="mainContent" :style="{maxHeight:'1260rpx',overflow: 'scroll'}">
 
 				<!-- 鎶ュ伐淇℃伅 -->
 				<u-gap height="15" bgColor="#eff0f1"></u-gap>
@@ -270,8 +270,8 @@
 					<u-checkbox-group @change="checkboxChange" size='20px' v-model="checkBoxValue" iconPlacement="right"
 						placement="column">
 						<view v-for="(item,index) in badSelectArr">
-							<u-checkbox activeColor="rgb(0, 102, 255)" labelSize='18' :key="item.code" :name='item.name'
-								:label="item.name">
+							<u-checkbox activeColor="rgb(0, 102, 255)" labelSize='18' :key="item.code+index"
+								:name='item.name' :label="item.name">
 							</u-checkbox>
 							<u-divider :key="item.code"></u-divider>
 						</view>
@@ -288,8 +288,8 @@
 					<u-checkbox-group @change="userCheckboxChange" size='20px' v-model="userCheckBoxValue"
 						iconPlacement="right" placement="column">
 						<view v-for="(item,index) in userSelectArrAll">
-							<u-checkbox activeColor="rgb(0, 102, 255)" labelSize='18' :key="item.code" :name='item.name'
-								:label="item.name">
+							<u-checkbox activeColor="rgb(0, 102, 255)" labelSize='18' :key="item.code+index"
+								:name='item.name' :label="item.name">
 							</u-checkbox>
 							<u-divider :key="item.code"></u-divider>
 						</view>
@@ -369,7 +369,9 @@
 		EqpPermissionsPlus,
 		GroupsPermissions,
 		GroupsPersonPermissions,
-		DefectPermissions
+		DefectPermissions,
+		SavaMesOrderStepReport,
+		LabelBarCode
 	} from '../../config/api.js';
 	// import scanCode from '@/components/scan-code/scan-code.vue'
 	export default {
@@ -469,7 +471,7 @@
 			this.init()
 
 
-			this.getMesOrderStepStart('SGPO20231110_1;101')
+			// this.getMesOrderStepStart('SGPO20231110_1;101')
 
 
 
@@ -646,6 +648,7 @@
 			},
 
 			async submit() {
+				// 涓嬪崍鍐欑敓浜ф姤宸ユ彁浜�
 
 				if (this.reckway === '鐝粍' && this.userGroupSheetValue === "") {
 					return uni.$u.toast('鐢熶骇鐝粍涓嶈兘涓虹┖锛�')
@@ -660,38 +663,18 @@
 					return uni.$u.toast('鎶ュ伐鏁伴噺涓嶈兘涓虹┖锛�')
 				}
 
-				if (this.reckway === '鐝粍' && this.userArr.length === 0) {
+				if (parseFloat(this.reportqty) + parseFloat(this.ngqty) > parseFloat(this.topContent[0].noreportqty)) {
+					return uni.$u.toast('鎶ュ伐鏁伴噺鍔犱笉鑹暟閲忎笉鑳藉ぇ浜庢湭鎶ユ暟閲忥紒')
+				}
+
+
+				if (this.reckway === '鐝粍' && this.operSheetValue.length === 0) {
 					return uni.$u.toast('鎶ュ伐浜哄憳淇℃伅涓嶈兘涓虹┖锛�')
 				}
 
-				if (this.reckway === '鐝粍') {
-					let sum = 0
-					this.userArr.forEach(item => {
-						console.log(item.ratio, 'item.ratio')
-						sum += parseFloat(item.ratio)
-					})
-					sum = parseFloat(sum)
-					console.log(sum, 'sum44')
-					if (Math.round(sum * 100) / 100 !== 100) {
-						return uni.$u.toast('鍒嗛厤姣斾緥鎬诲拰蹇呴』涓�100锛�')
-					}
-				}
 
-
-				const header = {
-					// 'Content-Type': 'multipart/form-data',
-					'Content-Type': 'application/x-www-form-urlencoded',
-					'rediskey': uni.getStorageSync('rediskey'),
-					'admin': uni.getStorageSync('usercode'),
-					'username': encodeURIComponent(uni.getStorageSync('username')),
-					'navTabId': uni.getStorageSync('usercode'),
-					'userid': uni.getStorageSync('userid'),
-					'guid': uni.getStorageSync('guid'),
-					'usertype': 'APP'
-				}
 
 				let badcode = []
-
 
 				if (this.badSheetValue.length > 0) {
 					this.badSelectArr.forEach(i => {
@@ -709,84 +692,95 @@
 
 
 
-				let reportuser = ''
+				let reportuser = []
 
-				// if (this.$company === 'A') {
-				// 	reportuser = this.reckway === '鐝粍' ? JSON.stringify(this.userArr) : JSON.stringify([{
-				// 		usercode: this.operSheetValue,
-				// 		ratio: 100
-				// 	}])
-				// } else {
-				reportuser = this.userArr.map(i => i.usercode).join(';') //鎶ュ伐浜哄憳
-				// }
+				if (this.operSheetValue.length > 0) {
+					this.userSelectArrAll.forEach(i => {
+						if (this.operSheetValue.split(',').includes(i.name)) {
+							reportuser.push(i.code)
+						}
+					})
+				}
+
+				console.log(this.userSelectValue);
+				// reportuser = this.userArr.map(i => i.usercode).join(';') //鎶ュ伐浜哄憳
+
+
+
+				const D = {
+					rightcode: '0601',
+					partcode: this.topContent[0].partnumber,
+					qty: parseFloat(this.reportqty),
+					onelabqty: parseFloat(this.reportqty)
+				}
+				const {
+					data: R
+				} = await LabelBarCode(D)
 
 
 				const data = {
-					admin: uni.getStorageSync('usercode'),
-					mesordercode: this.formData.wo_code, // 宸ュ崟缂栧彿
-					partcode: this.formData.partnumber, // 浜у搧缂栫爜
-					stepseq: this.formData.seq, // 宸ュ簭搴忓彿
-					stepcode: this.formData.stepcode, // 宸ュ簭缂栫爜
-					eqpcode: this.eqpSheetList.find(i => i.name === this.eqpSheetValue).code, // 璁惧缂栫爜
-					taskqty: this.formData.planqty, // 浠诲姟鏁伴噺
-					startqty: this.formData.reportqty, // 寮�宸ユ暟閲�
+					mesordercode: this.topContent[0].wo_code,
+					partcode: this.topContent[0].partnumber,
+					stepseq: this.topContent[0].seq,
+					stepcode: this.topContent[0].stepcode,
+					stepprice: this.topContent[0].stepprice,
+
+					eqpcode: this.eqpSheetList.find(i => i.name === this.eqpSheetValue).code,
+
+					reckway: this.reckway === '鐝粍' ? 'group' : 'person',
+
 					usergroupcode: this.userGroupSheetValue ? this.userGroupSheetList.find(i => i.name === this
 						.userGroupSheetValue).code : '', // 鐝粍缂栫爜
-					reportqty: parseFloat(this.reportqty), // 鎶ュ伐鏁伴噺
-					// reportuser: this.userArr.map(i => i.usercode).join(';'), //鎶ュ伐浜哄憳
-					reportuser,
-
-					//鎶ュ伐浜哄憳
-					remarks: '', // 澶囨敞
-					reckway: this.reckway === '鐝粍' ? 'group' : 'person', //
-					ngqty: this.ngqty === '' ? 0 : this.ngqty, //涓嶈壇鏁伴噺
-					badcode: badcode.join(';'), //涓嶈壇鍘熷洜
-
-					inbarcode: '', //鎵爜鍏ュ簱
+					reportuser: this.reckway === '鐝粍' ? reportuser.join(',') : this.userSelectArrAll.find(i => i
+						.name === this.operSheetValue).code,
+					taskqty: this.topContent[0].planqty,
+					startqty: parseFloat(this.reportqty),
+					reportqty: parseFloat(this.reportqty),
+					inbarcode: R[0].labcode, //鍏ュ簱鏉$爜
+					defectlist: badcode.length > 0 ? [{
+						defect_code: badcode.join(','),
+						badqty: this.ngqty
+					}] : [],
+					remarks: ''
 				}
 
-				console.log(data, 7777)
-
+				console.log(JSON.parse(JSON.stringify(data)), 7777)
 				this.isDisabledSubmitButton = true
-				uni.uploadFile({
-					url: this.$baseUrl + '/AppProductionManagement/SavaMesOrderStepReport',
-					files: [{
-						"uri": "/"
-					}],
-					header: header,
-					formData: data,
-					success: (res) => {
-						uni.$u.toast('鎶ュ伐鎴愬姛锛�')
-						this.topContent = []
-						this.formData = {}
-						this.reportqty = ''
-						this.ngqty = ''
-						this.reckway = '涓汉'
-						this.userGroupSheetValue = ''
-						this.eqpSheetValue = ''
-						this.userGroupSheetList = []
-						this.eqpSheetList = []
-						this.badSelectArr = []
-						this.badSheetValue = []
-						this.checkBoxValue = []
-						this.operSheetValue = ''
-						this.operSheetList = []
-						this.userArr = []
-						this.userSelectValue = ''
-						this.userSelectArrAll = []
-						this.userSelectArr = []
-						this.userGroupColumns = []
-						this.eqpColumns = []
-						this.operColumns = []
+				const res = await SavaMesOrderStepReport(data)
+				if (res.code === '200') {
+					uni.$u.toast('鎶ュ伐鎴愬姛锛�')
+					this.topContent = []
+					this.formData = {}
+					this.reportqty = ''
+					this.ngqty = ''
+					this.reckway = '涓汉'
+					this.userGroupSheetValue = ''
+					this.eqpSheetValue = ''
+					// this.userGroupSheetList = []
+					// this.eqpSheetList = []
+					// this.badSelectArr = []
+					this.badSheetValue = []
+					this.checkBoxValue = []
+					this.operSheetValue = ''
+					// this.operSheetList = []
+					// this.userArr = []
+					this.userSelectValue = ''
+					// this.userSelectArrAll = []
+					// this.userSelectArr = []
+					// this.userGroupColumns = []
+					// this.eqpColumns = []
+					// this.operColumns = []
+
+					this.userCheckBoxValue = []
+					this.userSheetShow = false
 
 
-						this.isDisabledSubmitButton = false
-					},
-					fail(res) {
-						uni.$u.toast('鎶ュ伐澶辫触锛�')
-						this.isDisabledSubmitButton = false
-					},
-				})
+					this.isDisabledSubmitButton = false
+				}
+
+
+
+
 
 			},
 			userGroupSheetSelect(val) {

--
Gitblit v1.9.3