From d7fe8ae3888c8e2b1eea3c1e3769be0d42a21cc9 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 16 十月 2023 09:03:47 +0800
Subject: [PATCH] Merge branch '1.0.3' of http://139.186.142.91:10010/r/productDev/dmMes into 1.0.3

---
 minipro_standard/pages_adjust/pages/addReceipt/addReceipt.vue |  333 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 273 insertions(+), 60 deletions(-)

diff --git a/minipro_standard/pages_adjust/pages/addReceipt/addReceipt.vue b/minipro_standard/pages_adjust/pages/addReceipt/addReceipt.vue
index 4e5b4ab..367bb5f 100644
--- a/minipro_standard/pages_adjust/pages/addReceipt/addReceipt.vue
+++ b/minipro_standard/pages_adjust/pages/addReceipt/addReceipt.vue
@@ -20,90 +20,119 @@
 			<view class="rework_qd_title">
 				<view class="rework_qd_title_left">
 					<view class="x"></view>
-					<text>{{`鍏ュ簱鐗╂枡娓呭崟${list.length}`}}</text>
+					<text>鍏ュ簱鐗╂枡娓呭崟</text>
 				</view>
 				<view class="rework_qd_title_right" @click="addItem()">
 					<image src="@/static/gongdan_ic_shoudong@2x.png" mode="widthFix"></image>
 					<text>澧炲姞鍏ュ簱</text>
 				</view>
 			</view>
-			<van-swipe-cell v-for="(item, index) in list" :key="index">
-				<view class="rework_qd_list">
-					<view class="rework_qd_item">
-						<text><b>*</b>鍏ュ簱璐т綅</text>
-						<view class="rework_qd_item_right">
-							<text :class="item.locationName ? 'black' : ''">{{item.locationName ? item.locationName : '璇烽�夋嫨'}}</text>
-							<u-icon name="arrow-right"></u-icon>
-						</view>
-					</view>
-					<view class="rework_qd_item">
-						<text><b>*</b>鍏ュ簱鐗╂枡</text>
-						<view class="rework_qd_item_right">
-							<text :class="item.materialName ? 'black' : ''">{{item.materialName ? item.materialName : '璇烽�夋嫨'}}</text>
-							<u-icon name="arrow-right"></u-icon>
-						</view>
-					</view>
-					<template v-if="form.type !== 25">
-						<view class="rework_qd_item">
-							<text>鐢熶骇宸ュ簭</text>
+			<u-swipe-action :autoClose="true">
+				<u-swipe-action-item v-for="(item, index) in list" :key="index" @click="dele($event, index)" :options="item.options">
+					<view class="rework_qd_list">
+						<view class="rework_qd_item" @click="openL(index)">
+							<text><b>*</b>鍏ュ簱璐т綅</text>
 							<view class="rework_qd_item_right">
-								<text :class="item.procedureName ? 'black' : ''">{{item.procedureName ? item.procedureName : '璇烽�夋嫨'}}</text>
+								<text :class="item.locationName ? 'black' : ''">{{item.locationName ? item.locationName : '璇烽�夋嫨'}}</text>
 								<u-icon name="arrow-right"></u-icon>
 							</view>
 						</view>
