ysy hace 2 años
padre
commit
399afd44a9

+ 14 - 0
api/pda/picking.js

@@ -0,0 +1,14 @@
+import { postJ, post, get } from "@/utils/request";
+import Vue from "vue";
+
+
+// 领料保存
+export async function batchSave(params) {
+  const data = await postJ(
+   Vue.prototype.apiUrl  + `/pda/mes/pickorder/batchSave`, params, true,
+  );
+  if (data.code == 0) {
+    return data.data;
+  }
+  return Promise.reject(data.message);
+}

+ 11 - 3
pages/pda/common.js

@@ -83,10 +83,18 @@ export const tableHeader = selectEquiType => {
 				}
 			]
 		case 10:
-			return [
-			]
+			return []
 		case 14:
-			return [
+			return []
+		case 4:
+		    return 	[{
+					label: '型号',
+					prop: 'modelType'
+				},
+				{
+					label: '规格',
+					prop: 'specification'
+				}
 			]
 	}
 

+ 130 - 47
pages/pda/picking/components/instanceBom.vue

@@ -2,38 +2,50 @@
 	<view>
 
 
-		<view v-for="(item, index) in list" :key="index" @change="e => selectVal(e, item, index)">
-			<view class="listBox rx-bs">
-
-				<view class="delete" @click="getDelete(index)">
-					<uni-icons custom-prefix="iconfont" type="icon-shanchu" size="24" color="#fa3534"></uni-icons>
+		<view class="material rx-ss" v-for="(mate, idx) in list">
+			<view class="left rx-ss" @click="getDelete(idx)">
+					<uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
+			</view>
+			<view class="content_table">
+				<view class="item">
+					<view class="lable rx-cc">编码</view>
+					<view class="content">
+						{{mate.assetCode}}
+					</view>
 				</view>
 
-				<view class="listBox-con">
-					<view class="listBox-top rx-bc">
-						<view> {{ item.assetName }}</view>
-						<view class="code">{{ item.assetCode}}</view>
-					</view>
+				<view class="item">
+					<view class="lable rx-cc">名称</view>
+					<view class="content">{{mate.assetName}}</view>
+				</view>
+				 
+				
+				<view class="item" v-for="(itm, index) in tableH(4)" :key="index" >
+					<view class="lable rx-cc">{{ itm.label }}</view>
+					<view class="content">{{ mate[itm.prop] }}</view>
+				
+				</view>
+				
+
+				<view class="item">
+					<view class="lable rx-cc">数量</view>
+				<view class="content content_num">
+					<input  class="uni-input"  v-model="mate.needNum"  @blur='mate.needNum > mate.number ?  mate.needNum = mate.number : mate.needNum' type="digit"></input>
+					<view class="unit">/{{mate.unit}}</view>
+					<view>&nbsp;&nbsp; (库存:{{ mate.number }})</view>
+				</view>
+				</view>
 
-					<view class="listBox-bottom rx">
-						<view v-for="(itm, index) in tableH(item.rootCategoryLevelId)" :key="index" class="items">
-							{{ itm.label }}:{{ item[itm.prop] }}
-						</view>
 
-						<view class="items">
-							可用库存:{{ item.number }} {{item.unit}}
-						</view>
 
+				<view class="item">
+					<view class="lable rx-cc">领料仓库</view>
+					<view class="content ">
+						
 					</view>
-
 				</view>
 
-
-
-
-
 			</view>
-
 		</view>
 
 	</view>
