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/InOperation/InOperation.vue |  350 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 297 insertions(+), 53 deletions(-)

diff --git a/minipro_standard/pages/InOperation/InOperation.vue b/minipro_standard/pages/InOperation/InOperation.vue
index 08839c6..0a4b784 100644
--- a/minipro_standard/pages/InOperation/InOperation.vue
+++ b/minipro_standard/pages/InOperation/InOperation.vue
@@ -3,10 +3,11 @@
 		<InOutInfo :info="info" />
 
 		<uni-collapse @change="change" @close="close" @open="open">
-			<uni-collapse-item v-for="(item, index) in wtransferWarehouseList" :key="index">
+			<uni-collapse-item v-if="type==7" v-for="(item1, index) in wtransferWarehouseList" :key="index"
+				:open="item1.wtransferDetailList.length">
 				<view class="p30 cY" style="border-bottom: 4rpx solid #f7f7f7;" slot="title">
 					<image src="../../static/chuku_ic_cangku@2x.png" class="img36 mr10" mode=""></image>
-					<view>{{ item.warehouseName }}</view>
+					<view>{{ item1.warehouseName }}</view>
 				</view>
 				<view class="p30">
 					<div class="page_dck">
@@ -15,7 +16,7 @@
 							<span>寰呭叆搴撶墿鏂�</span>
 						</div>
 					</div>
-					<div class="page_content" v-for="(item, index) in info.woutboundDetailsWait" :key="index"
+					<div class="page_content" v-for="(item, index) in item1.wtransferDetailList" :key="index"
 						:name="index">
 						<div class="page_content_title">
 							<div class="page_content_title_top">
@@ -34,41 +35,37 @@
 								<span>{{item.batch ? item.batch : '-'}}</span>
 							</div>
 						</div>
-						<div class="page_content_list">
+						<div class="page_content_list" v-for="(childer, idxs) in item.wstockExtListVOList" :key="idxs">
 							<div class="page_content_list_item">
 								<div class="page_content_list_item_label">鍏ュ簱璐т綅锛�</div>
-								<div class="page_content_list_item_nr">
-									{{item.locationName ? item.locationName : '-'}}
-								</div>
+								<div class="page_content_list_item_nr">{{ childer.locationName }}</div>
 							</div>
 							<div class="page_content_list_items">
 								<div class="page_content_list_item_label">鏁伴噺锛�</div>
-								<div class="page_content_list_item_nr">{{item.num ? item.num : '-'}}{{item.unitName}}
-								</div>
+								<div class="page_content_list_item_nr">{{ childer.num }}{{ childer.unitName }}</div>
 							</div>
 						</div>
 					</div>
 				</view>
 			</uni-collapse-item>
 		</uni-collapse>
-		<div class="page_h"></div>
+		<div class="page_h"></div>
 		<div class="page_yxwl">
 			<div class="page_yxwl_title">
 				<div class="left">
 					<div class="page_yxwl_title_x"></div>
 					<span>宸查�夋嫨鐗╂枡</span>
-				</div>
-				
+				</div>
+
 				<div class="right" v-if="isZKD" @click="openxz">
 					<image src="../../static/gongdan_ic_shoudong@2x.png" class="img36" mode=""></image><span>鎵嬪姩鍏ュ簱</span>
 					<!-- <img src="@/assets/icon/gongdan_ic_shoudong@2x.png" alt=""> -->
 				</div>
 			</div>
 			<!--        鍏ュ簱鍗曪紙鍗曚釜浠撳簱锛�        -->
-			<template
-				v-if="route.query.type == 9 && info.woScanMaterialBeanList && info.woScanMaterialBeanList.length > 0">
+			<template v-if="type == 9 && woScanMaterialBeanList && woScanMaterialBeanList.length > 0">
 				<div class="page_yxwl_list">
-					<div class="page_yxwl_list_item" v-for="(item, index) in info.woScanMaterialBeanList" :key="index">
+					<div class="page_yxwl_list_item" v-for="(item, index) in woScanMaterialBeanList" :key="index">
 						<div class="page_yxwl_list_item_top">
 							<!--                            <div class="page_yxwl_list_item_top_left" v-if="item.batch">{{item.materialName}} | {{item.materialCode}}锝渰{item.batch}}</div>-->
 							<div class="page_yxwl_list_item_top_left">{{item.materialName}} | {{item.materialCode}}