-					</template>
-					<view class="rework_qd_item">
-						<text><b>*</b>璐ㄩ噺灞炴��</text>
-						<view class="rework_qd_item_right">
-							<text :class="item.qualityTypeName ? 'black' : ''">{{item.qualityTypeName ? item.qualityTypeName : '璇烽�夋嫨'}}</text>
-							<u-icon name="arrow-right"></u-icon>
+						<view class="rework_qd_item" @click="openMaterial(index)">
+							<text><b>*</b>鍏ュ簱鐗╂枡</text>
+							<view class="rework_qd_item_right">
+								<text :class="item.materialName ? 'black' : ''">{{item.materialName ? item.materialName : '璇烽�夋嫨'}}</text>
+								<u-icon name="arrow-right"></u-icon>
+							</view>
+						</view>
+						<template v-if="form.type !== 25">
+							<view class="rework_qd_item" @click="openGX(index)">
+								<text>鐢熶骇宸ュ簭</text>
+								<view class="rework_qd_item_right">
+									<text :class="item.procedureName ? 'black' : ''">{{item.procedureName ? item.procedureName : '璇烽�夋嫨'}}</text>
+									<u-icon name="arrow-right"></u-icon>
+								</view>
+							</view>
+						</template>
+						<view class="rework_qd_item" @click="openQ(index)">
+							<text><b>*</b>璐ㄩ噺灞炴��</text>
+							<view class="rework_qd_item_right">
+								<text :class="item.qualityTypeName ? 'black' : ''">{{item.qualityTypeName ? item.qualityTypeName : '璇烽�夋嫨'}}</text>
+								<u-icon name="arrow-right"></u-icon>
+							</view>
+						</view>
+						<view class="rework_qd_item">
+							<text>鎵规鍙�</text>
+							<view class="rework_qd_item_right">
+								<u--input placeholder="璇疯緭鍏�" inputAlign="right" :customStyle="{width: '230rpx'}" border="surround" v-model="item.batch"></u--input>
+							</view>
+						</view>
+						<view class="rework_qd_item">
+							<text><b>*</b>鍏ュ簱鏁伴噺<template v-if="item.unitName">({{ item.unitName }})</template></text>
+							<view class="rework_qd_item_right">
+								<u--input placeholder="0" inputAlign="right" :customStyle="{width: '230rpx'}" border="surround" v-model="item.num"></u--input>
+							</view>
 						</view>
 					</view>
-					<view class="rework_qd_item">
-						<text>鎵规鍙�</text>
-						<view class="rework_qd_item_right">
-							<u--input placeholder="璇疯緭鍏�" style="width: 230rpx;" border="surround" v-model="item.batch"></u--input>
-						</view>
-					</view>
-					<view class="rework_qd_item">
-						<text><b>*</b>鍏ュ簱鏁伴噺<template v-if="item.unitName">({{ item.unitName }})</template></text>
-						<view class="rework_qd_item_right">
-							<u--input placeholder="0" border="surround" v-model="item.num"></u--input>
-						</view>
-					</view>
-				</view>
-				<template #right>
-					<van-button style="height: 100%;" square type="danger" text="鍒犻櫎" @click="dele(index)" />
-				</template>
-			</van-swipe-cell>
+				</u-swipe-action-item>
+			</u-swipe-action>
 		</view>
 		<view class="rework_zw"></view>
+		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
 		<view class="rework_footer">
-			<button class="rework_footer_submit">鎻愪氦</button>
+			<button class="rework_footer_submit" @click="onConfirm()">鎻愪氦</button>
 		</view>
 		<u-toast ref="uToast"></u-toast>
 		<!-- 浠撳簱 -->
 		<Warehouse :show="warehouseShow" @close="close" @value="getValue" />
+<<<<<<< HEAD
+		<!-- 鐗╂枡 -->
+		<Material :show="materialsShow" @close="close1" @value="getValue1" />
 		<!-- 璐т綅 -->
-		<location :show="locationShow" @close="close1" @value="getValue1" />
+		<location :show="locationShow" :list="locationList" @close="close3" @value="getValue3" />
+		<!-- 宸ュ簭 -->
+		<ProductionProcess :show="productionShow" :list="productionList" @close="productionShow = false" @value="getValue4" />
 		<!-- 鍗曟嵁绫诲瀷 -->
 		<u-picker :show="typeShow" keyName="name" :columns="typeList" @confirm="confirm" @cancel="typeClose"></u-picker>
+		<!-- 璐ㄩ噺灞炴�� -->
+		<u-picker :show="qualityShow" :columns="columns" @cancel="qualityShow = false" keyName="name" @confirm="onConfirm1"></u-picker>
+=======
+>>>>>>> 89d77a7cd7285feda993bffec2513892f8bd355f
 	</view>
 </template>
 
 <script>
 	import Warehouse from '../../components/Warehouse.vue'
