Browse Source

直接调拨生成 保存

ZL 2 weeks ago
parent
commit
1d903cc71f

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
     "name" : "衬衣面料扫描",
-    "appid" : "__UNI__07031C4",
+    "appid" : "__UNI__1BFC51E",
     "description" : "",
     "versionName" : "1.0.1",
     "versionCode" : 101,

+ 147 - 38
pages/direct-transfer/index.vue

@@ -4,9 +4,8 @@
 			<view class="button-group" v-if="isCreate === false">
 				<button type="default" @click="reset">取消</button>
 				<!-- <button type="default" @click="navigateToSummary">统计</button> -->
-				<button type="default" @click="navigateToSearch" >查询</button>
-				<button type="default" >源单</button>
-				<button type="default" @click="navigateToStage" >暂存</button>
+				<button type="default" @click="navigateToSearch">查询</button>
+				<button type="default" @click="navigateToStage">暂存</button>
 				<button type="default" @click="navigateToSearch">提交</button>
 			</view>
 			<view class="button-group" v-else>
@@ -17,6 +16,9 @@
 				@confirm="getIsCreate()" @clear="clear" placeholder="请扫描拼件单号">
 			</uni-easyinput>
 		</view>
+		<view>
+			<u-picker :show="showPicker" :columns="depotList" keyName="FStockName" @confirm="pickDepot"   title="仓位选择"></u-picker>
+		</view>
 		<view class="table-container" style="height: 100vh;">
 			<scroll-view class="table-content" :style="{'height': clientHeight + 'px'}" scroll-x scroll-y
 				:scroll-into-view="scrollItem">
@@ -46,16 +48,18 @@
 					<view class="table-cell2">调入仓位</view>
 				</view>
 				<view class="table-row" v-for="(item, index) in indexList" :key="index" :id="'scrollItem-' + index"
-					:style="getStyle(item.smzt)"  v-if="isCreate === false">
-					<view class="table-cell"><button type="default" size="mini" @click="edit(item,index)">编辑</button>
+					:style="getStyle(item.smzt)" v-if="isCreate === false">
+					<view class="table-cell">
+						<button type="default" size="mini" @click="edit(item,index)">编辑</button>
 					</view>
 					<view class="table-cell">{{ item.smzt? '已扫描' : '未扫描' }}</view>
 					<view class="table-cell">{{ item["FSrcStockLocId.FF102029.FName"] }}</view>
 					<view class="table-cellwl" :style="getStyle(item.smzt)">{{ item["FMaterialId.FNumber"] }}</view>
 					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FENCHASENUM.LT"] }}</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FQty"] }}</view> 
+					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FQty"] }}</view>
 					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FBOXNO.LT"] }}</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FAuxPropId.FF101501.FDataValue"] }}</view>
+					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FAuxPropId.FF101501.FDataValue"] }}
+					</view>
 					<view class="table-cellph" :style="getStyle(item.smzt)">{{ item["FLot.FNumber"] }}</view>
 					<view class="table-cell2" :style="getStyle(item.smzt)">{{ item["rowCount"] }}</view>
 					<view class="table-cell" :style="getStyle(item.smzt)">{{ item["FNoteEntry"] }}</view>
@@ -64,12 +68,15 @@
 					<view class="table-cell3" :style="getStyle(item.smzt)">{{ item["FBillNo"] }}</view>
 					<view class="table-cell" :style="getStyle(item.smzt)">{{ item["FStockerId.FName"] }}</view>
 				</view>
-				<view class="table-row" v-else>
-					<view class="table-cell"><button type="default" size="mini" @click="edit(item,index)">编辑</button>
+				<view class="table-row" v-for="(item, index) in indexList" :key="index" :id="'scrollItem-' + index"
+					:style="getStyle(item.smzt)"  v-else>
+					<view class="table-cell">
+						<button type="default" size="mini" @click="edit(item,index)">编辑</button>
 					</view>
 					<view class="table-cell2">{{ item["FCMKBarCode"] }}</view>
-					<view class="table-cell2">{{ item["FSrcStockLocId.FF102029.FName"] }}</view>
+					<view class="table-cell2">{{ item["FStockName"] }}</view>
 					<view class="table-cell2">{{ item["FDestStockLocId.FF102029.FName"] }}</view>
+
 				</view>
 			</scroll-view>
 		</view>
@@ -81,12 +88,16 @@
 					<uni-data-select v-model="loginForm.acctID" :localdata="range" @change="change"
 						:clear="false"></uni-data-select>
 				</view> -->