@@ -109,7 +106,7 @@
 				</div>
 			</template>
 			<!--        杞簱鍗曪紙澶氫釜浠撳簱锛�        -->
-			<template v-else-if="route.query.type == 7 && seleMateriaList.length > 0">
+			<template v-else-if="type == 7 && seleMateriaList.length > 0">
 				<!-- <template v-for="(item, index) in info.wtransferWarehouseList" :key="index"> -->
 				<div class="page_yxwl_list">
 					<div class="page_yxwl_list_item" v-for="(item1, idx) in seleMateriaList" :key="idx">
@@ -159,58 +156,304 @@
 			<div class="page_footer_ck" @click="submit">
 				<span>纭鍏ュ簱</span>
 			</div>
-		</div>
-		<SelectMultipleMaterial ref="selectMultipleMaterial" />
+		</div>
+		<SelectLoaction ref="selectLoaction" @selected="selectLocation" />
+		<MaterialIn ref="materialIn" @selected="selectMaterial" />
 	</view>
 </template>
 
 <script>
-	import InOutInfo from '@/components/InOutInfo.vue'
-	import SelectMultipleMaterial from '@/components/SelectMultipleMaterial.vue'
-	import { QRCodeType } from '@/common/config.js'
+	import InOutInfo from '@/components/InOutInfo.vue'
+	import SelectLoaction from '@/components/SelectLoaction.vue'
+	import MaterialIn from '@/components/materialIn.vue'
+	import {
+		QRCodeType
+	} from '@/common/config.js'
+	import {
+		getList,
+		outScanAppliances,
+		getLocationInfo,
+		saveIn,
+		getInByWTransferId,
+		wTransferForInOut,
+		wOutBoundForInOut,
+		wOutBoundForUpload,
+		transferToInNew
+	} from '@/util/api/ExWarehouse'
+	import {
+		wTransferForInOutUpload
+	} from '@/util/api/ExWarehouse'
+	import {
+		getBarcodeContent,
+		getListByCondition,
+		getListByWarehouseId
+	} from '@/util/api/WorkOrderAPI'
+	import {
+		getDB
+	} from '@/util/api/agencyAPI'
 	export default {
 		components: {
-			InOutInfo,
-			SelectMultipleMaterial
+			InOutInfo,
+			SelectLoaction,
+			MaterialIn
 		},
 		data() {
-			return {
-				type: '',
-				isZKD: false,
+			return {
+				type: '',
+				id: '',
+				wareHouseId: '',
+				isZKD: false,
 				show: false,
-				info: {
-					outPlandate: '2022/02/14',
-					originType: 1,
-					wtransferRedisCodeBeanList: [],
-					remark: 'Vue鏄墠绔紑鍙戜腑骞挎硾浣跨敤鐨勪竴涓狫avaScript妗嗘灦锛屽畠鍙互璁╂垜浠洿杞绘澗鍦扮鐞嗛〉闈㈢殑鐘舵�併�佹覆鏌撳拰浜や簰銆備絾鏄湪缂栧啓Vue搴旂敤鏃讹紝鏈夋椂浼氶亣鍒扳�淪yntaxError: Unexpected token鈥濇姤閿欙紝杩欎釜閿欒鎻愮ず鎰忓懗鐫�浠g爜涓瓨鍦ㄨ娉曢敊璇紝JavaScript寮曟搸鏃犳硶瑙f瀽锛屼粠鑰屽鑷寸▼搴忚繍琛屽け璐ャ�傛湰绡囨枃绔犲皢浠嬬粛甯歌寮曡捣鈥淪yntaxError: Unexpected token鈥濈殑鍘熷洜浠ュ強瑙e喅鏂规硶銆�'
-				},
+				info: {},
 				ids: [],
-				wtransferWarehouseList: [{
-					warehouseName: '娴嬭瘯搴�'
-				}]
+				location: '',
+				locationName: '',
+				wtransferWarehouseList: [],
+				MateriaList: [],
+				woScanMaterialBeanList: [],
+				seleMateriaList: [] // 宸查�夌墿鏂�
 			};
-		},
-		onLoad(option) {
-			this.type = option.type||'ZKD'
-			this.isZKD = this.type==QRCodeType.ZKD
-			// console.log(this.type, QRCodeType.ZKD, this.type==QRCodeType.ZKD);
+		},
+		onLoad(option) {
+			this.type = option.type
+			this.id = option.id
+			this.isZKD = this.type == QRCodeType.ZKD
+			if (option.dbid) {
+				this.getDBs(option.dbid)
+			} else {
+				this.getInfo()
+			}
 		},
 		methods: {
+			getDBs(dbid) {
+				getDB(dbid)
+					.then(res => {
+						let {
+							data
+						} = res
+						if (data.status == 1) {
+							// 宸插畬鎴�
+						} else {
+							this.getInfo()
+						}
+					})
+					.catch(err => {})
+			},
+			getInfo() {
+				let infoAction
+				let data = {
+					id: this.id
+				}
+				// console.log(this.type, QRCodeType.CKD);
+				if (this.type == QRCodeType.RKD) {
+					infoAction = wOutBoundForInOut
+					data.wOutboundType = '1'
+				} else if (this.type == QRCodeType.ZKD) {
+					infoAction = wTransferForInOut
+					data.wTransferType = '1'
+				}
+				infoAction(data).then(res => {
+					if (this.isZKD) {
+						this.info = res.data.wtransfer
+						this.wareHouseId = res.data.wtransfer.inWarehouseId
+						this.wtransferWarehouseList = res.data.wtransferWarehouseList
+						this.MateriaList = res.data.wtransferWarehouseList[0].wtransferDetailList
+					} else {
+						this.info = res.data.woutbound
+						this.woutboundDetailsWait = res.data.woutboundDetailsWait
+						this.woScanMaterialBeanList = res.data.woScanMaterialBeanList
+					}
+				}).catch(err => {
+					uni.$u.toast(err)
+					uni.navigateBack()
+				})
+			},
 			change() {},
 			close() {},
-			open() {},
-			openxz() {
-			  let arr = []
-			  if (this.info.wtransferRedisCodeBeanList.length !== 0) {
-			    this.info.wtransferRedisCodeBeanList.forEach(element => {
-			      arr.push(element.appliancesId)
-			    })
-			    this.ids = arr.join(',')
-			  } else {
-			    this.ids = ''
-			  }
-			 this.$refs.selectMultipleMaterial.open({})
-			},
+			open() {},
+			openxz() {
+				getListByWarehouseId({
+						wareHouseId: this.wareHouseId
+					})
+					.then(res => {
+						if (res.data.length === 1) {
+							this.location = res.data[0].id
+							this.locationName = res.data[0].unionName
+							this.$refs.materialIn.open({
+								list: this.MateriaList
+							})
+						} else {
+							this.$refs.selectLoaction.open({
+								wareHouseId: this.wareHouseId
+							})
+						}
+					})
+			},
+			selectLocation(item) {
+				this.location = item.id
+				this.locationName = item.unionName
+				this.$refs.materialIn.open({
+					list: this.MateriaList
+				})
+			},
+			selectMaterial(val) {
+				let material = JSON.parse(JSON.stringify(val))
+				let tempMaterial = this.seleMateriaList.find(item => item.locationId == this.location)
+				if (tempMaterial) {
+					if (tempMaterial.qualityType == material.qualityType && tempMaterial.procedureId == material
+						.procedureId &&
+						tempMaterial.batch == material.batch && tempMaterial.materialId == material.materialId) {
+						uni.$u.toast('鐩稿悓璐т綅锛屽悓涓�涓墿鏂欏彧鑳芥湁涓�涓�')
+						return
+					}
+				}
+				let materialNum = 0
+				let num = 0
+				this.seleMateriaList.forEach(item => {
+					if (item.id === material.id) {
+						materialNum += Number(item.outActnum)
+					}
+				})
+				this.MateriaList.forEach(item => {
+					if (item.id === material.id) {
+						num = item.outActnum - materialNum
+					}
+				})
+				material.outActnum = num
+				this.seleMateriaList.push({
+					...material,
+					locationId: this.location,
+					locationName: this.locationName
+				})
+			},
+			submit() {
+				if (this.type == QRCodeType.ZKD) {
+					if (!this.seleMateriaList.length) {
+						uni.$u.toast('杞叆鐗╂枡涓嶈兘涓虹┖')
+						return
+					}
+					let result = this.seleMateriaList.reduce((a, b) => {
+						if (a[b.id]) {
+							a[b.id].push(b);
+						} else {
+							a[b.id] = [b];
+						}
+						return a;
+					}, {});
+					for (let i = 0; i < this.MateriaList.length; i++) {
+						for (let a in result) {
+							if (this.MateriaList[i].id == a) {
+								let total = 0
+								for (let b = 0; b < result[a].length; b++) {
+									total = Number(total) + Number(result[a][b].outActnum)
+								}
+								if (!total || total <= 0) {
+									uni.$u.toast('鍏ュ簱鏁伴噺涓嶈兘灏忎簬0')
+									return 
+									// Toast.fail({
+									// 	message: '鍏ュ簱鏁伴噺涓嶈兘灏忎簬0',
+									// 	forbidClick: true,
+									// 	duration: 2000
+									// })
+								}
+								if (total > this.MateriaList[i].outActnum) {
+									uni.$u.toast('鍏ュ簱鏁伴噺涓嶈兘澶т簬寰呭叆搴撴暟閲�')
+									return 
+									// Toast.fail({
+									// 	message: '鍏ュ簱鏁伴噺涓嶈兘澶т簬寰呭叆搴撴暟閲�',
+									// 	forbidClick: true,
+									// 	duration: 2000
+									// })
+								}
+							}
+						}
+					}
+					let submitTransferInDetailDTOList = []
+					this.seleMateriaList.forEach(item => {
+						submitTransferInDetailDTOList.push({
+							inNum: item.outActnum,
+							locationId: item.locationId,
+							wtransferDetailId: item.id
+						})
+					})
+					transferToInNew({
+						submitTransferInDetailDTOList,
+						wtransferId: this.id
+					}).then(res => {
+						if (res.code === 200) {
+							this.$store.dispatch('getUpcomingNum')
+							uni.$u.toast('鎿嶄綔鎴愬姛')
+							if (this.type == '4') { // 璺宠浆瀹屽伐鍏ュ簱璇︽儏
+								// uni.navigateTo({
+								// 	url: 
+								// })
+								// router.push({
+								// 	name: 'completionDetails',
+								// 	query: {
+								// 		id: route.query.id,
+								// 		dbid: route.query.dbid,
+								// 		type: 7,
+								// 		isShow: 2
+								// 	}
+								// })
+								return
+							}
+							uni.redirectTo({
+								url: `/pages_adjust/pages/outboundDetails/outboundDetails?id=${this.id}`
+							})
+							
+							// setTimeout(() => {
+								// if (route.query.Type == '4') { // 璺宠浆瀹屽伐鍏ュ簱璇︽儏
+								// 	router.push({
+								// 		name: 'completionDetails',
+								// 		query: {
+								// 			id: route.query.id,
+								// 			dbid: route.query.dbid,
+								// 			type: 7,
+								// 			isShow: 2
+								// 		}
+								// 	})
+								// 	return
+								// }
+								// router.replace({
+								// 	name: 'wTransferDetail',
+								// 	query: {
+								// 		id: route.query.id
+								// 	}
+								// })
+							// }, 2000)
+						}
+					})
+
+				} else if (this.type === QRCodeType.RKD) {
+					wOutBoundForUpload({
+						id: this.info.id,
+						wOutboundType: 1
+					}).then(res => {
+						if (res.code === 200) {
+							this.$store.dispatch('getUpcomingNum')
+							uni.$u.toast('鎿嶄綔鎴愬姛')
+							uni.redirectTo({
+								url: `/pages_adjust/pages/warehousingDetails1/warehousingDetails1?id=${this.id}`
+							})
+							// Toast.success({
+							// 	message: '鎿嶄綔鎴愬姛',
+							// 	forbidClick: true,
+							// 	duration: 2000
+							// })
+							// setTimeout(() => {
+							// 	// router.go(-1)
+							// 	router.replace({
+							// 		name: 'wInboundDetail',
+							// 		query: {
+							// 			id: this.id
+							// 		}
+							// 	})
+							// }, 2000)
+						}
+					})
+				}
+			}
 		}
 	}
 </script>
@@ -526,6 +769,7 @@
 							}
 
 							.nr {
+								display: flex;
 								font-size: 26rpx;
 								font-weight: 400;
 								color: #222222;

--
Gitblit v1.9.3