@@ -51,45 +63,116 @@
 			}
 		},
 		methods: {
-			tableH(type) {
-				return tableHeader(type)
-			},
+	tableH(type) {
+		return tableHeader(type)
+	},
 
-			getDelete(index) {},
+			getDelete(idx) {
+				this.list.splice(idx, 1)
+			},
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
-	.listBox {
-		padding: 14rpx 0;
-		border-bottom: 2rpx solid $border-color;
-
+	.material {
+		margin-top: 10rpx;
 
+		.left {
+			width: 40rpx;
+		}
 
+		.zdy_check {
+			width: 30rpx;
+			height: 30rpx;
+			border: 2rpx solid #c8c9cc;
+			border-radius: 4rpx;
 
 
-		.listBox-con {
-			width: 630rpx;
-			font-weight: 400;
 		}
 
-		.listBox-top {
-			margin-top: 6rpx;
-			color: #090A0A;
-			font-size: 28rpx;
-			font-style: normal;
+		.check_active {
+			background: $theme-color;
+			border: 2rpx solid $theme-color;
+
+			/deep/ .u-icon__icon {
+				color: #fff !important;
+			}
 		}
 
-		.listBox-bottom {
-			color: #090A0A;
-			font-size: 24rpx;
-			font-style: normal;
-			flex-wrap: wrap;
+		.content_table {
+			width: 652rpx;
+			border: 2rpx solid $border-color;
+
+			.item {
+				display: flex;
+				border-bottom: 2rpx solid $border-color;
+
+
+				.lable {
+					width: 132rpx;
+					text-align: center;
+					background-color: #F7F9FA;
+					font-size: 26rpx;
+					border-right: 2rpx solid $border-color;
+					flex-shrink: 0;
+				}
+
+				.ww80 {
+					width: 80rpx;
+				}
+
+				.content {
+					width: 518rpx;
+					min-height: 64rpx;
+					font-size: 28rpx;
+					line-height: 28rpx;
+					font-style: normal;
+					font-weight: 400;
+					padding: 18rpx 8rpx;
+					box-sizing: border-box;
+					word-wrap: break-word;
+					flex-grow: 1 !important;
+
+				}
+
+				.content_num {
+					
+					display: flex;
+					align-items: center;
+					padding: 0 4rpx;
+
+					/deep/ .uni-input-input {
+						width: 200rpx ;
+						border: 2rpx solid #F0F8F2;
+						background: #F0F8F2;
+						color: $theme-color;
+					}
+
+					.unit {
+						padding: 0 4rpx;
+						font-size: 24rpx;
+						color: #404446;
+					}
+				}
+
+				.pd4 {
+					padding: 4rpx 8rpx;
+				}
+
+
+
+				&:last-child {
+					border-bottom: none;
+				}
+			}
+
+			.ww55 {
+				width: 55%;
+			}
 
-			.items {
-				width: 50%;
-				margin-top: 6rpx;
+			.ww45 {
+				width: 45%;
 			}
 		}
 	}

+ 19 - 25
pages/pda/picking/details.vue

@@ -52,6 +52,7 @@
 									<view class="content content_num">
 										<input class="uni-input" v-model="mate.needNum" type="digit"></input>
 										<view class="unit">{{mate.unit}}</view>
+									
 									</view>
 								</view>
 
@@ -94,6 +95,8 @@
 	import {
 		workorderList
 	} from '@/api/pda/workOrder.js'
+	
+	import { batchSave } from '@/api/pda/picking.js'
 
 	export default {
 		components: {
@@ -105,6 +108,8 @@
 				List: [],
 
 				classificationList: [], //分类数据
+				
+				taskId: null
 
 
 			}
@@ -112,7 +117,10 @@
 		onLoad(options) {
 			let queryArray = decodeURIComponent(options.arr);
 			this.idsList = JSON.parse(queryArray);
-
+			if(options.hasOwnProperty('taskId')) {
+				 this.taskId = options.taskId
+			}
+           
 
 			this.getList()
 
@@ -124,28 +132,7 @@
 				console.log(selectList)
 				this.List.forEach(m => {
 					if (m.id == id) {
-						console.log(m.hasOwnProperty('instanceList'))
-						if (!m.hasOwnProperty('instanceList') || m.instanceList.length == 0) {
-							console.log(222)
-							this.$set(m, 'instanceList', selectList)
-							console.log(m)
-						} else {
-							let data = [...m.instanceList]
-
-							selectList.map(item => {
-								const obj = m.instanceList.find(value => value.id == item
-									.id); //分别判断arr1里面是否含           有arr的元素
-								if (!obj) {
-									data.push(item);
-								};
-							});
-
-							console.log(data)
-						}
-
-
-
-
+						this.$set(m, 'instanceList', selectList)
 					}
 				})
 
@@ -160,12 +147,19 @@
 			scrolltolower() {},
 
 			save() {
-				console.log(this.idsList)
+				console.log(this.List)
+				
+				batchSave(this.List).then(res => {
+					console.log(res)
+				})
 			},
 
 			getList() {
 				workorderList(this.idsList).then(res => {
 					this.List = res
+					if(this.taskId) {
+						this.List[0].taskId  = this.taskId
+					}
 				})
 			},
 
@@ -175,7 +169,7 @@
 
 			addPicking(id, list) {
 				const storageKey = Date.now() + "";
-				uni.setStorageSync(storageKey, list|| []);
+				uni.setStorageSync(storageKey, list || []);
 				uni.navigateTo({
 					url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}`
 				})

+ 39 - 37
pages/pda/workOrder/search/index.vue

@@ -45,12 +45,11 @@
 									class="items">
 									{{ itm.label }}:{{ item[itm.prop] }}
 								</view>
-								
-								<view 
-									class="items">
+
+								<view class="items">
 									可用库存:{{ item.number }} {{item.unit}}
 								</view>
-								
+
 							</view>
 
 						</view>
@@ -61,11 +60,14 @@
 				</checkbox-group>
 
 
-				<u-empty v-if='list.length == 0' style='margin-top: 20vh;' iconSize='150' textSize='32' text='暂无数据'>
-				</u-empty>
-
+			
+			<u-empty v-if='list.length == 0' style='margin-top: 20vh;' iconSize='150' textSize='32' text='暂无数据'>
+			</u-empty>
 
 			</u-list>
+			
+			
+
 		</view>
 
 
@@ -76,8 +78,8 @@
 				</checkbox>
 			</view>
 			<view>
-				<u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen"  @click="jumpAdd">
-					<view > 选择( {{ checkListLen }} ) </view>
+				<u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
+					<view> 选择( {{ checkListLen }} ) </view>
 				</u-button>
 			</view>
 		</view>
@@ -112,7 +114,7 @@
 
 				seletedAll: false, //全选状态
 				memoList: [],
-				
+
 				pid: null, // 上个页面id
 				storageKey: null
 			}
@@ -127,20 +129,20 @@
 		},
 
 		onLoad(option) {
-			this.pid =  option.id
-			if(option.storageKey) {
+			this.pid = option.id
+			if (option.storageKey) {
 				this.storageKey = option.storageKey
-				  this.memoList = (this.storageKey  && uni.getStorageSync(this.storageKey )) || []
+				this.memoList = (this.storageKey && uni.getStorageSync(this.storageKey)) || []
 			}
-			
+
 			this.getTreeList()
 		},
-		
+
 		onUnload() {
-			if(this.storageKey) {
-					uni.removeStorage(this.storageKey)
+			if (this.storageKey) {
+				uni.removeStorage(this.storageKey)
 			}
-		
+
 		},
 
 
@@ -185,7 +187,7 @@
 
 			getTreeList() {
 				let params = {
-					ids: [1, 5, 7, 8, 10, 14, ]
+					ids: [1, 5, 7, 8, 10, 14, 4]
 
 				}
 				treeByPid(params).then(res => {
@@ -211,10 +213,10 @@
 					this.list.push(
 						...res.list.map(i => {
 							const checked =
-							  this.memoList.findIndex(itm => itm.id === i.id) > -1
-							  
+								this.memoList.findIndex(itm => itm.id === i.id) > -1
+                           
 							return {
-								 checked,
+								checked,
 								...i
 							}
 						})
@@ -227,28 +229,28 @@
 				this.list[index].checked = !this.list[index].checked
 
 				this.seletedAll = !this.list.some(item => !item.checked)
-				
+
 				const idx = this.memoList.findIndex(
-				  item => item.id === this.list[index].id
+					item => item.id === this.list[index].id
 				)
-				
+
 				if (this.list[index].checked) {
-				  if (idx === -1) {
-				    this.memoList.push(this.list[index])
-				  }
+					if (idx === -1) {
+						this.memoList.push(this.list[index])
+					}
 				} else {
-				  if (idx > -1) {
-				    this.memoList.splice(idx, 1)
-				  }
+					if (idx > -1) {
+						this.memoList.splice(idx, 1)
+					}
 				}
-				
-				
+
+
 			},
-			
+
 			//跳转回添加页面
-			jumpAdd () {
-			  uni.$emit('setSelectList', this.memoList, this.pid)
-			  uni.navigateBack()
+			jumpAdd() {
+				uni.$emit('setSelectList', this.memoList, this.pid)
+				uni.navigateBack()
 			},
 		}
 	}