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/pick/materialTransfer.vue |  582 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 582 insertions(+), 0 deletions(-)

diff --git a/pages/product/pick/materialTransfer.vue b/pages/product/pick/materialTransfer.vue
new file mode 100644
index 0000000..6210972
--- /dev/null
+++ b/pages/product/pick/materialTransfer.vue
@@ -0,0 +1,582 @@
+<template>
+	<view class="wrap">
+		<scroll-view class="scroll-list material-transfer-detail" scroll-y="true" @scrolltolower="loadMore">
+			<u-cell-group class="list material-transfer-detail-cell" :border="false">
+				<u-card :title="item.partNo" :sub-title="item.partNo" v-for="(item, index) in list" :key="item.id"
+					:index="item.id" @click="materialCardClick(item)" :showHead="showCardHead"
+					:bodyStyle="item.selected?bodyStyle:{}">
+					<view slot="body">
+							<view class="item u-border-bottom" 
+								>
+								<view>
+									<view style="text-align: right;">
+										<u-button type="primary" style="height: 80rpx;line-height: 80rpx;width: 100rpx;" text="鏇存柊" size="mini"
+											@click.stop="updateDetail(item.id)">鏇存柊</u-button>
+											<u-button type="error" style="height: 80rpx;line-height: 80rpx;width: 100rpx;" text="鍒犻櫎" size="mini" :customStyle="{marginLeft:'20rpx'}"
+												@click.stop="deleteDetail(item.id)">鍒犻櫎</u-button>
+									</view>
+								</view>
+								<view>
+								<view class="row-list">
+									<u-row justify="space-between">
+										<u-col span="4">
+											<span class="span-lable">闆朵欢鍙�</span>
+										</u-col>
+										<u-col span="8">
+											<view>
+												<span>{{item.partNo}}</span>
+											</view>
+										</u-col>
+									</u-row>
+								</view>
+								<view class="row-list">
+									<u-row justify="space-between">
+										<u-col span="4">
+											<span class="span-lable">闆朵欢鎻忚堪</span>
+										</u-col>
+										<u-col span="8">
+											<view>
+												<span>{{item.partDesc}}</span>
+
+											</view>
+										</u-col>
+									</u-row>
+								</view>
+
+								<view class="row-list">
+									<u-row justify="space-between">
+										<u-col span="4">
+											<span class="span-lable">鎵规鍙�</span>
+										</u-col>
+										<u-col span="8">
+											<view>
+												<span>{{item.batchNo}}</span>
+											</view>
+										</u-col>
+									</u-row>
+								</view>
+								<view class="row-list">
+									<u-row justify="space-between">
+										<u-col span="4">
+											<span class="span-lable">绉诲簱鏁伴噺</span>
+										</u-col>
+										<u-col span="8">
+											<view>
+												<u-input class="custom-edit-input" v-model="item.transferQuantity"
+													type="text" :clearable=false height="50">
+												</u-input>
+											</view>
+										</u-col>
+									</u-row>
+								</view>
+								<view class="row-list">
+									<u-row justify="space-between">
+										<u-col span="4">
+											<span class="span-lable">IFS浠庡簱浣�</span>
+										</u-col>
+										<u-col span="8">
+											<view>
+
+												<span>{{item.fromIfsLocationNo}}</span>
+											</view>
+										</u-col>
+									</u-row>
+								</view>
+								<view class="row-list">
+									<u-row justify="space-between">
+										<u-col span="4">
+											<span class="span-lable">IFS鑷冲簱浣�</span>
+										</u-col>
+										<u-col span="8">
+											<view>
+												<span>{{item.toIfsLocationNo}}</span>
+
+											</view>
+										</u-col>
+									</u-row>
+								</view>
+								</view>
+							</view>
+					</view>
+
+				</u-card>
+			</u-cell-group>
+			<view class="loadmore" @click="loadMore">
+				<u-loadmore :status="loadStatus"></u-loadmore>
+			</view>
+		</scroll-view>
+		<!--<view class="view-fixed-one">
+			<u-button type="success" text="鎵爜" size="medium" 
+				@click="scanMaterialCodeClick()">鎵爜</u-button>
+		</view>-->
+		<view class="view-fixed-two">
+			<u-button type="success" text="搴撲綅" style="height: 80rpx;line-height: 80rpx;" size="medium" :customStyle="{borderRadius:'0rpx'}"
+				@click="toLocations()">搴撲綅</u-button>
+			<u-button type="success" text="鎵ц" style="height: 80rpx;line-height: 80rpx;" size="medium"
+				:customStyle="{width:'320rpx',marginLeft:'30rpx',borderRadius:'0rpx'}" @click="executeMove()">鎵ц</u-button>
+		</view>
+		<scan></scan>
+	</view>
+</template>
+<script>
+	import scan from "@/components/scan/scan.vue";
+	export default {
+		components: {
+		   scan
+		  },
+		data() {
+			return {
+				showCardHead: false,
+				query: {
+					current: 1,
+					size: 20
+				},
+				list: [],
+				options: [{
+						text: '鏇存柊',
+						style: {
+							backgroundColor: '#007aff'
+						}
+					},
+					{
+						text: '鍒犻櫎',
+						style: {
+							backgroundColor: '#dd524d'
+						}
+					}
+				],
+				loadStatus: 'loadmore',
+				bodyStyle: {
+					background: '#bbf59c'
+				},
+				isfStockList: [],
+				materialNeedList: [],
+				transportsId: null,
+				currStock: null
+			};
+		},
+		onLoad(params) {
+			if (params && params.id !== "undefined") {
+				this.transportsId = params.id
+				this.query.transportsId = params.id
+				this.loadList();
+			}
+		},
+		onShow() {
+		   
+		   let that = this
+		     
+		   uni.$off('scan') // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒
+		   uni.$on('scan', function(data) {
+		    console.log('onscan');
+		    //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲�
+		    console.log('鎵爜缁撴灉锛�', data.code);
+			let sanCode=data.code
+		    let formatData = JSON.parse(sanCode.replace(/\n/g,"").replace(/\s*/g,''));
+			console.log('formatData锛�', formatData);
+			console.log('formatData.BatchNumber锛�', formatData.BatchNumber);
+			
+			let materialInfo={
+				batchNo: formatData.BatchNumber,
+				partNo:  formatData.erpPartNo,
+				wdr: formatData.wdr
+			}
+			that.scanMaterialCodeClick(materialInfo)
+		   })
+		  },
+		  onNavigationBarButtonTap(e) {
+		  	uni.scanCode({
+		  		success: res => {
+		  			try {
+		  				const result = JSON.parse(res.result)
+		  
+		  			} catch (e) {}
+		  		}
+		  	});
+		  },
+		methods: {
+			updateDetail(id){
+				let k = this.list.findIndex(
+					(item) => item.id === id
+				)
+				let material = this.list.find((item) => {
+					return item.id === id
+				})
+				let transportsDetail = {
+					id: id,
+					transferQuantity: material.transferQuantity
+				}
+				
+				this.$u.api.palletTransportsDetail.updateDetail(transportsDetail).then(res => {
+					let _code = res.code
+					let _data = res.data
+					let _msg = res.msg
+					if (_code === 0) {
+						this.list[k].show = false;
+						this.$u.toast(`鏇存柊鎴愬姛`);
+						this.search('')
+					} else {
+						this.$u.toast('鏇存柊澶辫触');
+					}
+				
+				});
+			},
+			deleteDetail(id){
+				let k = this.list.findIndex(
+					(item) => item.id === id
+				)
+				let transportsDetail = {
+					id: id
+				}
+				
+				this.$u.api.palletTransportsDetail.delObj(transportsDetail).then(res => {
+					let _code = res.code
+					let _data = res.data
+					let _msg = res.msg
+					if (_code === 0) {
+						this.list.splice(k, 1);
+						this.$u.toast('鍒犻櫎鎴愬姛');
+						this.search('')
+					} else {
+						this.$u.toast('鍒犻櫎澶辫触');
+					}
+				});
+			},
+			clickOperateBtn(id, index1) {
+				let k = this.list.findIndex(
+					(item) => item.id === id
+				)
+				if (index1 == 1) {
+					let transportsDetail = {
+						id: id
+					}
+					
+					this.$u.api.palletTransportsDetail.delObj(transportsDetail).then(res => {
+						let _code = res.code
+						let _data = res.data
+						let _msg = res.msg
+						if (_code === 0) {
+							this.list.splice(k, 1);
+							this.$u.toast('鍒犻櫎鎴愬姛');
+							this.search('')
+						} else {
+							this.$u.toast('鍒犻櫎澶辫触');
+						}
+					});
+
+				} else {
+					let material = this.list.find((item) => {
+						return item.id === id
+					})
+					let transportsDetail = {
+						id: id,
+						transferQuantity: material.transferQuantity
+					}
+					
+					this.$u.api.palletTransportsDetail.updateDetail(transportsDetail).then(res => {
+						let _code = res.code
+						let _data = res.data
+						let _msg = res.msg
+						if (_code === 0) {
+							this.list[k].show = false;
+							this.$u.toast(`鏇存柊鎴愬姛`);
+							this.search('')
+						} else {
+							this.$u.toast('鏇存柊澶辫触');
+						}
+					
+					});
+				}
+			},
+			// 濡傛灉鎵撳紑涓�涓殑鏃跺�欙紝涓嶉渶瑕佸叧闂叾浠栵紝鍒欐棤闇�瀹炵幇鏈柟娉�
+			openOperateBtn(id) {
+				// 鍏堝皢姝e湪琚搷浣滅殑swipeAction鏍囪涓烘墦寮�鐘舵�侊紝鍚﹀垯鐢变簬props鐨勭壒鎬ч檺鍒讹紝
+				// 鍘熸湰涓�'false'锛屽啀娆¤缃负'false'浼氭棤鏁�
+				let k = this.list.findIndex(
+					(item) => item.id === id
+				)
+				this.list[k].show = true;
+				this.list.map((val, idx) => {
+					if (k != idx) this.list[idx].show = false;
+				})
+			},
+			setMaterialLocation(loc) {
+				let transportsDetails = []
+				this.list.forEach((item) => {
+					if (item.selected) {
+						transportsDetails.push({
+							id: item.id,
+							toIfsLocationNo: loc.locationNo
+						})
+					}
+				})
+				this.$u.api.palletTransportsDetail.updateBatch(transportsDetails).then(res => {
+					let _code = res.code
+					let _data = res.data
+					let _msg = res.msg
+					if (_code === 0) {
+						this.$u.toast('鏇存柊IFS浠庡簱浣嶆垚鍔�');
+						this.search('')
+					} else {
+						this.$u.toast('鏇存柊IFS浠庡簱浣嶅け璐�');
+					}
+
+				});
+			},
+			toLocations() {
+				let selectFlag = false
+				this.list.forEach((item) => {
+					if (item.selected) {
+						selectFlag = true
+					}
+				})
+				if (selectFlag) {
+					uni.navigateTo({
+						url: '/pages/product/pick/ifsLocationList',
+					})
+				} else {
+					this.$u.toast('璇烽�夋嫨绉诲簱鏄庣粏');
+				}
+			},
+			scanMaterialCodeClick(materialInfo) {
+				//鎵爜 杩斿洖part_no銆乴ot_batch_no銆亀dr
+				//璋冪敤IFS搴撳瓨鏌ヨ鎺ュ彛锛岃嫢杩斿洖澶氭潯搴撳瓨锛岄渶璺宠浆鑷矷FS搴撳瓨鍒楄〃閫夋嫨鏌愭潯搴撳瓨
+				//閫変腑鏌愭潯搴撳瓨鍚庯紝璋冪敤鐗╂枡闇�姹傛煡璇㈡帴鍙o紝鑻ュ瓨鍦ㄥ鏉$墿鏂欓渶姹傦紝鍒欒烦杞嚦鐗╂枡闇�姹傚垪琛ㄩ�夋嫨鏌愭潯鐗╂枡闇�姹�
+				//淇濆瓨褰撳墠绉诲簱鏄庣粏锛屽苟灏嗚鏉$Щ搴撴槑缁嗘覆鏌撳埌椤甸潰
+				let queryParam = {
+					batchNo: materialInfo.batchNo,
+					partNo:  materialInfo.partNo,
+					transportsId: this.transportsId,
+					wdr: materialInfo.wdr
+				}
+				this.$u.api.ifsStock.page(queryParam).then(res => {
+					let _code = res.code
+					let _data = res.data
+					let _msg = res.msg
+					this.isfStockList = []
+					if (_code === 0) {
+						if (_data != null && _data.length > 0) {
+							if (_data.length > 1) {
+								_data.forEach((item, index) => {
+									this.isfStockList.push({
+										id: index + 1,
+										partNo: item.PART_NO,
+										partDesc: item.PART_DESC,
+										locationDesc: item.LOCATION_DESC,
+										locationNo: item.LOCATION_NO,
+										batchNo: item.LOT_BATCH_NO,
+										wdr: item.WAIV_DEV_REJ_NO,
+										available: item.QTY_AVAILABLE,
+										unit: item.UNIT_MEAS_DESC,
+										engChgLevel: item.ENG_CHG_LEVEL,
+										planMoveQuality: item.QTY_AVAILABLE,
+										selected: false
+									})
+								})
+								uni.navigateTo({
+									url: '/pages/product/pick/ifsStock',
+								})
+							} else {
+								this.currStock = {
+									id: 1,
+									partNo: _data[0].PART_NO,
+									partDesc: _data[0].PART_DESC,
+									locationDesc: _data[0].LOCATION_DESC,
+									locationNo: _data[0].LOCATION_NO,
+									batchNo: _data[0].LOT_BATCH_NO,
+									wdr: _data[0].WAIV_DEV_REJ_NO,
+									available: _data[0].QTY_AVAILABLE,
+									unit: _data[0].UNIT_MEAS_DESC,
+									engChgLevel: _data[0].ENG_CHG_LEVEL,
+									planMoveQuality: _data[0].QTY_AVAILABLE
+								}
+								this.queryMaterialNeedList(queryParam.partNo)
+							}
+						} else {
+							this.$u.toast('鏈壘鍒癐FS搴撳瓨');
+						}
+
+					} else {
+
+					}
+				});
+			},
+			getIsfStockList() {
+				return this.isfStockList
+			},
+			getMaterialNeedList() {
+				return this.materialNeedList
+			},
+			findMaterial(ifsStock) {
+				this.currStock = ifsStock
+				this.queryMaterialNeedList(ifsStock.partNo)
+			},
+			//鏍规嵁闆朵欢鍙峰幓鏌ヨ鐗╂枡闇�姹�
+			queryMaterialNeedList(partNo) {
+				let queryParam = {
+					current: 1,
+					size: 100,
+					transportsId: this.transportsId,
+					partNo: partNo
+				}
+				this.$u.api.palletTransportsMaterial.page(queryParam).then(res => {
+					let _code = res.code
+					let _data = res.data
+					let _msg = res.msg
+					this.materialNeedList = []
+					if (_code === 0) {
+						if (_data.records != null && _data.records.length > 0) {
+							if (_data.records.length > 1) {
+								_data.records.forEach((item, index) => {
+									this.materialNeedList.push({
+						   	id: item.id,
+										partDesc: item.partDesc,
+										demandQuantity: item.demandQuantity,
+										partId: item.partId,
+										partNo: item.partNo,
+										surplusQuantity: item.surplusQuantity,
+										toIfsLocationName: item.toIfsLocationName,
+										toIfsLocationNo: item.toIfsLocationNo,
+										transferQuantity: item.transferQuantity,
+										unit: item.unit,
+										transportsId: item.transportsId,
+										detailExistState: item.detailExistState,
+										selected: false
+									})
+								})
+								uni.navigateTo({
+									url: '/pages/product/pick/materialNeed',
+								})
+							} else {
+								let materialNeed = {
+									id: _data.records[0].id
+								}
+								this.saveDetail(materialNeed)
+							}
+						} else {
+							this.$u.toast('鏈壘鍒板搴旂殑鐗╂枡闇�姹�');
+						}
+					} else {
+
+					}
+				});
+			},
+			saveDetail(materialNeed) {
+				let postDetailParam = {
+					partNo: this.currStock.partNo,
+					partDesc: this.currStock.partDesc,
+					batchNo: this.currStock.batchNo,
+					wdr: this.currStock.wdr,
+					transferQuantity: this.currStock.planMoveQuality,
+					fromIfsLocationNo: this.currStock.locationNo,
+					transportsMaterialId: materialNeed.id,
+					transportsId: this.transportsId
+				}
+				this.$u.api.palletTransportsDetail.addDetail(postDetailParam).then(res => {
+					let _code = res.code
+					let _data = res.data
+					let _msg = res.msg
+					//淇濆瓨鏄庣粏鎴愬姛鏃�
+					if (_code === 0) {
+						this.$u.toast('娣诲姞绉诲簱鏄庣粏鎴愬姛');
+						this.search('')
+					} else {
+						this.$u.toast('娣诲姞绉诲簱鏄庣粏澶辫触');
+					}
+
+				});
+			},
+			executeMove(){
+				let moveFlag = true
+				let detailIds = []
+				this.list.forEach((item) => {
+					if (item.selected) {
+						detailIds.push(item.id)
+						if (item.state === '02submitted') {
+						    moveFlag = false
+						}
+					}
+				})
+				if(moveFlag){					
+					if(detailIds.length>0){
+						this.$u.api.palletTransports.executeMove(detailIds).then(res => {
+							let _code = res.code
+							let _data = res.data
+							let _msg = res.msg
+							//淇濆瓨鏄庣粏鎴愬姛鏃�
+							if (_code === 0) {
+								this.$u.toast('鎵ц鎴愬姛');
+								this.search('')
+							} else {
+								this.$u.toast('鎵ц澶辫触');
+							}
+						
+						});
+					}else{
+						this.$u.toast('璇烽�夋嫨宸插垱寤虹姸鎬佺殑鏄庣粏');
+					}
+				}else{
+					this.$u.toast('鍙湁宸插垱寤虹姸鎬佺殑鏄庣粏锛屾墠鑳借鎵ц');
+				}
+			},
+			materialCardClick(item) {
+				item.selected = !item.selected
+			},
+			loadMore() {
+				this.loadStatus = "loading";
+				setTimeout(() => {
+					this.query.current += 1;
+					this.loadList();
+				}, 100);
+			},
+			loadList() {
+				let that=this
+				that.$u.api.palletTransportsDetail.page(that.query).then(res => {
+					if (!res.data.records || res.data.records.length == 0) {
+						that.loadStatus = "nomore";
+						return;
+					}
+					that.list = that.list.concat(res.data.records);
+					that.list.forEach((item) => {
+						that.$set(item, 'selected', false)
+						that.$set(item, 'show', false)
+					})
+					//this.total = res.data.total;
+					that.query.current = res.data.current;
+					that.query.size = res.data.size;
+					that.loadStatus = "loadmore";
+				});
+			},
+			search(value) {
+				this.list = [];
+				this.query.current = 1;
+				this.$nextTick(() => {
+					this.loadList();
+				})
+			}
+		}
+	};
+</script>
+<style lang="scss">
+	.custom-edit-input {
+		border-bottom: 2rpx solid #F8F8F8;
+	}
+
+	.list .content {
+		font-size: 12px;
+		background-color: #efefef;
+		box-sizing: border-box;
+		border-radius: 14rpx;
+		margin: 8px;
+		padding: 5px 10px;
+		box-shadow: none;
+	}
+	.material-transfer-detail{
+		background-color: #F8F8F8;
+	}
+	.material-transfer-detail-cell {
+		::v-deep .u-cell-item-box {
+			background-color: #F8F8F8;
+		}
+	}
+</style>

--
Gitblit v1.9.3