+<<<<<<< HEAD
 	import location from '../../components/location.vue'
+	import Material from '../../components/Material.vue'
+	import ProductionProcess from '../../components/ProductionProcess.vue'
+	import { getListByWarehouseId, wOutBoundForStockUp } from '@/util/api/WorkOrderAPI'
+	import { getListByMaterialId } from '@/util/api/ExWarehouse'
 	export default {
-		components: { Warehouse, location },
+		components: { Warehouse, location, Material, ProductionProcess },
+=======
+	export default {
+		components: { Warehouse },
+>>>>>>> 89d77a7cd7285feda993bffec2513892f8bd355f
 		data() {
 			return {
+				i: 0,
 				form: {
 					warehouseName: '',
 					warehouseId: '',
 					type: '',
 					typeName: ''
 				},
+<<<<<<< HEAD
+				locationList: [],
+				productionList: [],
+				columns: [
+					[
+						{ name: '鍚堟牸', id: '0' },
+						{ name: '涓嶈壇', id: '1' },
+						{ name: '鎶ュ簾', id: '2' }
+					]
+				],
 				list: [
 					{
 						batch: '',
@@ -119,38 +148,218 @@
 						qualityType: '',
 						qualityTypeName: '',
 						unitId: '',
-						unitName: ''
+						unitName: '',
+						options: [
+							{
+								text: '鍒犻櫎',
+								style: {
+									backgroundColor: '#f56c6c'
+								}
+							}
+						]
 					}
 				],
 				typeList: [[{name: '閲囪喘鍏ュ簱', id: 25}, {name: '搴撳瓨璋冩暣', id: 28}]],
 				warehouseShow: false,
 				typeShow: false,
-				locationShow: false
+				locationShow: false,
+				materialsShow: false,
+				productionShow: false,
+				qualityShow: false
 			};
 		},
 		methods: {
+			dele(e, index) {
+				if (this.list.length === 1) return uni.showToast({ title: '璇烽�夋嫨鍗曟嵁绫诲瀷', icon: 'none', duration: 2000 });
+				this.list.splice(index, 1)
+			},
+			// 閫夋嫨宸ュ簭
+			getValue4(item) {
+				this.list[this.i].procedureId = item.id
+				this.list[this.i].procedureName = item.name
+				this.productionShow = false
+			},
+			// 鎻愪氦
+			onConfirm() {
+				if (!this.form.type) return uni.showToast({ title: '璇烽�夋嫨鍗曟嵁绫诲瀷', icon: 'none', duration: 2000 });
+				if (!this.form.warehouseId) return uni.showToast({ title: '璇烽�夋嫨鍏ュ簱浠撳簱', icon: 'none', duration: 2000 });
+				if (this.list.length === 0) return uni.showToast({ title: '璇峰厛娣诲姞鍏ュ簱鐗╂枡', icon: 'none', duration: 2000 });
+				for (let i = 0; i < this.list.length; i++) {
+					if (!this.list[i].locationId) return uni.showToast({ title: `绗�${i+1}椤瑰叆搴撹揣浣嶄笉鑳戒负绌篳, icon: 'none', duration: 2000 });
+					if (!this.list[i].materialId) return uni.showToast({ title: `绗�${i+1}椤瑰叆搴撶墿鏂欎笉鑳戒负绌篳, icon: 'none', duration: 2000 });
+					if (!this.list[i].qualityType) return uni.showToast({ title: `绗�${i+1}椤硅川閲忓睘鎬т笉鑳戒负绌篳, icon: 'none', duration: 2000 });
+					if (this.list[i].num <= 0) {
+						return uni.showToast({ title: `绗�${i + 1}椤瑰叆搴撴暟閲忓繀椤诲ぇ浜�0`, icon: 'none', duration: 2000 });
+					}
+				}
+				wOutBoundForStockUp({
+					type: this.form.type,
+					planDate: this.getDay(),
+					validDate: this.getDay(),
+					warehouseId: this.form.warehouseId,
+					woutboundInBodyBeanList: this.list
+				}).then(res => {
+					if (res.code === 200) {
+						uni.showToast({ title: '鍏ュ簱鎴愬姛', icon: 'success', duration: 2000 });
+						setTimeout(() => {
+							uni.navigateBack({ delta: 1 });
+						}, 2000)
+					}
+				})
+			},
+			// 鑾峰彇褰撳ぉ骞存湀鏃�
+			getDay() {
+				var date = new Date();
+				var year = date.getFullYear();
+				var month = date.getMonth() + 1;
+				var day = date.getDate();
+				return `${year}-${month <= 9 ? `0${month}` : month}-${day <= 9 ? `0${day}` : day}`
+			},
+			// 鎵撳紑閫夋嫨鐗╂枡
+			openQ(index) {
+				if (this.list[index].locationIdLabel == 'APPLIANCE_ONTEST' || this.list[index].locationIdLabel == 'APPLIANCE_OFFTEST' || this.list[index].locationIdLabel == 'APPLIANCE_USELESS') {
+					return
+				}
+				this.i = index
+				this.qualityShow = true
+			},
+			// 鎵撳紑宸ュ簭
+			openGX(index) {
+				if (!this.list[index].materialId) return uni.showToast({ title: '璇峰厛閫夋嫨鍏ュ簱鐗╂枡', icon: 'none', duration: 2000 });
+				this.i = index
+				this.productionShow = true
+			},
+			// 鎵撳紑閫夋嫨璐т綅
+			openL(index) {
+				if (!this.form.warehouseId) return uni.showToast({ title: '璇烽�夋嫨鍏ュ簱浠撳簱', icon: 'none', duration: 2000 });
+				this.i = index
+				this.locationShow = true
+			},
+			// 鎵撳紑閫夋嫨鐗╂枡
+			openMaterial(index) {
+				this.i = index
+				this.materialsShow = true
+			},
+			// 璐ㄩ噺灞炴�х‘璁�
+			onConfirm1(value) {
+				this.list[this.i].qualityType = value.value[0].id
+				this.list[this.i].qualityTypeName = value.value[0].name
+				this.qualityShow = false
+			},
+			// 閫夋嫨鐗╂枡
+			getValue1(item) {
+				this.list[this.i].materialName = item.mmodelUnionName
+				this.list[this.i].materialId = item.id
+				this.list[this.i].unitId = item.unitId
+				this.list[this.i].hasBom = item.hasBom
+				this.list[this.i].unitName = item.umodelName
+				// 鑾峰彇鐗╂枡涓嬪伐搴�
+				getListByMaterialId({
+					materialId: item.id
+				}).then(res => {
+					if (res.code === 200) {
+						this.productionList = res.data
+						this.list[this.i].procedureId = ''
+						this.list[this.i].procedureName = ''
+					}
+				})
+				this.materialsShow = false
+			},
+			// 鍏抽棴浠撳簱閫夋嫨寮规
+			close1() {
+				this.materialsShow = false
+			},
+			// 閫夋嫨璐т綅
+			getValue3(item) {
+				this.list[this.i].locationId = item.id
+				this.list[this.i].locationName = item.unionName
+				this.list[this.i].qualityType = ''
+				this.list[this.i].qualityTypeName = ''
+				this.list[this.i].locationIdLabel = item.label
+				if (item.label === 'APPLIANCE_ONTEST') {
+					this.list[this.i].qualityType = '0'
+					this.list[this.i].qualityTypeName = '鍚堟牸'
+				} else if (item.label === 'APPLIANCE_OFFTEST') {
+					this.list[this.i].qualityType = '1'
+					this.list[this.i].qualityTypeName = '涓嶈壇'
+				} else if (item.label === 'APPLIANCE_USELESS') {
+					this.list[this.i].qualityType = '2'
+					this.list[this.i].qualityTypeName = '鎶ュ簾'
+				}
+				this.locationShow = false
+			},
+			// 鍏抽棴璐т綅閫夋嫨寮规
+			close3() {
+				this.locationShow = false
+			},
 			// 纭鍗曟嵁绫诲瀷
 			confirm(val) {
 				this.form.type = val.value[0].id
 				this.form.typeName = val.value[0].name
+				if (val.value[0].id == 25) {
+					this.list.forEach(item => {
+						item.procedureId = ''
+						item.procedureName = ''
+					})
+				}
 				this.typeShow = false
 			},
 			// 浠撳簱纭
 			getValue(val) {
 				this.form.warehouseName = val.name
 				this.form.warehouseId = val.id
+				getListByWarehouseId({ wareHouseId: val.id })
+					.then(res => {
+						if (res.code === 200) {
+							this.locationList = res.data
+							if (res.data.length === 1) {
+								this.location = false
+								this.list.forEach(item => {
+									item.locationId = res.data[0].id
+									item.locationName = res.data[0].unionName
+								})
+								this.list[this.i].locationIdLabel = res.data[0].label
+								if (res.data[0].label === 'APPLIANCE_ONTEST') {
+									this.list[this.i].qualityType = '0'
+									this.list[this.i].qualityTypeName = '鍚堟牸'
+								} else if (res.data[0].label === 'APPLIANCE_OFFTEST') {
+									this.list[this.i].qualityType = '1'
+									this.list[this.i].qualityTypeName = '涓嶈壇'
+								} else if (res.data[0].label === 'APPLIANCE_USELESS') {
+									this.list[this.i].qualityType = '2'
+									this.list[this.i].qualityTypeName = '鎶ュ簾'
+								}
+							} else {
+								this.location = true
+								this.list.forEach(item => {
+									item.locationId = res.data[0].id
+									item.locationName = res.data[0].unionName
+								})
+							}
+						}
+					})
 				this.warehouseShow = false
 			},
 			typeClose() {
 				this.typeShow = false
 			},
+=======
+				list: [],
+				warehouseShow: false
+			};
+		},
+		methods: {
+			getValue(val) {
+				this.warehouseShow = false
+			},
+>>>>>>> 89d77a7cd7285feda993bffec2513892f8bd355f
 			close() {
 				this.warehouseShow = false
 			},
 			// 娣诲姞鏄庣粏
 			addItem() {
 				if (!this.form.warehouseId) return this.$refs.uToast.show({ type: 'default', message: "璇烽�夋嫨鍏ュ簱浠撳簱" })
-				this.list.push({
+				this.list.unshift({
 					batch: '',
 					locationId: this.list[this.list.length - 1].locationId,
 					locationName: this.list[this.list.length - 1].locationName,
@@ -164,21 +373,25 @@
 					qualityType: this.list[this.list.length - 1].qualityType,
 					qualityTypeName: this.list[this.list.length - 1].qualityTypeName,
 					unitId: '',
-					unitName: ''
+					unitName: '',
+					options: [
+						{
+							text: '鍒犻櫎',
+							style: {
+								backgroundColor: '#f56c6c'
+							}
+						}
+					]
 				})
-			},
-			// 鍒犻櫎
-			dele(index) {
-				if (this.list.length === 1) {
-					this.$refs.uToast.show({ type: 'default', message: "鑷冲皯淇濈暀涓�鏉$墿娴佹竻鍗曚俊鎭�" })
-					return
-				}
-				this.list.splice(index, 1)
 			}
 		}
 	}
 </script>
-
+<style>
+	.u-swipe-action-item__right {
+		z-index: 9;
+	}
+</style>
 <style lang="scss" scoped>
 	.rework {
 		width: 100%;

--
Gitblit v1.9.3