-				<view
+				<view v-if="isCreate === false"
 					style="display: flex;flex-direction: row;margin-top: 8px;font-size: 12px;margin-right: 15px;margin-bottom: 8px;">
 					<view style="margin-right: 15px;">源单明细:{{ indexList.length }}</view>
 					<view style="margin-right: 15px;">已扫描:{{ indexListLength }}</view>
 					<!-- <view>剩余件数:{{ balance }}</view> -->
 				</view>
+				<view v-else
+					style="display: flex;flex-direction: row;margin-top: 8px;font-size: 12px;margin-right: 15px;margin-bottom: 8px;">
+					<view style="margin-right: 15px;">已扫描:{{ indexListLength }}</view>
+				</view>
 			</view>
 		</view>
 	</view>
@@ -98,13 +109,11 @@
 		audit,
 		getInventoryList,
 		save,
-		submit
+		submit,
+		getBillList
 	} from '../../api/production_replenishment';
 	import modal from '../../plugins/modal';
-	// import {
-	// 	audioUrls,
-	// 	playVoice
-	// } from '../../utils/audio';
+
 	import {
 		playVoice,
 		audioUrls,
@@ -120,7 +129,9 @@
 		executeSql
 	} from '../../utils/database';
 	import {
-		createInventoryQueryRequest
+		createInventoryQueryRequest,
+		getFLotFNumber,
+		getInventory
 	} from '@/utils/transferparams.js';
 	export default {
 		onShow() {
@@ -222,6 +233,8 @@
 				tableName: "common_bill",
 				destStockLocId: '',
 				isCreate: false,
+				showPicker: false,
+				depotList: [],
 
 			};
 		},
@@ -243,8 +256,9 @@
 				if ("NewFENCHASENUM.LT" in data) {
 					this.indexList[index]["FENCHASENUM.LT"] = data["NewFENCHASENUM.LT"]
 				}
-				if (this.indexList[index]["FSrcStockLocId.FF102029.FName"] != data["FSrcStockLocId.FF102029.FName"]) {
-				
+				if (this.indexList[index]["FSrcStockLocId.FF102029.FName"] != data[
+					"FSrcStockLocId.FF102029.FName"]) {
+
 					const requestData = createInventoryQueryRequest(data["FSrcStockLocId.FF102029.FName"])
 					getInventoryList(JSON.stringify(requestData)).then(res => {
 						this.indexList[index]["quantity"] = res.length
@@ -272,8 +286,8 @@
 					})
 				}
 				this.indexList[index]['FInventoryQty'] = data["FInventoryQty"]
-				
-				
+
+
 				// 定义一个映射对象
 				const formIdMap = {
 					'STK_TransferDirect': 'FQty',
@@ -470,7 +484,7 @@
 					console.error('Error updating indexList:', error);
 				}
 			},
-			
+
 			scrollToItem(itemId) {
 				// 设置滚动到的指定元素的 ID
 				this.scrollItem = itemId;
@@ -481,6 +495,7 @@
 				const self = this
 				modal.confirm("是否重置?").then(res => {
 					if (res) {
+						self.depotList = []
 						self.indexList = []
 						self.searchValue = ""
 						self.balance = 0
@@ -498,12 +513,7 @@
 						'&&index=' + encodeURIComponent(JSON.stringify(index))
 				});
 			},
-			// scrollToItem(id) {
-			// 	// 使用id属性定位
-			// 	this.$nextTick(() => {
-			// 		uni.$emit('scrollIntoView', id);
-			// 	})
-			// },
+			
 			showDetail(index) {
 				console.log(index);
 				let item = this.indexList[index.name]
@@ -731,8 +741,24 @@
 				playSequentially(audioUrlsArr);
 
 			},
-			scanToCreate(){
+			CreateScanSuccess(nowindex) {
+				console.log("扫描完成开始渲染------------",nowindex)
+				console.log("-----------",this.indexList)
+				this.indexList[nowindex].smzt = 1 
+				this.$forceUpdate()
+				this.$nextTick(() => {
+					this.searchValue = ''
+					this.isFocus = true;
+					this.scrollToItem("scrollItem-" + nowindex)
+				})
+				const audioUrlsArr = [];
+				audioUrlsArr.push(audioUrls.success2VoiceUrl);
+				playSequentially(audioUrlsArr);
+			},
+			async scanToCreate() {
+				console.log("```````````````````进入扫描生成块")
 				let vm = this
+				let info = {}
 				//校验是否输入条码
 				if (this.searchValueIsEmpty(this.searchValue)) {
 					playVoice(audioUrls.failVoiceUrl)
@@ -740,10 +766,70 @@
 					this.focusPoint()
 					return
 				}
-				//根据条形码找编码
-				//根据编码批号找即时库存
-				//有多条时进行仓位选择
-				//扫描完毕信息填充
+				info.FCMKBarCode = this.searchValue
+				modal.loading('扫描数据中,请耐心等待...')
+				try {
+					//根据条形码找编码
+					const lot = await this.getFLotCode(this.searchValue)
+					if (!lot) {
+						uni.showModal({
+							title: '提示',
+							content: "未查询到编码!",
+							showCancel: false,
+							success: function(res) {
+								if (res.confirm) {
+									this.focusPoint()
+									vm.searchValue = ''
+									return
+								} else {
+									// 执行取消后的操作
+								}
+							}.bind(this)
+						})
+						playVoice(audioUrls.failVoiceUrl)
+						return
+					}
+					//根据编码批号找即时库存
+					const stockLoc = await this.getStockLoc(lot["FLot.FNumber"], lot["FMaterialId.FNumber"])
+					if (!stockLoc) {
+						uni.showModal({
+							title: '提示',
+							content: "未查询到即时库存信息!",
+							showCancel: false,
+							success: function(res) {
+								if (res.confirm) {
+									this.focusPoint()
+									vm.searchValue = ''
+									return
+								} else {
+									// 执行取消后的操作
+								}
+							}.bind(this)
+						})
+						playVoice(audioUrls.failVoiceUrl)
+						return
+					}
+
+					//有多条时进行仓位选择
+					if (stockLoc.length > 1) {
+						console.log("进行仓位选择--------------------",stockLoc)
+						this.depotList = [stockLoc]
+						this.showPicker = true
+						this.indexList.push(info)
+					}else{
+						info.FStockName = stockLoc[0].FStockName
+						this.indexList.push(info)
+						this.CreateScanSuccess(this.indexList.length)
+					}
+					
+					
+					
+					
+
+				} finally {
+					modal.closeLoading();
+				}
+
 			},
 			scan() {
 				let vm = this
@@ -758,7 +844,7 @@
 				if (this.checkBarcodeInArray(this.searchValue, this.indexList, "FENCHASENUM.LT")) {
 					uni.showModal({
 						title: '提示',
-						content: "条码:" + vm.searchValue + '不存在',
+						content: "条码:" + vm.searchValue + "不存在",
 						showCancel: false,
 						success: function(res) {
 							if (res.confirm) {
@@ -773,7 +859,7 @@
 					playVoice(audioUrls.failVoiceUrl)
 					return
 				}
-				
+
 				//条码存在未扫描
 				let nowlocation = null; //该条码的仓位
 				let nowindex = null; //该条码的索引
@@ -790,7 +876,7 @@
 					let UnscannedNumber = this.indexList.filter(item =>
 						item["FSrcStockLocId.FF102029.FName"] === this.Location && item['smzt'] != 1
 					).length
-					
+
 					if (nowlocation != this.Location && UnscannedNumber != 0) { //仓位不一致
 						playVoice(audioUrls.warningSuccessUrl)
 						uni.showModal({
@@ -818,8 +904,12 @@
 					this.handleScanSuccess(nowindex)
 				}
 			},
-			getIsCreate(){
-				return this.isCreate === true ? 'scanToCreate' : 'scan'
+			getIsCreate() {
+				if (this.isCreate) {
+					this.scanToCreate()
+				} else {
+					this.scan()
+				}
 			},
 			getHeightStyle() {
 				return 'height:' + this.listHeight + 'px';
@@ -828,6 +918,25 @@
 				return smzt ? 'background-color: Navy;color:white' : '';
 				// return 'scrollItem-' + index === this.scrollItem ? 'background-color: blue;color:white' : '';
 			},
+			async getFLotCode(code) {
+				const searchParam = getFLotFNumber(code)
+				let ress = await getBillList(JSON.stringify(searchParam))
+				return ress?.[0]
+			},
+			async getStockLoc(lot, material) {
+				const searchParam = getInventory(lot, material)
+				return getBillList(JSON.stringify(searchParam))
+
+			},
+			pickDepot(e){
+				console.log('confirm', e)
+				this.Location = e.value[0]
+				this.indexList[this.indexList.length - 1].FStockName = e.value[0].FStockName
+				console.log('confirm2', this.indexList)
+				this.showPicker = false
+				this.CreateScanSuccess(this.indexList.length-1)
+			}
+
 		}
 	};
 </script>

+ 1 - 1
pages/direct-transfer/search.vue

@@ -211,7 +211,7 @@
 				const condition = this.createSearchCondition(this.range, this.BillNo);
 				console.log(condition)
 				const searchParam = getSearchParam(condition)
-				modal.loading('获取数据中,请耐心等待...')
+				modal.loadingMask('获取数据中,请耐心等待...')
 				getBillList(JSON.stringify(searchParam)).then(
 					res => this.handleResponse(res)
 					// res => {

+ 1 - 2
pages/index/index.vue

@@ -79,7 +79,6 @@
 						"简单生产领料",
 						"采购退料单",
 						"直接调拨管理平台",
-						"直接调拨管理平台(生成)"
 					]
 				}]
 
@@ -147,7 +146,7 @@
 					uni.navigateTo({url: '/pages/direct-transfer/index'
 					});
 				}
-				if (item.name == "直接调拨管理平台(生成)") {
+				if (item.name == "直接调拨(生成)") {
 					const formId = 'STK_TransferDirect';
 					const fbillType = 'ce8f49055c5c4782b65463a3f863bb4a';
 					uni.setStorageSync('formId', formId)

+ 4 - 4
pages/login/index.vue

@@ -61,12 +61,12 @@
 		data() {
 			return {
 				loginForm: {
-					// Env: 'http://10.201.3.146',//测试地址
-					Env: 'http://10.200.0.222',
+					Env: 'http://10.201.3.146',//测试地址
+					// Env: 'http://10.200.0.222',
 					acctID: '5d5812913fe36c',
 					FStockOrgId: '100',
-					UserName: '',
-					Password: '',
+					UserName: 'LT068633',
+					Password: 'sunj@123',
 					// FacadeName: ''
 				},
 				rememberPsw: true, //复选框状态 默认勾选

+ 6 - 0
plugins/modal.js

@@ -68,6 +68,12 @@ export default {
 	},
 	// 打开遮罩层
 	loading(content) {
+		uni.showLoading({
+			title: content,
+			icon: 'none'
+		})
+	},
+	loadingMask(content) {
 		uni.showLoading({
 			title: content,
 			icon: 'none',

+ 58 - 3
utils/transferparams.js

@@ -80,8 +80,8 @@ export function getSearchParam(condition) {
 	let FieldKeys =
 		"FID,FSrcStockLocId.FF102029.FName,FSrcStockId.FName,FDestStockId.FName,FMaterialId.FNumber,FBOXNO_LT,FQty,FENCHASENUM_LT,FAuxPropId.FF101501.FDataValue,FLot.FNumber,FNoteEntry,FBillNo,FStockerId.FName,FDate,FDestStockId.FNumber"
 	console.log(condition.FBillType)
-	
-	
+
+
 
 	console.log(FieldKeys)
 
@@ -95,7 +95,7 @@ export function getSearchParam(condition) {
 }
 export function getBillDetailListParam(condition) {
 	console.log(condition)
-	
+
 	return {
 		"parameters": [{
 			"FormId": condition.FormId,
@@ -252,4 +252,59 @@ export function getAuditParam(FormId, data) {
 	}
 	console.log(params)
 	return params
+}
+
+//根据条形码查编号批号
+export function getFLotFNumber(lotCode) {
+	return {
+		parameters: [{
+			FormId: "LT_BD_MtlLotCodeMap",
+			FieldKeys: "FNumber,FMaterialId.FNumber,FLot.FNumber",
+			FilterString: [{
+					"Left": "",
+					"FieldName": "FNumber",
+					"Compare": "67",
+					"Value": lotCode,
+					"Right": "",
+					"Logic": 0
+				},
+
+			]
+		}]
+	};
+}
+//根据编号批号查即时库存
+export function getInventory(lot,material) {
+	return {
+		parameters: [{
+			FormId: "STK_Inventory",
+			FieldKeys: "FStockLocId.FF102029.FNumber,FStockLocId.FF102029.FName,FStockName,FMaterialName,FBaseQty",
+			FilterString: [{
+					"Left": "",
+					"FieldName": "FLot.FNumber",
+					"Compare": "67",
+					"Value": lot,
+					"Right": "",
+					"Logic": 0
+				},
+				{
+					"Left": "",
+					"FieldName": "FMaterialId.FNumber",
+					"Compare": "67",
+					"Value": material,
+					"Right": "",
+					"Logic": 0
+				},
+				{
+					"Left": "",
+					"FieldName": "FBaseQty",
+					"Compare": "70",
+					"Value": "0",
+					"Right": "",
+					"Logic": 0
+				}
+
+			]
+		}]
+	};
 }