Parcourir la source

合并出库与入库、退库代码

LT31650A il y a 1 mois
Parent
commit
3a4c3faecc

+ 15 - 1
api/production_replenishment.js

@@ -1,4 +1,7 @@
-import request from '@/utils/request'
+import
+request
+from '@/utils/request'
+import request1 from '../utils/requestnew'
 export function getBillList(data) {
 	return request({
 		'url': 'DynamicFormService.BillQuery.common.kdsvc',
@@ -58,3 +61,14 @@ export function audit(data) {
 		'data': data
 	})
 }
+//查询仓位
+export function Querylocation(data) {
+	return request1({
+		'url': 'StockScanGetStockLocInfo',
+		'method': 'post',
+		'header': {
+			'Content-Type': 'application/x-www-form-urlencoded'
+		},
+		'data': data
+	})
+}

+ 47 - 2
package-lock.json

@@ -1,11 +1,12 @@
 {
-  "name": "fabric-delivery",
+  "name": "uniapp-shirt-fabric-scan",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "dependencies": {
-        "vue-virtual-scroller": "^1.1.2"
+        "vue-virtual-scroller": "^1.1.2",
+        "xml2js": "^0.6.2"
       }
     },
     "node_modules/@babel/parser": {
@@ -108,6 +109,11 @@
         "url": "https://github.com/prettier/prettier?sponsor=1"
       }
     },
+    "node_modules/sax": {
+      "version": "1.4.1",
+      "resolved": "https://mirrors.cloud.tencent.com/npm/sax/-/sax-1.4.1.tgz",
+      "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="
+    },
     "node_modules/scrollparent": {
       "version": "2.1.0",
       "resolved": "https://mirrors.cloud.tencent.com/npm/scrollparent/-/scrollparent-2.1.0.tgz",
@@ -167,6 +173,26 @@
       "peerDependencies": {
         "vue": "^2.6.11"
       }
+    },
+    "node_modules/xml2js": {
+      "version": "0.6.2",
+      "resolved": "https://mirrors.cloud.tencent.com/npm/xml2js/-/xml2js-0.6.2.tgz",
+      "integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==",
+      "dependencies": {
+        "sax": ">=0.6.0",
+        "xmlbuilder": "~11.0.0"
+      },
+      "engines": {
+        "node": ">=4.0.0"
+      }
+    },
+    "node_modules/xmlbuilder": {
+      "version": "11.0.1",
+      "resolved": "https://mirrors.cloud.tencent.com/npm/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
+      "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
+      "engines": {
+        "node": ">=4.0"
+      }
     }
   },
   "dependencies": {
@@ -224,6 +250,11 @@
       "optional": true,
       "peer": true
     },
+    "sax": {
+      "version": "1.4.1",
+      "resolved": "https://mirrors.cloud.tencent.com/npm/sax/-/sax-1.4.1.tgz",
+      "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="
+    },
     "scrollparent": {
       "version": "2.1.0",
       "resolved": "https://mirrors.cloud.tencent.com/npm/scrollparent/-/scrollparent-2.1.0.tgz",
@@ -271,6 +302,20 @@
         "vue-observe-visibility": "^0.4.4",
         "vue-resize": "^0.4.5"
       }
+    },
+    "xml2js": {
+      "version": "0.6.2",
+      "resolved": "https://mirrors.cloud.tencent.com/npm/xml2js/-/xml2js-0.6.2.tgz",
+      "integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==",
+      "requires": {
+        "sax": ">=0.6.0",
+        "xmlbuilder": "~11.0.0"
+      }
+    },
+    "xmlbuilder": {
+      "version": "11.0.1",
+      "resolved": "https://mirrors.cloud.tencent.com/npm/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
+      "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
     }
   }
 }

+ 2 - 1
package.json

@@ -1,5 +1,6 @@
 {
   "dependencies": {
-    "vue-virtual-scroller": "^1.1.2"
+    "vue-virtual-scroller": "^1.1.2",
+    "xml2js": "^0.6.2"
   }
 }

+ 34 - 0
pages.json

@@ -80,6 +80,40 @@
 			"style": {
 				"navigationBarTitleText": "单据存档操作"
 			}
+		},
+		{
+			"path": "pages/storage/index",
+			"style": {
+				"navigationBarTitleText": "生产补料料管平台"
+				// "navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/storage/search",
+			"style": {
+				"navigationBarTitleText": "源单查询"
+				// "navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/storage/summary",
+			"style": {
+				"navigationBarTitleText": "源单统计"
+				// "navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/storage/show",
+			"style": {
+				"navigationBarTitleText": "源单修改"
+				// "navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/storage/stage",
+			"style": {
+				"navigationBarTitleText": "单据存档操作"
+			}
 		}
 	],
 	"globalStyle": {

+ 72 - 11
pages/index/index.vue

@@ -130,6 +130,37 @@
 						url: '/pages/stock-dispatch/index'
 					});
 				}
+				if (item.name == "采购退料单") {
+					const formId = 'PUR_MRB';
+					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
+					uni.setStorageSync('formId', formId)
+					uni.setStorageSync('fbillType', null)
+					uni.setStorageSync('moudleName', item.name)
+					uni.navigateTo({
+						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
+						url: '/pages/stock-dispatch/index'
+					});
+				}
+				if (item.name == "受托加工材料退料单") {
+					const formId = 'STK_OEMInStockRETURN';
+					uni.setStorageSync('formId', formId)
+					uni.setStorageSync('fbillType', null)
+					uni.setStorageSync('moudleName', item.name)
+					uni.navigateTo({
+						url: '/pages/stock-dispatch/index'
+					});
+				}
+
+				if (item.name == "销售出库") {
+					const formId = 'SAL_OUTSTOCK';
+					uni.setStorageSync('formId', formId)
+					uni.setStorageSync('fbillType', null)
+					uni.setStorageSync('moudleName', item.name)
+					uni.navigateTo({
+						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
+						url: '/pages/stock-dispatch/index',
+					});
+				}
 				if (item.name == "简单生产领料(智能)") {
 					const formId = 'SP_PickMtrl';
 					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
@@ -141,34 +172,64 @@
 						url: '/pages/stock-dispatch/index'
 					});
 				}
-				if (item.name == "采购退料单") {
-					const formId = 'PUR_MRB';
+				if (item.name == "其他入库单") {
+					const formId = 'STK_MISCELLANEOUS';
 					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
 					uni.setStorageSync('formId', formId)
 					uni.setStorageSync('fbillType', null)
 					uni.setStorageSync('moudleName', item.name)
 					uni.navigateTo({
 						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
-						url: '/pages/stock-dispatch/index'
+						url: '/pages/storage/index'
 					});
 				}
-				if (item.name == "受托加工材料退料单") {
-					const formId = 'STK_OEMInStockRETURN';
+				if (item.name == "采购入库单") {
+					const formId = 'STK_InStock';
+					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
 					uni.setStorageSync('formId', formId)
-					uni.setStorageSync('fbillType', null)
+					// uni.setStorageSync('fbillType', null)
 					uni.setStorageSync('moudleName', item.name)
 					uni.navigateTo({
 						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
-						url: '/pages/stock-dispatch/index'
+						url: '/pages/storage/index'
 					});
-				}if (item.name == "销售出库") {
-					const formId = 'SAL_OUTSTOCK';
+				}
+				if (item.name == "受托加工入库单") {
+					const formId = 'STK_OEMInStock';
+					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
 					uni.setStorageSync('formId', formId)
-					uni.setStorageSync('fbillType', null)
+					// uni.setStorageSync('fbillType', null)
 					uni.setStorageSync('moudleName', item.name)
 					uni.navigateTo({
 						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
-						url: '/pages/stock-dispatch/index'
+						url: '/pages/storage/index'
+					});
+				}
+				if (item.name == "生产退料料管作业平台") {
+					const formId = 'LT_PRD_PMCWorkBench';
+					uni.setStorageSync('formId', formId)
+					uni.setStorageSync('fbillType', 'd43d7e5b9def82fd11e3e603ca986cd9')
+					uni.setStorageSync('moudleName', item.name)
+					uni.navigateTo({
+						url: '/pages/storage/index'
+					});
+				}
+				if (item.name == "简单生产退料单") {
+					const formId = 'SP_ReturnMtrl';
+					uni.setStorageSync('formId', formId)
+					// uni.setStorageSync('fbillType', 'd43d7e5b9def82fd11e3e603ca986cd9')
+					uni.setStorageSync('moudleName', item.name)
+					uni.navigateTo({
+						url: '/pages/storage/index'
+					});
+				}
+				if (item.name == "其他出库(退货)") {
+					const formId = 'STK_MisDelivery';
+					uni.setStorageSync('formId', formId)
+					uni.setStorageSync('fbillType', 'RETURN')
+					uni.setStorageSync('moudleName', item.name)
+					uni.navigateTo({
+						url: '/pages/storage/index'
 					});
 				}
 			},

+ 12 - 1
pages/login/index.vue

@@ -61,9 +61,20 @@
 		data() {
 			return {
 				loginForm: {
+// <<<<<<< HEAD
+// 					// Env: 'http://10.201.3.146',//测试地址
+// 					// Env: 'http://10.200.0.222',
+// 					acctID: '5d5812913fe36c',
+// =======
+// <<<<<<< HEAD
+					Env: 'http://10.201.3.146',
+					acctID: '65864d91189ad0',
+// =======
 					// Env: 'http://10.201.3.146',//测试地址
 					// Env: 'http://10.200.0.222',
-					acctID: '5d5812913fe36c',
+// 					acctID: '5d5812913fe36c',
+// >>>>>>> e217401 (记住地址功能)
+// >>>>>>> storage
 					FStockOrgId: '100',
 					UserName: '',
 					Password: '',

+ 2 - 0
pages/stock-dispatch/index.vue

@@ -67,6 +67,7 @@
 						{{ getWorkCenterName(item) }}
 					</view>
 					<view class="table-cell2" :style="getStyle(item.smzt)" v-else-if="showMaterialReceiver">
+
 						{{ item["FDeptId.FName"] }}
 					</view>
 					<!-- <view class="table-cell2" :style="getStyle(item.smzt)" v-if="formId === 'LT_PRD_PMCWorkBench'">
@@ -199,6 +200,7 @@
 			showWorkCenter() {
 				return this.formId !== 'PUR_MRB' && this.formId !== 'STK_MisDelivery' && this.formId !==
 					'STK_OEMInStockRETURN' && this.formId !== 'SAL_OUTSTOCK';
+
 			},
 			showRemark() {
 				return this.formId !== 'PUR_MRB';

+ 0 - 1
pages/stock-dispatch/search.vue

@@ -133,7 +133,6 @@
 						<view class="table-cell1-1">{{ item["FBillNo"] }}</view>
 						<view class="table-cell">{{ item["FDate"].substring(0, 10) }}</view>
 						<view class="table-cell">{{ item["FDescription"] }}</view>
-
 					</view>
 				</checkbox-group>
 			</view>

+ 1184 - 0
pages/storage/index.vue

@@ -0,0 +1,1184 @@
+<template>
+	<view>
+		<view class="sticky-box">
+			<view class="button-group">
+				<button type="default" @click="reset">取消</button>
+				<button type="default" @click="navigateToSummary">统计</button>
+				<button type="default" @click="navigateToSearch">查仓</button>
+				<button type="default" @click="navigateToStage">暂存</button>
+			</view>
+			<uni-easyinput prefixIcon="search" :focus="isFocus" v-model="searchValue" @blur="isFocus = false"
+				@confirm="scan" @clear="clear" placeholder="请扫描拼件单号">
+			</uni-easyinput>
+		</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">
+				<view class="table-header">
+					<!-- <view class="table-cell">操作</view> -->
+					<view class="table-cell">扫描状态</view>
+					<view class="table-cell1">装箱单号</view>
+					<view class="table-cell">仓位</view>
+					<view class="table-cell">收货仓库</view>
+					<view class="table-cellwl">物料编码</view>
+					<view class="table-cellph">批号</view>
+					<view class="table-cell1">实际作业数量</view>
+					<view class="table-cell1">计量单位</view>
+					<view class="table-cell">日期</view>
+					<view class="table-cell3">单据编号</view>
+				</view>
+				<view class="table-row" v-for="(item, index) in indexList" :key="index" :id="'scrollItem-' + index"
+					:style="getStyle(item.smzt)">
+					<!-- <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-cell1" :style="getStyle(item.smzt)">{{ item["FENCHASENUM.LT"] }}</view>
+					<view class="table-cell">{{ item["FStockLocId.FF102029.FNumber"] }}</view>
+					<view class="table-cell" :style="getStyle(item.smzt)">{{ item["FSTOCKID.FName"] }}</view>
+					<view class="table-cellwl" :style="getStyle(item.smzt)">{{ item["FMATERIALID.FNumber"] }}</view>
+					<view class="table-cellph" :style="getStyle(item.smzt)">{{ item["FLOT.FNumber"] }}</view>
+					<view class="table-cell1" :style="getStyle(item.smzt)">
+						{{ getActualWorkQuantity(item) }}
+					</view>
+					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FUnitID.FName"] }}</view>
+					<view class="table-cell" :style="getStyle(item.smzt)">{{ item["FDate"].substring(0, 10) }}</view>
+					<view class="table-cell3" :style="getStyle(item.smzt)">{{ item["FBillNo"] }}</view>
+
+				</view>
+			</scroll-view>
+		</view>
+
+		<view style="height: 200px;touch-action: none;"></view>
+		<view class="card-bottom" style="">
+			<view style="margin: 0 auto;">
+				<view
+					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>
+			</view>
+		</view>
+	</view>
+</template>
+
+
+<script>
+	import {
+		audit,
+		getBillList,
+		getInventoryList,
+		save,
+		submit
+	} from '../../api/production_replenishment';
+	import modal from '../../plugins/modal';
+	// import {
+	// 	audioUrls,
+	// 	playVoice
+	// } from '../../utils/audio';
+	import {
+		playVoice,
+		audioUrls,
+		playSequentially
+	} from '../../utils/audio2';
+	import submitHelper from '@/utils/storageSubmitHelper.js'; // 确保路径正确
+	import {
+		executeSql
+	} from '../../utils/database';
+	import {
+		createInventoryQueryRequest,
+		getSearchParam,
+		getStorageByBillNoParam,
+		getStorageSearchParam
+	} from '@/utils/storageParams.js';
+	export default {
+		onShow() {
+			const res = uni.getSystemInfo({
+				success: (res => {
+					console.log(res.windowHeight)
+					if (res.windowHeight < 600) {
+						this.clientHeight = 580
+					} else {
+						this.clientHeight = res.windowHeight - 150;
+					}
+					console.log(res.windowHeight)
+					console.log(this.clientHeight)
+					// console.log(getApp().globalData.navHeight)
+				})
+			});
+			this.$nextTick(() => {
+				this.searchValue = ''
+				this.isFocus = true;
+			})
+		},
+		computed: {
+			//已扫描数量
+			indexListLength() {
+				console.log("执行了计算属性")
+				console.log(this.indexList.filter(obj => obj.smzt === 1).length)
+				return this.indexList.filter(obj => obj.smzt === 1).length
+			},
+			//剩余数量
+			indexList2Length() {
+				let arr1 = this.indexList.filter((item, index, self) => {
+					return item.smzt == 0
+				})
+				console.log(arr1)
+				return arr1.length
+			},
+			//正操作仓位未扫描数量
+			indexList3Length() {
+				return this.indexList.filter(item =>
+					item["FStockLocId.FF102029.fname"] == this.Location && item['smzt'] != 1
+				).length
+			},
+			showWorkCenter() {
+				return this.formId !== 'PUR_MRB';
+			},
+			showRemark() {
+				return this.formId !== 'PUR_MRB';
+			},
+			showApplicant() {
+				return this.formId !== 'PUR_MRB';
+			}
+		},
+		mounted() {
+			// 页面加载完成后滚动到目标数据位置
+			uni.$on('scrollIntoView', (target) => {
+				this.$nextTick(() => {
+					// 使用id属性定位
+					uni.createSelectorQuery().select('#' + target).boundingClientRect().exec((rect) => {
+						console.log(rect)
+						uni.pageScrollTo({
+							scrollTop: rect[0].top - 95,
+							duration: 0
+						});
+					});
+				});
+
+			})
+			this.$nextTick(() => {
+				this.searchValue = ''
+				this.isFocus = true;
+			})
+
+
+		},
+		//监听
+		watch: {
+			Location(newValue, oldValue) {
+				console.log(`Location changed from ${oldValue} to ${newValue}`)
+				this.Location = newValue
+				// 可以在这里执行相应的操作
+			},
+		},
+		data() {
+			return {
+				formId: '',
+				fbillType: '',
+				isFocus: true,
+				indexList: [],
+				clientHeight: '',
+				searchValue: '',
+				scrollItem: '', // 滚动到的指定元素
+				color: '',
+				stockNum: '', //正操作仓库
+				uniqueFStockLocId: [],
+				balance: 0,
+				isStage: false,
+				stageIds: [],
+				stageLists: [],
+				tableName: "common_bill",
+
+			};
+		},
+		//获取上一页传过来的参数
+		onLoad(option) {
+			this.formId = uni.getStorageSync("formId")
+			// this.fbillType = option.FBillType;
+			// console.log(this.formId)
+			// console.log(this.fbillType)
+			uni.setNavigationBarTitle({
+				title: uni.getStorageSync("moudleName")
+			});
+			uni.$on('item', (data) => {
+				console.log(data)
+				let index = data["index"]
+				if ("NewFENCHASENUM.LT" in data) {
+					this.indexList[index]["FENCHASENUM.LT"] = data["NewFENCHASENUM.LT"]
+				}
+				if (this.indexList[index]["FStockLocId.FF102029.fname"] != data["FStockLocId.FF102029.fname"]) {
+					const requestData = createInventoryQueryRequest(data["FStockLocId.FF102029.fname"])
+					getInventoryList(JSON.stringify(requestData)).then(res => {
+						this.indexList[index]["quantity"] = res.length
+						console.log("修改了原仓位条数", res.length)
+						this.indexList[index]['FStockLocId.FF102029.fname'] = data[
+							"FStockLocId.FF102029.fname"]
+						// 用于记录每个组合的计数
+						let countMap = {};
+						// 统计每个组合的行数
+						this.indexList.forEach(obj => {
+							// 获取当前对象的组合键
+							let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
+							// 如果该组合已经存在于 countMap 中,则增加计数,否则初始化为 1
+							if (countMap[key]) {
+								countMap[key]++;
+							} else {
+								countMap[key] = 1;
+							}
+						});
+						// 将计数值添加到每个对象中
+						this.indexList.forEach(obj => {
+							let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
+							obj.rowCount = countMap[key];
+						});
+					})
+				}
+				this.indexList[index]['FInventoryQty'] = data["FInventoryQty"]
+				// 定义一个映射对象
+				const formIdMap = {
+					'LT_PRD_PMCWorkBench': 'FActualQty',
+					'SP_PickMtrl': 'FActualQty',
+					'STK_MisDelivery': 'FQty',
+					'PUR_MRB': 'FRMREALQTY'
+				};
+				// 获取对应的字段名称
+				const field = formIdMap[this.formId];
+				// 如果存在匹配的字段,则更新 indexList
+				if (field) {
+					this.indexList[index][field] = data[field];
+				}
+				// this.indexList[index]['FActualQty'] = data["FActualQty"]
+				this.indexList[index]['Flot.FNumber'] = data["Flot.FNumber"]
+				this.indexList[index]['FAuxPropId.FF101501.FDATAVALUE'] = data["FAuxPropId.FF101501.FDATAVALUE"]
+				this.indexList[index]['smzt'] = data["smzt"]
+				console.log(this.indexList[index])
+				this.$nextTick(() => {
+					this.searchValue = ''
+					this.isFocus = true
+				})
+			})
+			uni.$on('search', (data) => {
+				console.log(data)
+				console.log(this.indexList)
+				// 遍历 indexList 数组
+				this.indexList.forEach(item => {
+					// 检查 smzt 是否为 1
+					if (item.smzt === 1 && item['FStockLocId.FF102029.FNumber'] == null) {
+						// 修改 FStockLocId.FF102029.FNumber 为 'a'
+						item['FStockLocId.FF102029.FNumber'] = data;
+					}
+				});
+
+				// this.indexList = data
+				// this.indexList.forEach(item => {
+				// 	// item.smzt = 0; // 增加属性 smzt,并设置初始值为0
+				// 	this.$set(item, 'smzt', 0);
+				// })
+				// // 用于记录每个组合的计数
+				// let countMap = {};
+				// // 统计每个组合的行数
+				// this.indexList.forEach(obj => {
+				// 	// 获取当前对象的组合键
+				// 	let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
+
+				// 	// 如果该组合已经存在于 countMap 中,则增加计数,否则初始化为 1
+				// 	if (countMap[key]) {
+				// 		countMap[key]++;
+				// 	} else {
+				// 		countMap[key] = 1;
+				// 	}
+				// });
+
+				// // 将计数值添加到每个对象中
+				// this.indexList.forEach(obj => {
+				// 	let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
+				// 	// obj.rowCount = countMap[key];
+				// 	this.$set(obj, 'rowCount', countMap[key])
+				// });
+				// // 1. 提取不同的仓位
+				// this.uniqueFStockLocId = [...new Set(this.indexList.map(obj => obj[
+				// 	'FStockLocId.FF102029.fname']))];
+				// console.log(this.uniqueFStockLocId)
+				// // this.processQuantity(this.uniqueFStockLocId[0])
+				// this.updateIndexList(this.indexList)
+				// this.$nextTick(() => {
+				// 	this.searchValue = ''
+				// 	this.isFocus = true;
+				// })
+			})
+			uni.$on('summary', (data) => {
+				console.log(data)
+				this.indexList = data
+				this.searchValue = ''
+				this.isFocus = true;
+			})
+			uni.$on('stage', (data) => {
+				console.log(data)
+				// 处理每个对象
+				this.stageLists = data.map(item => {
+					// 解析 data 字段
+					const parsedData = JSON.parse(item.data);
+
+					// 返回处理后的对象
+					return {
+						...item,
+						data: parsedData
+					};
+				});
+				this.stageIds = data.map(item => item.id)
+				// this.stageLists = data.map(item => item.data)
+				console.log(this.stageIds)
+				console.log(this.stageLists)
+				// 解析字符串为数组并合并
+				const combinedArray = this.stageLists
+					.map(item => item.data) // 解析每个字符串
+					.flat(); // 合并所有数组
+
+				console.log(combinedArray);
+				this.indexList = combinedArray
+				this.searchValue = ''
+				this.isFocus = true;
+				this.isStage = true
+			})
+
+			this.$nextTick(() => {
+				console.log('dddd')
+				this.searchValue = ''
+				this.isFocus = true;
+			})
+			// this.$forceUpdate()
+
+		},
+		methods: {
+			getActualWorkQuantity(item) {
+				switch (this.formId) {
+					case 'STK_InStock':
+						return item["FRealQty"];
+					default:
+						return item["FQty"];
+				}
+			},
+			getFabricOrderNo(item) {
+				switch (this.formId) {
+					case 'PUR_MRB':
+						return item["FFabricOrderNo"];
+					default:
+						return item["FFabricOrderNo.LT"];
+				}
+			},
+			getWorkCenterName(item) {
+				switch (this.formId) {
+					case 'LT_PRD_PMCWorkBench':
+						return item["FEWorkCenterId.LT.fname"];
+					case 'STK_MisDelivery':
+					case 'SP_PickMtrl':
+						return item["FWorkCenterId.fname"];
+					default:
+						return '';
+				}
+			},
+			getApplicantName(item) {
+				switch (this.formId) {
+					case 'LT_PRD_PMCWorkBench':
+						return item["FApplicantId.fname"];
+					case 'STK_MisDelivery':
+						return item["FPickingPeople.LT.fname"];
+					case 'SP_PickMtrl':
+						return item["FPickerId.fname"];
+					default:
+						return ''; // 默认返回值,可以根据需求调整
+				}
+			},
+			async updateIndexList(data1) {
+				try {
+					// 存储所有的异步操作 promise
+					let promises = [];
+					// 遍历 uniqueFStockLocId 数组
+					for (let fname of this.uniqueFStockLocId) {
+						const requestData = createInventoryQueryRequest(fname)
+
+						// 发起异步请求,并将 promise 存储在数组中
+						let promise = getInventoryList(JSON.stringify(requestData)).then(res => {
+							let objs = data1.filter(item => item['FStockLocId.FF102029.fname'] === fname);
+
+							objs.forEach(obj => {
+								this.$set(obj, 'quantity', res.length);
+							});
+						});
+
+						promises.push(promise);
+					}
+
+					// 等待所有异步操作完成
+					await Promise.all(promises)
+					console.log(data1)
+					this.indexList = data1
+
+					console.log('indexList updated:', this.indexList);
+				} catch (error) {
+					console.error('Error updating indexList:', error);
+				}
+			},
+			scrollToItem(itemId) {
+				// 设置滚动到的指定元素的 ID
+				this.scrollItem = itemId;
+				console.log(this.scrollItem)
+			},
+			//取消
+			reset() {
+				const self = this
+				modal.confirm("是否重置?").then(res => {
+					if (res) {
+						self.indexList = []
+						self.searchValue = ""
+						self.balance = 0
+						this.isFocus = true
+						playVoice(audioUrls.warningSuccessUrl)
+					} else {
+						// 用户点击取消,不执行任何操作
+					}
+				})
+			},
+			edit(item, index) {
+				uni.navigateTo({
+					url: '/pages/storage/show?item=' + encodeURIComponent(JSON.stringify(
+							item)) +
+						'&&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]
+				console.log(item)
+				uni.navigateTo({
+					url: '/pages/automatedwarehouse/listshow?Info=' + encodeURIComponent(JSON.stringify(
+						item))
+				});
+			},
+			focusPoint() {
+				this.isFocus = false;
+				this.$nextTick(() => {
+					this.isFocus = true;
+				});
+			},
+			clear() {
+				this.focusPoint()
+			},
+			//跳转到查询页面
+			navigateToSearch() {
+				if (this.indexList.length == 0) {
+					// this.isRangeSelected = false; // 显示错误提示
+					playVoice(audioUrls.failVoiceUrl)
+					uni.showToast({
+						title: '请先扫描',
+						duration: 2000,
+						icon: "error"
+					});
+					return;
+				}
+				console.log(this.stockNum)
+				uni.navigateTo({
+					// url: '/pages/production-replenishment/search', //这是你的当前页面地址
+					url: `/pages/storage/search?stockNum=${this.stockNum}`
+				});
+
+			},
+			navigateToSummary() {
+				uni.navigateTo({
+					url: '/pages/storage/summary?Info=' + encodeURIComponent(JSON
+						.stringify(this.indexList)) + '&&stageInfo=' + encodeURIComponent(JSON
+						.stringify(this.stageLists)), //这是你的当前页面地址
+				});
+
+			},
+			navigateToStage() {
+				uni.navigateTo({
+					url: '/pages/storage/stage?Info=' + encodeURIComponent(JSON
+						.stringify(this.indexList)), //这是你的当前页面地址
+				});
+
+			},
+			searchValueIsEmpty(data) {
+				console.log(data)
+				if (data == "" || data == undefined) {
+					return true
+				} else {
+					return false
+				}
+
+			},
+			checkBarcodeInArray(barcode, arrayOfObjects, propertyName) {
+				if (arrayOfObjects.findIndex(item => item[propertyName] === barcode) < 0) { //不存在
+					return true
+				}
+				return false
+
+			},
+			areAllDetailsScanned(nowindex) {
+				if (this.indexList.filter(item =>
+						item["FBillNo"] == this.indexList[nowindex].FBillNo && item[
+							'smzt'] == 0
+					).length == 0) {
+					return true
+				}
+				return false
+
+			},
+			isAllPositionsComplete(nowindex) {
+				console.log(this.indexList[nowindex].FBillNo)
+				console.log(this.indexList[nowindex]["FStockLocId.FF102029.FNumber"])
+				if (this.indexList.filter(item =>
+						item["FBillNo"] == this.indexList[nowindex].FBillNo && item["FStockLocId.FF102029.FNumber"] ==
+						null
+					).length == 0) {
+					console.log(this.indexList.filter(item =>
+						item["FBillNo"] == this.indexList[nowindex].FBillNo && item[
+						"FStockLocId.FF102029.FNumber"] ==
+						null
+					).length)
+					return true
+				}
+				return false
+
+			},
+			showToast() {
+				uni.showToast({
+					title: '请扫描条码',
+					icon: 'none',
+					duration: 3000
+				})
+			},
+			handlePositionScanCompletion() { //根据仓位扫描的完成情况来处理不同的逻辑
+				if (this.indexList.filter(item =>
+						item["FStockLocId.FF102029.fname"] == this.Location && item[
+							'smzt'] != 1
+					).length == 0) { //该仓位扫描完
+					playVoice(audioUrls.allSuccessVoiceUrl)
+
+					uni.showToast({
+						title: '该仓位扫描完成',
+						icon: 'none',
+						duration: 3000
+					})
+
+				} else { //如果改仓位未扫描完,提示音
+					playVoice(audioUrls.successVoiceUrl)
+					uni.showToast({
+						title: '扫描成功',
+						icon: 'none',
+						duration: 3000
+					})
+				}
+			},
+			handleError(error) {
+				playVoice(audioUrls.failVoiceUrl)
+				console.error('操作失败:', error);
+				modal.confirm(error.message || '操作失败').then(res => {
+					if (res) {
+
+					} else {
+						// 用户点击取消,不执行任何操作
+					}
+				})
+				// uni.showToast({
+				// 	title: error.message || '操作失败',
+				// 	duration: 3000,
+				// 	icon: "none"
+				// });
+
+			},
+			async handleSubmit(FID) {
+				const FormId = uni.getStorageSync('formId')
+				try {
+					await submitHelper.submit(FormId, FID, this.indexList);
+					this.indexList = this.indexList.filter(item => item.FID !== FID);
+					console.log(this.indexList)
+					if (this.isStage == true) {
+						// 处理每个对象
+						this.stageLists.forEach(item => {
+							// 过滤掉 FID 匹配的对象
+							item.data = item.data.filter(obj => obj.FID !== FID);
+
+							// 检查 data 数组是否为空
+							if (item.data.length === 0) {
+								console.log("data 数组为空"); //删除暂存
+								this.deleteStages(item.id)
+							} else {
+								console.log("data 数组不为空");
+							}
+						})
+						console.log(this.stageLists)
+					}
+					this.balance = 0
+				} catch (error) {
+					this.handleError(error)
+				}
+			},
+			async deleteStages(id) {
+				let condition = `id = (${id})`
+				let sql = `delete from ${this.tableName} where ${condition}`
+				executeSql(sql).then(result => {
+						console.log('结果:', result);
+						// this.handleDeleteSuccess()
+					})
+					.catch(error => {
+						console.error('捕获错误:', error); // 输出: 捕获错误: 失败的结果
+						// this.handleDeleteFail(error)
+					})
+			},
+			showModalAndHandleSubmit(nowindex) {
+				let vm = this
+				console.log(nowindex)
+				console.log(this.indexList[nowindex])
+				let bBillNo = this.indexList[nowindex]["FBillNo"]
+				let FID = this.indexList[nowindex]["FID"]
+				this.$nextTick(() => {
+					this.searchValue = ''
+					this.isFocus = true;
+				})
+				playVoice(audioUrls.allSuccessVoiceUrl)
+				uni.showModal({
+					title: "提示",
+					content: "单号(" + bBillNo + ")已扫描完毕,是否提交",
+					showCancel: true,
+					success: function(res) {
+						if (res.confirm) {
+							// this.submit(FID)
+							this.handleSubmit(FID)
+						} else {
+
+							// 执行取消后的操作
+						}
+					}.bind(this)
+				})
+			},
+			showModalAndHandlePosition(nowindex) {
+				let vm = this
+				// console.log(nowindex)
+				let bBillNo = this.indexList[nowindex]["FBillNo"]
+				// let FID = this.indexList[nowindex]["FID"]
+				// this.$nextTick(() => {
+				// 	this.searchValue = ''
+				// 	this.isFocus = true;
+				// })
+				// playVoice(audioUrls.allSuccessVoiceUrl)
+				uni.showModal({
+					title: "提示",
+					content: "单号(" + bBillNo + ")已扫描完毕,请选择仓位",
+					showCancel: true,
+					success: function(res) {
+						if (res.confirm) {
+							// this.submit(FID)
+							this.navigateToSearch()
+						} else {
+
+							// 执行取消后的操作
+						}
+					}.bind(this)
+				})
+			},
+			handleScanSuccess() {
+				// this.Location = this.indexList[nowindex]["FStockLocId.FF102029.fname"]
+				// this.indexList[nowindex].smzt = 1 //修改数据状态
+				this.indexList = this.indexList.map(item => {
+					if (item["FENCHASENUM.LT"] == this.searchValue) {
+						item.smzt = 1
+					}
+					return item
+				})
+				console.log(this.indexList)
+				let nowindex = null; //该条码的索引
+
+				for (let i = 0; i < this.indexList.length; i++) { //获取查询装箱单号对应仓位,并切换当前仓位
+				console.log(this.indexList[i]["FENCHASENUM.LT"])
+				console.log(this.searchValue)
+					if (this.indexList[i]["FENCHASENUM.LT"] === this.searchValue) {
+						// nowlocation = this.indexList[i]["FStockLocId.FF102029.fname"] //当前仓位
+						nowindex = i //当前索引
+						this.stockNum = this.indexList[nowindex]["FSTOCKID.FNumber"]
+						console.log(this.indexList[nowindex]["FSTOCKID.FNumber"])
+						// this.balance = this.indexList[i]["quantity"] - this.indexList[i]["rowCount"]
+						break;
+					}
+				}
+				console.log(this.stockNum)
+				console.log(this.indexList.filter(obj => obj.smzt === 1).length)
+				const audioUrlsArr = [];
+				audioUrlsArr.push(audioUrls.success2VoiceUrl);
+				// console.log(this.getActualWorkQuantity(this.indexList[nowindex]))
+				//是否全发
+				// if (this.getActualWorkQuantity(this.indexList[nowindex]) == this.indexList[nowindex][
+				// 		"FInventoryQty"
+				// 	]) { //全发播放声音
+				// 	console.log("播放声音")
+				// 	audioUrlsArr.push(audioUrls.successVoiceUrl);
+				// } else { //不全发播放声音
+				// 	audioUrlsArr.push(audioUrls.success2VoiceUrl);
+				// }
+				// audioUrlsArr.push(audioUrls.success2VoiceUrl);
+				// playSequentially(audioUrlsArr);
+				// if (this.indexList.filter(item =>
+				// 		item["FStockLocId.FF102029.fname"] == this.Location && item[
+				// 			'smzt'] != 1
+				// 	).length == 0) { //该仓位扫描完
+				// 	// playVoice(audioUrls.allSuccessVoiceUrl)
+				// 	audioUrlsArr.push(audioUrls.storeSuccessUrl);
+				// }
+				if (this.areAllDetailsScanned(nowindex)) { //校验单号是否全扫完
+					//校验仓位是否全填
+					audioUrlsArr.push(audioUrls.allSuccessVoiceUrl)
+					if (this.isAllPositionsComplete(nowindex)) {
+						this.showModalAndHandleSubmit(nowindex)
+					} else {
+						this.showModalAndHandlePosition(nowindex)
+
+					}
+					// playVoice(audioUrls.allSuccessVoiceUrl)
+				} else { //单号未全扫完
+					// this.handlePositionScanCompletion()
+					this.$nextTick(() => {
+						this.searchValue = ''
+						this.isFocus = true;
+						this.scrollToItem("scrollItem-" + nowindex)
+					})
+				}
+				playSequentially(audioUrlsArr);
+
+			},
+			createSearchCondition(data) {
+				return {
+					"FormId": uni.getStorageSync('formId'),
+					"FStockOrgId": uni.getStorageSync('FStockOrgId'),
+					"FEnchaseNum_LT": data,
+				};
+			},
+			createSearchConditionByBillNo(data) {
+				return {
+					"FormId": uni.getStorageSync('formId'),
+					"FBillNo": data,
+				};
+			},
+			async scan() {
+				let vm = this
+				//校验是否输入条码
+				if (this.searchValueIsEmpty(this.searchValue)) {
+					playVoice(audioUrls.failVoiceUrl)
+					this.showToast()
+					this.focusPoint()
+					return
+				}
+				// 列表中是否存在该条码
+				if (this.checkBarcodeInArray(this.searchValue, this.indexList, "FENCHASENUM.LT")) { //不存在
+					//查询源单列表
+					const condition = this.createSearchCondition(this.searchValue);
+					const searchParam = getStorageSearchParam(condition)
+					modal.loading('获取数据中,请耐心等待...')
+					// const submitRes = await this.submitData(submitParam);
+					try {
+						const BillNo = await getBillList(JSON.stringify(searchParam))
+						console.log(BillNo)
+						if (BillNo.length !== 0) { //获取到入库单
+							const condition = this.createSearchConditionByBillNo(BillNo[0].FBillNo);
+							const searchByBillNoParam = getStorageByBillNoParam(condition)
+							const BillList = await getBillList(JSON.stringify(searchByBillNoParam))
+							console.log(BillList)
+							BillList.forEach(item => {
+								// item.smzt = 0; // 增加属性 smzt,并设置初始值为0
+								this.$set(item, 'smzt', 0);
+								this.$set(item, 'FStockLocId.FF102029.FNumber', null);
+							})
+							// this.indexList = BillList
+							this.indexList = this.indexList.concat(BillList)
+							
+							this.handleScanSuccess()
+							// this.indexList = this.indexList.map(item => {
+							// 	if (item["FEnchaseNum.LT"] == this.searchValue) {
+							// 		item.smzt = 1
+							// 	}
+							// 	return item
+							// })
+						} else { //不存在查询的入库单
+							modal.msg("请确认输入条件有效!");
+							playVoice(audioUrls.failVoiceUrl);
+						}
+						modal.closeLoading();
+					} catch (error) {
+						console.log(error)
+						// this.handleError(error);
+						throw new Error(error);
+					} finally {
+						modal.closeLoading();
+					}
+					this.$nextTick(() => {
+						this.searchValue = ''
+						this.isFocus = true;
+						// this.scrollToItem("scrollItem-" + nowindex)
+					})
+					// uni.showModal({
+					// 	title: '提示',
+					// 	content: "条码:" + vm.searchValue + '不存在',
+					// 	showCancel: false,
+					// 	success: function(res) {
+					// 		if (res.confirm) {
+					// 			this.focusPoint()
+					// 			vm.searchValue = ''
+					// 			return
+					// 		} else {
+					// 			// 执行取消后的操作
+					// 		}
+					// 	}.bind(this)
+					// })
+					// playVoice(audioUrls.failVoiceUrl)
+					return
+				}
+				//校验条码已扫描
+				// if (this.indexList.findIndex(item => item["FENCHASENUM.LT"] === this.searchValue && item.smzt ==
+				// 		1) >= 0) {
+				// 	uni.showModal({
+				// 		// title: '提示',
+				// 		content: "条码:" + vm.searchValue + '已扫描',
+				// 		showCancel: false,
+				// 		success: function(res) {
+				// 			if (res.confirm) {
+				// 				vm.focusPoint()
+				// 				vm.searchValue = ''
+				// 				return
+				// 			} else {
+				// 				// 执行取消后的操作
+				// 			}
+				// 		}
+				// 	})
+				// 	playVoice(audioUrls.failVoiceUrl)
+				// 	return
+				// }
+				//条码存在未扫描
+				// let nowlocation = null; //该条码的仓位
+				// let nowindex = null; //该条码的索引
+
+				// for (let i = 0; i < this.indexList.length; i++) { //获取查询装箱单号对应仓位,并切换当前仓位
+				// 	if (this.indexList[i]["FEnchaseNum.LT"] === this.searchValue) {
+				// 		// nowlocation = this.indexList[i]["FStockLocId.FF102029.fname"] //当前仓位
+				// 		nowindex = i //当前索引
+				// 		// this.balance = this.indexList[i]["quantity"] - this.indexList[i]["rowCount"]
+				// 		break;
+				// 	}
+				// }
+				//不是首次扫描
+				// if (this.indexListLength != 0) { //已有操作,计算上次操作的仓位未扫描数
+				// 	let UnscannedNumber = this.indexList.filter(item =>
+				// 		item["FStockLocId.FF102029.fname"] == this.Location && item['smzt'] != 1
+				// 	).length
+				// 	if (nowlocation != this.Location && UnscannedNumber != 0) { //仓位不一致
+				// 		playVoice(audioUrls.warningSuccessUrl)
+				// 		uni.showModal({
+				// 			title: "提示",
+				// 			content: "是否切换仓位",
+				// 			showCancel: true,
+				// 			success: function(res) {
+				// 				if (res.confirm) {
+				// 					vm.handleScanSuccess(nowindex)
+				// 				} else {
+				// 					// 执行取消后的操作
+				// 					vm.$nextTick(() => {
+				// 						vm.searchValue = ''
+				// 						vm.isFocus = true;
+				// 					})
+				// 				}
+				// 			}
+				// 		})
+				// 		return
+				// 	} else { //仓位一致或原仓位已扫完,正常扫描,无切换
+				// 		this.handleScanSuccess(nowindex)
+
+				// 	}
+				// } else { //首次扫描
+				// 	this.handleScanSuccess(nowindex)
+				// }
+				this.handleScanSuccess()
+			},
+			handleResponse(res) {
+				// 关闭加载提示
+				modal.closeLoading();
+				// 检查响应是否为空
+				if (res.length === 0) {
+					modal.msg("请确认装箱单号有效!");
+					playVoice(audioUrls.failVoiceUrl);
+					return;
+				}
+				console.log(res)
+				// 处理数据去重并更新状态
+				// this.updateBillList(res);
+			},
+			getHeightStyle() {
+				return 'height:' + this.listHeight + 'px';
+			},
+			getStyle(smzt) {
+				return smzt ? 'background-color: Navy;color:white' : '';
+				// return 'scrollItem-' + index === this.scrollItem ? 'background-color: blue;color:white' : '';
+			},
+		}
+	};
+</script>
+
+
+<style lang="scss">
+	.button-group {
+		display: flex;
+		justify-content: flex-start;
+		/* 主轴上左对齐 */
+		align-items: center;
+		/* 垂直居中对齐 */
+	}
+
+	.button-group button {
+		white-space: nowrap;
+		/* 禁止换行 */
+		// margin-right: 10px;
+	}
+
+	.button-item {
+		flex: 1;
+		text-align: center;
+		padding: 10px;
+		font-size: 16px;
+		background-color: #eee;
+	}
+
+	/* 容器样式 */
+	.table-container {
+		width: 100%;
+		// overflow: hidden;
+		/* 添加滚动条 */
+	}
+
+	/* 表头样式 */
+	.table-header {
+		// background-color: #f0f0f0;
+		font-weight: bold;
+		display: flex;
+
+	}
+
+	/* 表行样式 */
+	.table-row {
+		display: flex;
+		flex-direction: row;
+		/* 水平布局 */
+		// border-top: 1px solid #ccc;
+	}
+
+	/* 表内容样式 */
+	.table-content {
+		width: 100%;
+		overflow: auto;
+	}
+
+	/* 单元格样式 */
+	.table-cell1 {
+		min-width: 85px;
+		/* 设置最小宽度 */
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		padding: 5px;
+		border: 0.5px solid #ccc;
+		// text-align: center;
+	}
+
+	/* 单元格样式 */
+	.table-cell2 {
+		min-width: 90px;
+		/* 设置最小宽度 */
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		padding: 5px;
+		border: 0.5px solid #ccc;
+		// text-align: center;
+	}
+
+	/* 单元格样式 */
+	.table-cell3 {
+		min-width: 100px;
+		/* 设置最小宽度 */
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		padding: 5px;
+		border: 0.5px solid #ccc;
+		// text-align: center;
+	}
+
+	/* 单元格样式 */
+	.table-cell4 {
+		min-width: 85px;
+		/* 设置最小宽度 */
+		flex: 1;
+		padding: 8px;
+		border: 0.5px solid #ccc;
+		text-align: center;
+	}
+
+	/* 单元格样式 */
+	.table-cell {
+		min-width: 80px;
+		padding: 5px;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		border: 0.5px solid #ccc;
+		// text-align: center;
+	}
+
+	/* 单元格样式 */
+	.table-cellph {
+		min-width: 310px;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		border: 0.5px solid #ccc;
+
+	}
+
+	/* 单元格样式 */
+	.table-cellwl {
+		min-width: 150px;
+		/* 设置最小宽度 */
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		border: 0.5px solid #ccc;
+		// text-align: center;
+	}
+
+	/* 最后一个单元格去掉右边框 */
+	.table-cell:last-child {
+		// border-right: none;
+	}
+
+
+	.example {
+		padding: 15px;
+		background-color: #fff;
+	}
+
+	.form-item {
+		display: flex;
+		align-items: center;
+	}
+
+	.sticky-box {
+		/* #ifndef APP-PLUS-NVUE */
+		// display: flex;
+		position: -webkit-sticky;
+		/* #endif */
+		position: sticky;
+		top: var(--window-top);
+		z-index: 99;
+		flex-direction: row;
+		margin: 0px;
+		// padding: 15px 0 15px 0;
+		background-color: #F4F5F6;
+		// border-bottom-style: solid;
+		// border-bottom-color: #E2E2E2;
+	}
+
+	.button {
+		border-color: #e5e5e5;
+		border-style: solid;
+		border-width: 1px;
+		padding: 4px 8px;
+		border-radius: 4px;
+	}
+
+	.card-bottom {
+		touch-action: none;
+
+		// height: 60px;
+		position: fixed;
+		bottom: 0;
+		width: 100%;
+		z-index: 999;
+		background-color: white;
+		border-top: 1px;
+		display: flex;
+		flex-direction: column;
+	}
+
+	.text {
+		font-size: 12px;
+		color: #666;
+		margin-top: 5px;
+	}
+
+	.button {
+		margin-bottom: 10px;
+	}
+
+	.segmented-control {
+		margin-bottom: 15px;
+	}
+
+	// .button-group {
+	// 	margin-top: 15px;
+	// 	display: flex;
+	// 	justify-content: space-around;
+	// }
+
+	.form-item {
+		display: flex;
+		align-items: center;
+	}
+
+	.button {
+		display: flex;
+		align-items: center;
+		height: 35px;
+		margin-left: 10px;
+	}
+</style>
+<style lang="scss">
+	.u-page {
+		padding: 0;
+	}
+
+	.u-demo-block__title {
+		padding: 10px 0 2px 15px;
+	}
+
+	.swipe-action {
+		&__content {
+			padding: 25rpx 0;
+			display: flex;
+			flex-direction: column; //设置布局方向为竖直
+
+			&__text {
+				font-size: 15px;
+				color: $u-main-color;
+				padding-left: 30rpx;
+			}
+		}
+	}
+
+	.u-swipe-action-item {
+		touch-action: none;
+	}
+
+	.red {
+		color: red;
+	}
+
+	.label-picker-container {
+		display: flex;
+		align-items: center;
+		/* 垂直居中对齐 */
+		font-size: 12px;
+		/* 设置标签的字体大小 */
+	}
+</style>

+ 365 - 0
pages/storage/search.vue

@@ -0,0 +1,365 @@
+<template>
+	<view class="table-container">
+		<!-- 查询框 -->
+		<view class="container">
+			<view class="search-container">
+				<uni-easyinput prefixIcon="search" v-model="stockLocNum" placeholder="请输入仓位" style="margin-right: 5px;">
+				</uni-easyinput>
+				<button class="search-button" @click="search">查询</button>
+			</view>
+			<!-- <view style="padding:0 5px 2px 5px;">
+				<uni-datetime-picker v-model="range" type="daterange" @maskClick="maskClick" />
+			</view> -->
+		</view>
+		<!-- 表格容器 -->
+		<scroll-view class="table-scroll" scroll-y @scroll="onScroll">
+			<!-- 表头 -->
+			<view class="table-header" ref="tableHeader">
+				<view class="table-cell1">仓位编号</view>
+			</view>
+			<!-- 表格内容 -->
+			<view class="table-body">
+				<!-- <checkbox-group @change="checkboxChange"> -->
+				<view class="table-row" v-for="(item, index) in stockList" :key="item.FStockLocNum">
+					<!-- <view class="table-cell1"> -->
+					<!-- <checkbox :value="item.FID" :checked="item.checked" />{{ item.FBillNo}} -->
+					<view class="checkbox-container">
+						<checkbox :value="item.FStockLocNum" :checked="item.checked"
+							@tap="handleCheckboxClick(item.FStockLocNum)" />
+						<view style="display: flex; justify-content: center; align-items: center;">
+							{{ item.FStockLocNum}}
+						</view>
+					</view>
+
+					<!-- </view> -->
+
+				</view>
+				<!-- </checkbox-group> -->
+			</view>
+		</scroll-view>
+
+		<!-- 底部按钮 -->
+		<view class="bottom-bar">
+			<button class="mini-btn button" type="primary" size="default" @click="submit">确定</button>
+			<button class="mini-btn button" type="warn" size="default" @click="goBack">取消</button>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	import {
+		getBillList,
+		getBillDetailList,
+		Querylocation
+	} from '../../api/production_replenishment';
+	import modal from '../../plugins/modal';
+	import {
+		audioUrls,
+		playVoice
+	} from '../../utils/audio';
+	import {
+		getBillDetailListParam,
+		getBillDetailParam,
+		getSearchParam
+	} from '../../utils/newparams.js';
+	export default {
+		data() {
+			return {
+				formId: '',
+				stockLocNum: '',
+				selectedItemId: null,
+				range: [], //正式
+				// range: ["2024-07-27",
+				// 	"2024-07-27"
+				// ], //测试
+				selected: [], // 保存每个数据项是否被选中的状态
+				// isRangeSelected: true // 标记是否选择了日期范围,默认为 true
+				stockList: [],
+				BillDetailList: [],
+				stockNum: ''
+				// filteredData: [] // 过滤后的数据
+			};
+		},
+		onLoad(option) {
+			console.log(option)
+			this.stockNum = option.stockNum
+			// this.stageLists = JSON.parse(decodeURIComponent(option.stageInfo))
+			console.log(this.stockNum)
+		},
+		computed: {
+
+		},
+		created() {
+			this.formId = uni.getStorageSync("formId")
+			this.initialDateRange();
+		},
+		methods: {
+			initialDateRange() {
+				let today = new Date();
+				let formattedDate = today.toISOString().split('T')[0]; // 格式化为 "YYYY-MM-DD"
+
+				// 设置 range 属性为当天日期的数组
+				this.range = [formattedDate, formattedDate];
+			},
+			maskClick(e) {
+				console.log('maskClick事件:', e);
+			},
+			handleChange(index) {
+				console.log(index)
+				this.filteredData[index].checked = !this.filteredData[index].checked;
+			},
+			onScroll(e) {
+				const scrollLeft = e.detail.scrollLeft;
+				this.headerLeft = -scrollLeft; // 更新表头左侧位置,实现横向滚动时的对齐效果
+			},
+
+			checkboxChange: function(e) {
+				console.log(e)
+				var items = this.BillList,
+					values = e.detail.value;
+				console.log(values)
+				this.selected = values
+				console.log(this.selected)
+				for (var i = 0, lenI = items.length; i < lenI; ++i) {
+					const item = items[i]
+					if (values.includes(item.FID)) {
+						this.$set(item, 'checked', true)
+					} else {
+						this.$set(item, 'checked', false)
+					}
+				}
+				console.log(items)
+			},
+			async submit() {
+				if (this.selectedItemId == null) {
+					modal.msgError("请选择仓位")
+					playVoice(audioUrls.failVoiceUrl)
+					return
+				}
+				this.navigateBack();
+			},
+			// 返回上一页并传递数据
+			navigateBack() {
+				uni.navigateBack({
+					success: () => {
+						uni.$emit('search', this.selectedItemId);
+					}
+				});
+			},
+			// 获取请求条件
+			createSubmitCondition() {
+				return {
+					FormId: uni.getStorageSync('formId'),
+					selectedFID: this.selected.join(',')
+				};
+			},
+			// 发起请求并获取数据
+			fetchBillDetails(billDetailListParam) {
+				return getBillDetailList(JSON.stringify(billDetailListParam));
+			},
+			goBack() {
+				uni.navigateBack();
+			},
+			// 函数来创建条件
+			createSearchCondition(range, billNo) {
+				return {
+					"FormId": uni.getStorageSync('formId'),
+					"FBillType": uni.getStorageSync('fbillType'),
+					"FStockOrgId": uni.getStorageSync('FStockOrgId'),
+					"billNo": billNo,
+					"range": range
+				};
+			},
+			search() {
+				modal.loading('获取数据中,请耐心等待...')
+				let data = {
+					usertoken: "99302b4923aa42298c5922b7b68bcff9",
+					stockNum: this.stockNum,
+					stockLocNum: this.stockLocNum
+				}
+				Querylocation(data).then(res => {
+					console.log(res);
+					this.handleResponse(res)
+				})
+				// console.log(this.range)
+				// const condition = this.createSearchCondition(this.range, this.BillNo);
+				// const searchParam = getSearchParam(condition)
+				// modal.loading('获取数据中,请耐心等待...')
+				// getBillList(JSON.stringify(searchParam)).then(
+				// 	res => this.handleResponse(res)
+				// )
+			},
+			handleResponse(res) {
+				// 关闭加载提示
+				modal.closeLoading();
+				// 检查响应是否为空
+				if (res.length === 0) {
+					modal.msg("请确认输入条件有效!");
+					playVoice(audioUrls.failVoiceUrl);
+					return;
+				}
+				// 处理数据去重并更新状态
+				this.updateStockList(res);
+			},
+			updateStockList(data) {
+				// 使用 Set 和 JSON.stringify 进行去重
+				// let uniqueArray = Array.from(new Set(data.map(item => JSON.stringify(item)))).map(item =>
+				// 	JSON.parse(item));
+				// console.log(uniqueArray);
+				console.log(data)
+				this.stockList = data.results;
+				console.log(this.stockList)
+			},
+			handleCheckboxClick(itemId) {
+				console.log(itemId)
+				// 取消之前选中的项
+				if (this.selectedItemId === itemId) {
+					this.selectedItemId = null;
+					this.stockList.forEach(item => {
+						item.checked = false;
+					});
+					console.log(this.stockList)
+				} else {
+					// 更新选中项
+					this.selectedItemId = itemId;
+					this.stockList.forEach(item => {
+						item.checked = (item.FStockLocNum === itemId);
+					});
+					console.log(this.stockList)
+				}
+				console.log(this.selectedItemId)
+				this.$forceUpdate()
+			},
+		}
+	};
+</script>
+
+<style>
+	.table-container {
+		width: 100%;
+		height: 100%;
+		display: flex;
+		flex-direction: column;
+	}
+
+	.container {
+		display: flex;
+		flex-direction: column;
+	}
+
+	.search-container {
+		display: flex;
+		/* justify-content: flex-start; */
+		flex-direction: row;
+		align-items: center;
+		padding: 5px;
+		/* border-bottom: 1px solid #ccc; */
+		flex-wrap: wrap;
+	}
+
+	.search-button {
+		/* padding: 8px 16px; */
+		border: none;
+		border-radius: 4px;
+		background-color: #007bff;
+		color: #fff;
+		cursor: pointer;
+	}
+
+	.search-button:hover {
+		background-color: #0056b3;
+	}
+
+	.table-scroll {
+		/* position: absolute; */
+		flex: 1;
+		overflow-x: auto;
+		overflow-y: hidden;
+	}
+
+	.table-header {
+		position: sticky;
+		top: 0;
+		background-color: #f0f0f0;
+		font-weight: bold;
+		border-bottom: 1px solid #ccc;
+		display: flex;
+		z-index: 1;
+		/* 确保表头在内容之上 */
+	}
+
+	.table-cell1 {
+		width: 100%;
+		padding: 10px;
+		text-align: center;
+		border-right: 1px solid #ccc;
+	}
+
+	.table-cell1-1 {
+		min-width: 150px;
+		padding: 10px;
+		text-align: left;
+		border-right: 1px solid #ccc;
+	}
+
+	.table-cell {
+		min-width: 100px;
+		padding: 10px;
+		text-align: center;
+		border-right: 1px solid #ccc;
+	}
+
+	.header-cell {
+		border-right: none;
+		/* 取消最后一列的右边框 */
+	}
+
+	.table-body {
+		flex: 1;
+		/* width: fit-content; */
+		/* 使内容宽度适应内容的宽度 */
+	}
+
+	.table-row {
+		width: 100%;
+		/* display: flex; */
+		border-bottom: 1px solid #ccc;
+	}
+
+	.checkbox {
+		width: 100%;
+		height: 100%;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.bottom-bar {
+		display: flex;
+		/* justify-content: center; */
+		justify-content: flex-end;
+		/* 将按钮靠右对齐 */
+		align-items: center;
+		/* padding: 10px; */
+		padding: 3px;
+		background-color: #f0f0f0;
+	}
+
+	.button {
+		margin: 0 10px;
+		/* padding: 10px 20px; */
+	}
+
+	.checkbox-container {
+		width: 100%;
+		padding: 10px;
+		/* text-align: center; */
+		border-right: 1px solid #ccc;
+		display: flex;
+		align-items: center;
+		/* 	margin-left: 10px;
+		margin-right: 10px; */
+		/* 可根据需要调整间距 */
+	}
+</style>

+ 298 - 0
pages/storage/show.vue

@@ -0,0 +1,298 @@
+<template>
+	<view>
+		<uni-section title="">
+			<view class="example">
+				<uni-forms ref="form" :modelValue="item" labelWidth="80px" :rules="rules">
+					<uni-forms-item label="装箱单号" name="FBillNo">
+						<uni-easyinput v-model="item['FENCHASENUM.LT']" disabled>
+						</uni-easyinput>
+					</uni-forms-item>
+					<uni-forms-item label="新装箱单号" name="Mdd">
+						<uni-easyinput v-model="item['NewFENCHASENUM.LT']" @confirm="search">
+						</uni-easyinput>
+					</uni-forms-item>
+					<uni-forms-item label="物料编码" name="Ch">
+						<uni-easyinput v-model="item['FMaterialId.fnumber']" disabled />
+					</uni-forms-item>
+					<uni-forms-item label="实际作业数量" name="FActualQty"
+						v-if="formId === 'LT_PRD_PMCWorkBench'||formId === 'SP_PickMtrl'">
+						<uni-easyinput type="number" v-model="item.FActualQty" placeholder="实际作业数量" />
+					</uni-forms-item>
+					<uni-forms-item label="实际作业数量" name="FQty" v-if="formId === 'STK_MisDelivery'">
+						<uni-easyinput type="number" v-model="item.FQty" placeholder="实际作业数量" />
+					</uni-forms-item>
+					<uni-forms-item label="实际作业数量" name="FRMREALQTY" v-if="formId === 'PUR_MRB'">
+						<uni-easyinput type="number" v-model="item.FRMREALQTY" placeholder="实际作业数量" />
+					</uni-forms-item>
+					<uni-forms-item label="剩余数量" v-if="formId !== 'PUR_MRB'">
+						<uni-easyinput disabled v-model="remainingQuantity" placeholder="" />
+					</uni-forms-item>
+					<uni-forms-item label="即时库存数量" name="FInventoryQty" v-if="formId !== 'PUR_MRB'">
+						<uni-easyinput disabled v-model="item.FInventoryQty" placeholder="即时库存数量" />
+					</uni-forms-item>
+					<uni-forms-item label="生产车间" name="FWorkShopId.fname" v-if="formId !== 'PUR_MRB'">
+						<uni-easyinput disabled v-model="item['FWorkShopId.fname']" />
+					</uni-forms-item>
+					<uni-forms-item label="仓位" name="FStockLocId.FF102029.fname" v-if="formId === 'PUR_MRB'">
+						<uni-easyinput disabled v-model="item['FStockLocId.FF102029.fname']" />
+					</uni-forms-item>
+					<uni-forms-item label="采购员" name="FPURCHASERID.fname" v-if="formId === 'PUR_MRB'">
+						<uni-easyinput disabled v-model="item['FPURCHASERID.fname']" />
+					</uni-forms-item>
+				</uni-forms>
+				<button type="primary" @click="submit()">确认</button>
+			</view>
+		</uni-section>
+	</view>
+</template>
+
+<script>
+	import {
+		getInfoByBarcode,
+		getStockInfo
+	} from '../../api/production_replenishment';
+	import {
+		playVoice,
+		audioUrls
+	} from '@/utils/audio.js'
+	import modal from '../../uni_modules/uview-ui/libs/config/props/modal';
+	export default {
+		onLoad(option) {
+			this.formId = uni.getStorageSync("formId")
+			const item = JSON.parse(decodeURIComponent(option.item))
+			const index = JSON.parse(decodeURIComponent(option.index))
+			console.log(item)
+			console.log(index)
+			this.item = item
+			this.index = index
+		},
+		data() {
+			return {
+				formId: '',
+				item: {},
+				index: '',
+				isReplace: false,
+				rules: {
+					FActualQty: {
+						rules: [{
+								required: true,
+								errorMessage: '请输入实发数量',
+							},
+
+						]
+					},
+					FQty: {
+						rules: [{
+								required: true,
+								errorMessage: '请输入实发数量',
+							},
+
+						]
+					},
+					FRMREALQTY: {
+						rules: [{
+								required: true,
+								errorMessage: '请输入实际作业数量',
+							},
+
+						]
+					},
+				},
+			};
+		},
+		computed: {
+			remainingQuantity() {
+				console.log(this.item["FInventoryQty"] - this.item["FActualQty"])
+				if (this.formId === 'LT_PRD_PMCWorkBench' || this.formId === 'SP_PickMtrl') {
+					return Math.round((this.item["FInventoryQty"] - this.item["FActualQty"]) * 100) / 100;
+				}
+				if (this.formId === 'STK_MisDelivery') {
+					return Math.round((this.item["FInventoryQty"] - this.item["FQty"]) * 100) / 100;
+				}
+			}
+		},
+		methods: {
+			async search() {
+
+				if (this.item['NewFENCHASENUM.LT'] == "") {
+					uni.showToast({
+						title: '请扫描条码',
+						icon: 'none',
+						duration: 3000
+					})
+					return
+				}
+				const data = {
+					"parameters": [{
+						"FormId": "LT_BD_MtlLotCodeMap",
+						"FieldKeys": "FEntity_FSEQ,FMaterialId,FMaterialId.fnumber,FLot.FNumber,FLot,",
+						"FilterString": [{
+							"Left": "",
+							"FieldName": "FNumber",
+							"Compare": "67",
+							// "Value": "T23091000852",
+							"Value": this.item['NewFENCHASENUM.LT'],
+							"Right": "",
+							"Logic": 0
+						}],
+						"OrderString": "FEntity_FSEQ DESC",
+					}]
+				}
+				this.$modal.loading('替换中,请耐心等待...');
+				const firstResponse = await getInfoByBarcode(JSON.stringify(data))
+				console.log(firstResponse)
+				if (firstResponse.length === 0) {
+					console.log("dafafadf")
+					uni.showToast({
+						title: '请确认条码有效!',
+						duration: 2000,
+						icon: 'none'
+					});
+					return; // 停止保存操作
+				}
+				if (firstResponse[0]["FMaterialId.fnumber"] != this.item["FMaterialId.fnumber"]) {
+					console.log("dafafadf")
+					uni.showToast({
+						title: '编码与原物料编码不一致,请重新替换装箱单号',
+						duration: 3000,
+						icon: 'none'
+					});
+					playVoice(audioUrls.failVoiceUrl)
+					return; // 停止保存操作
+				}
+				const data2 = {
+					"parameters": [{
+						"FormId": "STK_Inventory",
+						"FieldKeys": "FAuxPropId.FF101501,FAuxPropId.FF101501.FDATAVALUE,FStockLocId.FF102029.fname,FBaseQty",
+						"FilterString": [{
+								"Left": "",
+								"FieldName": "FMaterialId.FNumber",
+								"Compare": "67",
+								// "Value": "CAW04044-1611088-1",
+								"Value": firstResponse[0]["FMaterialId.fnumber"],
+								"Right": "",
+								"Logic": 0
+							},
+							{
+								"Left": "",
+								"FieldName": "FLot.FNumber",
+								"Compare": "67",
+								// "Value": "智能工厂-智能1220/20230821&T23091000852&无&23122000002",
+								"Value": firstResponse[0]["FLot.FNumber"],
+								"Right": "",
+								"Logic": 0
+							},
+							{
+								"Left": "",
+								"FieldName": "FBaseQty",
+								"Compare": "21",
+								"Value": "0",
+								"Right": "",
+								"Logic": 0
+							}
+						],
+						"OrderString": "",
+					}]
+				}
+				const secondResponse = await getStockInfo(JSON.stringify(data2))
+				if (secondResponse.length > 1) {
+					this.handleError("即时库存存在多个仓位,不允许选择!")
+					this.$modal.closeLoading()
+					this.item['NewFENCHASENUM.LT'] = ""
+					return
+				}
+				console.log("原item", this.item)
+				this.item['FInventoryQty'] = secondResponse[0]["FBaseQty"]
+				this.item['Flot.FNumber'] = firstResponse[0]["FLot.FNumber"]
+				this.item['FAuxPropId.FF101501.FDATAVALUE'] = secondResponse[0]["FAuxPropId.FF101501.FDATAVALUE"]
+				this.item['FStockLocId.FF102029.fname'] = secondResponse[0]["FStockLocId.FF102029.fname"]
+				this.item['smzt'] = 1
+				console.log("替换后item", this.item)
+				console.log(secondResponse)
+				this.isReplace = true
+				this.$modal.closeLoading()
+				uni.showToast({
+					title: '替换成功',
+					icon: 'none',
+					duration: 3000
+				})
+				playVoice(audioUrls.successVoiceUrl)
+
+			},
+			handleError(error) {
+				playVoice(audioUrls.failVoiceUrl)
+				console.error('操作失败:', error);
+				modal.confirm(error).then(res => {
+					if (res) {} else {}
+				})
+			},
+			submit() {
+				this.$refs.form.validate().then(res => {
+					if (this.item["FActualQty"] < 0) {
+						uni.showToast({
+							title: '实发数量不能小于0',
+							icon: 'none',
+							duration: 3000
+						})
+						return
+					}
+					console.log(typeof this.item["NewFENCHASENUM.LT"])
+					if ((typeof this.item["NewFENCHASENUM.LT"] != "undefined" && this.item["NewFENCHASENUM.LT"] !=
+							"") && this.isReplace == false) {
+						uni.showToast({
+							title: '装箱单号未替换',
+							icon: 'none',
+							duration: 3000
+						})
+						return
+					}
+					console.log(this.item)
+					this.item["index"] = this.index
+					let self = this
+					uni.navigateBack({
+						success: function() {
+							// 传递数据给上一页
+							uni.$emit('item', self.item);
+						}
+					});
+				}).catch(err => {
+					console.log(err);
+				})
+			},
+		}
+	};
+</script>
+<style>
+	/deep/ .is-disabled {
+		background-color: #ffffff !important;
+		color: #0d0d0d !important;
+	}
+
+	.example {
+		padding-left: 10px;
+		padding-right: 10px;
+		background-color: #fff;
+	}
+
+	.segmented-control {
+		margin-bottom: 15px;
+	}
+
+	.button-group {
+		margin-top: 15px;
+		display: flex;
+		justify-content: space-around;
+	}
+
+	.form-item {
+		display: flex;
+		align-items: center;
+	}
+
+	.button {
+		display: flex;
+		align-items: center;
+		height: 35px;
+		margin-left: 10px;
+	}
+</style>

+ 506 - 0
pages/storage/stage.vue

@@ -0,0 +1,506 @@
+<template>
+	<view class="table-container">
+		<!-- 查询框 -->
+		<view class="container">
+			<view class="search-container">
+				<uni-easyinput type="text" v-model="stageNum" disabled class="custom-input" style="margin-right: 5px;">
+				</uni-easyinput>
+				<button class="search-button" @click="handleSave">保存</button>
+			</view>
+		</view>
+		<!-- 表格容器 -->
+		<scroll-view class="table-scroll" scroll-x="false" scroll-y>
+			<!-- 表头 -->
+			<view class="table-header" ref="tableHeader">
+				<view class="table-cell">存档编号</view>
+				<view class="table-cell header-cell">创建日期</view>
+			</view>
+			<!-- 表格内容 -->
+			<view class="table-body">
+				<checkbox-group @change="checkboxChange">
+					<view class="table-row" v-for="(item, index) in list" :key="item.id">
+						<view class="table-cell1">
+							<view class="checkbox-container">
+								<checkbox :value="item.stageNum" :checked="item.checked" />
+							</view>
+							<view>{{ item.stageNum}}</view>
+						</view>
+						<view class="table-cell header-cell">{{ item.createTime }}</view>
+					</view>
+				</checkbox-group>
+			</view>
+		</scroll-view>
+
+		<view class="bottom-bar">
+			<button class="mini-btn button" type="primary" size="default" @click="loadhandler">加载</button>
+			<button class="mini-btn button" type="warn" size="default" @click="deletehandler">删除</button>
+		</view>
+
+	</view>
+</template>
+<script>
+	import {
+		playVoice,
+		audioUrls
+	} from '@/utils/audio.js';
+	import modal from '../../plugins/modal';
+	import {
+		showConfirm,
+		toast
+	} from '../../utils/common';
+	import {
+		addSql,
+		deleteSql,
+		executeSql,
+		isTable,
+		openSqlite,
+		selectList,
+		updateSql
+	} from '../../utils/database';
+	export default {
+		data() {
+			return {
+				indexList: [],
+				billSummary: [], // 这里存放处理后的每个 FBillNo 的统计结果
+				selectedItemId: null,
+				stageNum: '',
+				tableName: "common_bill",
+				list: [],
+				selectedStage: [], // 保存每个数据项是否被选中的状态
+				todayStages: []
+			};
+		},
+		async onLoad(option) {
+			await this.openSqlite()
+			await this.createTable()
+			await this.getBills()
+			this.indexList = JSON.parse(decodeURIComponent(option.Info))
+			console.log(this.indexList)
+			if (this.indexList.length != 0) {
+				this.stageNum = await this.generateStageNumber()
+			}
+
+
+		},
+
+		async onShow(options) {
+			// 默认打开数据库,并创建表
+			// await this.openSqlite()
+			// await this.createTable()
+			// await this.createDetailTable()
+			// console.log(uni.getDeviceInfo())
+		},
+		computed: {
+
+		},
+		mounted() { //隐藏返回按钮
+			// let webView = this.$scope.$getAppWebview();
+			// webView.setStyle({
+			// 	titleNView: {
+			// 		autoBackButton: false
+			// 	}
+			// })
+		},
+		methods: {
+			async generateStageNumber() {
+				if (this.hasMultipleDistinctBillNos(this.indexList)) { //有多个单据编号
+					this.todayStages = await this.getTodayStages()
+					console.log(this.generateDateWithNumber(this.todayStages.length + 1))
+					return this.generateDateWithNumber(this.todayStages.length + 1)
+				} else { //单个单据编号
+					return this.indexList[0]["FBillNo"]
+				}
+
+			},
+			generateDateWithNumber(numberPart) {
+				const paddedNumberPart = String(numberPart).padStart(4, '0');
+				const today = new Date();
+				const year = today.getFullYear();
+				const month = String(today.getMonth() + 1).padStart(2, '0');
+				const day = String(today.getDate()).padStart(2, '0');
+				const formattedDate = `${year}${month}${day}`;
+				return `${formattedDate}${paddedNumberPart}`;
+			},
+			getTodayDate() {
+				// 获取当前日期
+				const today = new Date();
+
+				// 格式化为 YYYY-MM-DD
+				const year = today.getFullYear();
+				const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以要加1
+				const day = String(today.getDate()).padStart(2, '0');
+
+				const formattedDate = `${year}-${month}-${day}`;
+				return formattedDate
+			},
+			checkboxChange(e) {
+				this.selectedStage = e.target.value
+				console.log(this.selectedStage)
+			},
+
+			async getBills() {
+				
+				let where = {
+					type: this.getType()
+				}
+				this.list = await this.selectList(where)
+				console.log(this.list)
+			},
+			// 封装函数
+			getType() {
+				const fbillType = uni.getStorageSync('fbillType');
+				const formId = uni.getStorageSync('formId');
+
+				if (fbillType !== null) {
+					return formId + fbillType;
+				} else {
+					return formId;
+				}
+			},
+			async getTodayStages() {
+				let where = {
+					type: this.getType(),
+					createTime: this.getTodayDate(),
+				}
+				const todayList = await this.selectList(where)
+				return todayList
+
+			},
+			async selectList(where) {
+				try {
+
+					let res = await selectList(this.tableName, where)
+					console.log("加载数据", res)
+					return res
+				} catch (e) {
+					uni.showToast({
+						title: "报错,请查看控制台",
+						icon: "none"
+					});
+					console.error("报错", e)
+				}
+			},
+			handleSaveSuccess() {
+				this.getBills() //重新获取暂存数据
+				modal.msgSuccess("存档成功")
+				this.indexList = []
+				this.stageNum = ''
+				playVoice(audioUrls.successVoiceUrl)
+			},
+			handleSaveFail(error) {
+				modal.msgError(error)
+				playVoice(audioUrls.failVoiceUrl)
+			},
+			handleDeleteSuccess() {
+				this.getBills() //重新获取暂存数据
+				modal.msgSuccess("删除成功")
+				playVoice(audioUrls.successVoiceUrl)
+			},
+			handleDeleteFail(error) {
+				modal.msgError(error)
+				playVoice(audioUrls.failVoiceUrl)
+			},
+			async editeStage() {
+				try {
+					await updateSql(this.tableName, {
+						stageNum: this.stageNum,
+						data: JSON.stringify(this.indexList),
+						createTime: this.getTodayDate()
+					}, {
+						stageNum: this.stageNum
+					})
+					this.handleSaveSuccess()
+				} catch (e) {
+					this.handleSaveFail(e)
+					console.error("修改报错", e)
+				}
+			},
+			async addStage() {
+				let type = null
+				if (uni.getStorageSync('fbillType') !== null) {
+					type = uni.getStorageSync('formId') + uni.getStorageSync('fbillType')
+				} else {
+					type = uni.getStorageSync('formId')
+				}
+				try {
+					let b = await addSql(this.tableName, {
+						stageNum: this.stageNum,
+						data: JSON.stringify(this.indexList),
+						type: type
+					})
+					this.handleSaveSuccess()
+				} catch (e) {
+					this.handleSaveFail(e)
+					console.error("添加数据,报错", e)
+				}
+			},
+			async deleteStages() {
+				const result = this.selectedStage.map(item => `"${item}"`).join(', ')
+				let condition = `stageNum in (${result})`
+				let sql = `delete from ${this.tableName} where ${condition}`
+				executeSql(sql).then(result => {
+						console.log('结果:', result);
+						this.handleDeleteSuccess()
+					})
+					.catch(error => {
+						console.error('捕获错误:', error); // 输出: 捕获错误: 失败的结果
+						this.handleDeleteFail(error)
+					})
+			},
+			async handleSave() {
+				if (this.stageNum == '' || this.stageNum == undefined) { //是否有待暂存数据
+					modal.msgError("请先提取数据")
+					playVoice(audioUrls.failVoiceUrl)
+					return
+				}
+				//存档前判断单据编号是否已暂存
+				if (this.list.some(item => item.stageNum === this.stageNum)) { //若存在,提示是否覆盖
+					showConfirm("存档编号已存在,是否覆盖").then(async (result) => {
+						if (result) {
+							console.log('用户点击了“确定”');
+							this.editeStage() //覆盖已暂存数据
+						} else {
+							console.log('用户点击了“取消”');
+							return
+						}
+					}).catch((error) => {
+						console.error('对话框显示错误:', error)
+					})
+				} else { //若不存在,保存数据
+					this.addStage()
+				}
+			},
+			hasMultipleDistinctBillNos(data) {
+				// 提取所有不同的 FBillNo 值
+				const billNoSet = new Set(data.map(item => item.FBillNo))
+
+				// 判断是否有多个不同的 FBillNo
+				const hasMultipleBillNo = billNoSet.size > 1
+
+				console.log('是否存在多个不同的 FBillNo:', hasMultipleBillNo)
+				return hasMultipleBillNo
+			},
+			async openSqlite() {
+				// 打开数据库
+				try {
+					let b = await openSqlite()
+					// uni.showToast({
+					// 	title: "打开数据库成功",
+					// 	icon: "none"
+					// })
+				} catch (e) {
+					console.error("打开数据库,报错", e)
+				}
+			},
+			// 创建表
+			async createTable() {
+				let sql = this.createTableSqlBill()
+				try {
+					let exist = await isTable(this.tableName)
+					console.log("表是否存在", exist)
+					if (!exist) {
+						let res = await executeSql(sql)
+						uni.showToast({
+							title: "新增数据表成功",
+							icon: "none"
+						})
+						console.log("新增表public", res)
+					} else {
+						// uni.showToast({
+						// 	title: "数据表已存在",
+						// 	icon: "none"
+						// })
+					}
+				} catch (e) {
+					uni.showToast({
+						title: "新增数据表失败",
+						icon: "none"
+					})
+					console.error("新增表报错public", e)
+				}
+			},
+			createTableSqlBill() {
+				return "CREATE TABLE IF NOT EXISTS `common_bill` (" +
+					"`id` INTEGER PRIMARY KEY AUTOINCREMENT," +
+					"`stageNum` varchar(20) NOT NULL ," +
+					"`data` text," +
+					"`createTime` date DEFAULT CURRENT_DATE," +
+					"`type` varchar(20) NOT NULL" +
+					"); "
+			},
+			// onScroll(e) {
+			// 	const scrollLeft = e.detail.scrollLeft;
+			// 	this.headerLeft = -scrollLeft; // 更新表头左侧位置,实现横向滚动时的对齐效果
+			// },
+			loadhandler() {
+				if (this.selectedStage.length == 0) {
+					modal.msgError("请选择存档")
+					playVoice(audioUrls.failVoiceUrl)
+					return
+				}
+				console.log(this.list)
+				// 筛选数据
+				// const loadData = this.list.filter(item => this.selectedStage.includes(item.stageNum)).map(item => item
+				// 	.data)
+				const loadData = this.list.filter(item => this.selectedStage.includes(item.stageNum))
+				console.log(loadData)
+
+				uni.navigateBack({
+					success: function() {
+						// 传递数据给上一页
+						uni.$emit('stage', loadData);
+					}
+				})
+			},
+			deletehandler() {
+				if (this.selectedStage.length == 0) {
+					modal.msgError("请选择存档")
+					playVoice(audioUrls.failVoiceUrl)
+					return
+				}
+				modal.confirm("确认删除选定的存档吗?").then(async (result) => {
+					if (result) {
+						console.log('用户点击了“确定”');
+						//修改数据库数据
+						this.deleteStages()
+					} else {
+						console.log('用户点击了“取消”');
+						return
+					}
+				}).catch((error) => {
+					console.error('对话框显示错误:', error)
+				})
+			}
+
+		}
+	};
+</script>
+
+<style>
+	.table-container {
+		width: 100%;
+		height: 100%;
+		display: flex;
+		flex-direction: column;
+	}
+
+	.container {
+		display: flex;
+		flex-direction: column;
+	}
+
+	.search-container {
+		display: flex;
+		/* justify-content: flex-start; */
+		align-items: center;
+		/* 垂直居中 */
+		flex-direction: row;
+		/* align-items: stretch; */
+		/* padding: 2px; */
+		border-bottom: 1px solid #ccc;
+		padding: 5px;
+		/* flex-wrap: wrap; */
+	}
+
+
+	.search-button {
+		/* padding: 8px 16px; */
+		border: none;
+		border-radius: 4px;
+		background-color: #007bff;
+		color: #fff;
+		cursor: pointer;
+	}
+
+	.search-button:hover {
+		background-color: #0056b3;
+	}
+
+	.table-scroll {
+		/* position: absolute; */
+		flex: 1;
+		overflow-x: auto;
+		overflow-y: hidden;
+	}
+
+	.table-header {
+		position: sticky;
+		top: 0;
+		background-color: #f0f0f0;
+		font-weight: bold;
+		border-bottom: 1px solid #ccc;
+		display: flex;
+		z-index: 1;
+		/* 确保表头在内容之上 */
+	}
+
+	.table-cell1 {
+		min-width: 50%;
+		display: flex;
+		justify-content: left;
+		align-items: center;
+		border-right: 1px solid #ccc;
+	}
+
+
+	.table-cell {
+		min-width: 50%;
+		padding: 10px;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		border-right: 1px solid #ccc;
+	}
+
+	.header-cell {
+		border-right: none;
+		/* 取消最后一列的右边框 */
+	}
+
+	.table-body {
+		flex: 1;
+		/* width: fit-content; */
+		/* 使内容宽度适应内容的宽度 */
+	}
+
+	.table-row {
+		display: flex;
+		border-bottom: 1px solid #ccc;
+	}
+
+	.checkbox {
+		width: 100%;
+		height: 100%;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.bottom-bar {
+		display: flex;
+		/* justify-content: center; */
+		justify-content: flex-end;
+		/* 将按钮靠右对齐 */
+		align-items: center;
+		padding: 3px;
+		background-color: #f0f0f0;
+	}
+
+	.button {
+		margin: 0 10px;
+		/* padding: 10px 20px; */
+	}
+
+
+	::v-deep .is-disabled {
+		color: black !important;
+	}
+
+	.checkbox-container {
+		display: flex;
+		align-items: center;
+		margin-left: 10px;
+		margin-right: 10px;
+		/* 可根据需要调整间距 */
+	}
+</style>

+ 391 - 0
pages/storage/summary.vue

@@ -0,0 +1,391 @@
+<template>
+	<view class="table-container">
+		<!-- 查询框 -->
+		<view class="container">
+			<view class="search-container">
+			</view>
+		</view>
+		<!-- 表格容器 -->
+		<scroll-view class="table-scroll" scroll-x scroll-y @scroll="onScroll">
+			<!-- 表头 -->
+			<view class="table-header" ref="tableHeader">
+				<view class="table-cell1-1">单据编号</view>
+				<view class="table-cell">单据总条数</view>
+				<view class="table-cell"
+					style="background-color: #f0f0f0;font-weight: bold;border-bottom: 1px solid #ccc;">已扫描条数</view>
+				<view class="table-cell"
+					style="background-color: #f0f0f0;font-weight: bold;border-bottom: 1px solid #ccc;">未扫描条数</view>
+			</view>
+
+			<!-- 表格内容 -->
+			<view class="table-body">
+				<!-- <checkbox-group @change="checkboxChange"> -->
+				<view class="table-row" v-for="(item, index) in billSummary" :key="item.FID">
+					<view class="table-cell1">
+						<!-- <checkbox :value="item.FID" :checked="item.checked" />{{ item.FBillNo}} -->
+						<view class="checkbox-container">
+							<checkbox :value="item.FID" :checked="item.checked" @tap="handleCheckboxClick(item.FID)" />
+						</view>
+						<view>{{ item.FBillNo}}</view>
+					</view>
+					<view class="table-cell">{{ item.totalEntries }}</view>
+					<view class="table-cell">{{ item.smzt1Count }}</view>
+					<view class="table-cell">{{ item.totalEntries- item.smzt1Count }}</view>
+				</view>
+				<!-- </checkbox-group> -->
+			</view>
+		</scroll-view>
+		<!-- 底部按钮 -->
+		<view class="bottom-bar">
+			<button class="mini-btn button" type="primary" size="default" @click="handleSubmit">提交</button>
+			<button class="mini-btn button" type="primary" size="default" @click="goBack">返回</button>
+		</view>
+
+	</view>
+</template>
+<script>
+	import {
+		playVoice,
+		audioUrls
+	} from '@/utils/audio2.js'
+	import {
+		audit,
+		getBillList,
+		save,
+		submit
+	} from '../../api/production_replenishment';
+	import modal from '../../plugins/modal';
+	import {
+		getAuditParam,
+		getSaveParam,
+		getSubmitParam
+	} from '../../utils/params';
+	import submitHelper from '../../utils/storageSubmitHelper.js';
+	import {
+		executeSql
+	} from '../../utils/database';
+	export default {
+		data() {
+			return {
+				indexList: [],
+				billSummary: [], // 这里存放处理后的每个 FBillNo 的统计结果
+				selectedItemId: null,
+				stageLists: [],
+				tableName: "common_bill",
+			};
+		},
+		onLoad(option) {
+			this.indexList = JSON.parse(decodeURIComponent(option.Info))
+			this.stageLists = JSON.parse(decodeURIComponent(option.stageInfo))
+			console.log(this.indexList)
+		},
+		computed: {
+
+		},
+		mounted() {
+			this.calculateSummary()
+			console.log(this.billSummary)
+		},
+		onBackPress(e) {
+			console.log("监听返回按钮事件", e);
+			if (e.from == "backbutton") {
+				this.goBack()
+				return true
+			}
+		},
+
+		methods: {
+			calculateSummary() {
+				const summary = {};
+				// 遍历数据,统计每个 FBillNo 的总条数和 smzt=1 的数量
+				this.indexList.forEach(item => {
+					const {
+						FID,
+						FBillNo,
+						smzt
+					} = item;
+
+					if (!summary[FBillNo]) {
+						summary[FBillNo] = {
+							FID: FID,
+							FBillNo: FBillNo,
+							totalEntries: 0,
+							smzt1Count: 0
+						};
+					}
+
+					summary[FBillNo].totalEntries++;
+
+					if (smzt === 1) {
+						summary[FBillNo].smzt1Count++;
+					}
+				});
+
+				// 将 summary 对象转为数组,便于在模板中遍历展示
+				this.billSummary = Object.values(summary);
+			},
+			goBack() {
+				let vm = this
+				uni.navigateBack({
+					success: function() {
+						// 传递数据给上一页
+						uni.$emit('summary', vm.indexList);
+					}
+				});
+			},
+			onScroll(e) {
+				const scrollLeft = e.detail.scrollLeft;
+				this.headerLeft = -scrollLeft; // 更新表头左侧位置,实现横向滚动时的对齐效果
+			},
+			async handleSubmit(FID) {
+				if (this.selectedItemId == null) {
+					uni.showToast({
+						title: '请选择单据',
+						duration: 3000,
+						icon: "error"
+					})
+					playVoice(audioUrls.failVoiceUrl)
+					return
+				}
+				const selectedItem = this.billSummary.find(item => item.FID === this.selectedItemId);
+				const areEqual = selectedItem ? selectedItem.totalEntries === selectedItem.smzt1Count : false;
+				if (!areEqual) {
+					uni.showToast({
+						title: '单据未全扫描',
+						duration: 3000,
+						icon: "error"
+					})
+					playVoice(audioUrls.failVoiceUrl)
+					return
+				}
+				try {
+					// await submitHelper.submit(FormId,FID, this.indexList);
+					const FormId = uni.getStorageSync('formId')
+					await submitHelper.submit(FormId, this.selectedItemId, this.indexList);
+					this.indexList = this.indexList.filter(item => item.FID !== this.selectedItemId);
+					this.billSummary = this.billSummary.filter(item => item.FID !==
+						this.selectedItemId)
+					console.log(this.indexList)
+					if (this.stageLists.length != 0) {
+						// 处理每个对象
+						this.stageLists.forEach(item => {
+							// 过滤掉 FID 匹配的对象
+							item.data = item.data.filter(obj => obj.FID !== this.selectedItemId);
+
+							// 检查 data 数组是否为空
+							if (item.data.length === 0) {
+								console.log("data 数组为空"); //删除暂存
+								this.deleteStages(item.id)
+							} else {
+								console.log("data 数组不为空");
+							}
+						})
+						console.log(this.stageLists)
+					}
+				} catch (error) {
+					this.handleError(error)
+				}
+			},
+			async deleteStages(id) {
+				let condition = `id = (${id})`
+				let sql = `delete from ${this.tableName} where ${condition}`
+				executeSql(sql).then(result => {
+						console.log('结果:', result);
+						// this.handleDeleteSuccess()
+					})
+					.catch(error => {
+						console.error('捕获错误:', error); // 输出: 捕获错误: 失败的结果
+						// this.handleDeleteFail(error)
+					})
+			},
+			handleError(error) {
+				playVoice(audioUrls.failVoiceUrl)
+				console.error('操作失败:', error);
+				modal.confirm(error.message || '操作失败').then(res => {
+					if (res) {
+
+					} else {
+						// 用户点击取消,不执行任何操作
+					}
+				})
+				// uni.showToast({
+				// 	title: error.message || '操作失败',
+				// 	duration: 3000,
+				// 	icon: "none"
+				// });
+				// playVoice(audioUrls.failVoiceUrl)
+				// console.error('操作失败:', error);
+			},
+			handleCheckboxClick(itemId) {
+				console.log(itemId)
+				// 取消之前选中的项
+				if (this.selectedItemId === itemId) {
+					this.selectedItemId = null;
+					this.billSummary.forEach(item => {
+						item.checked = false;
+					});
+					console.log(this.billSummary)
+				} else {
+					// 更新选中项
+					this.selectedItemId = itemId;
+					this.billSummary.forEach(item => {
+						item.checked = (item.FID === itemId);
+					});
+					console.log(this.billSummary)
+				}
+				console.log(this.selectedItemId)
+				this.$forceUpdate()
+			},
+
+		}
+	};
+</script>
+
+<style>
+	.table-container {
+		width: 100%;
+		height: 100%;
+		display: flex;
+		flex-direction: column;
+	}
+
+	.container {
+		display: flex;
+		flex-direction: column;
+	}
+
+	.search-container {
+		display: flex;
+		justify-content: flex-start;
+		flex-direction: row;
+		align-items: stretch;
+		/* padding: 2px; */
+		border-bottom: 1px solid #ccc;
+		flex-wrap: wrap;
+	}
+
+	.search-input {
+		/* padding: 8px; */
+		margin-right: 10px;
+		border: 1px solid #ccc;
+		border-radius: 4px;
+		width: 200px;
+	}
+
+	.search-button {
+		/* padding: 8px 16px; */
+		border: none;
+		border-radius: 4px;
+		background-color: #007bff;
+		color: #fff;
+		cursor: pointer;
+	}
+
+	.search-button:hover {
+		background-color: #0056b3;
+	}
+
+	.table-scroll {
+		/* position: absolute; */
+		flex: 1;
+		overflow-x: auto;
+		overflow-y: hidden;
+	}
+
+	.table-header {
+		position: sticky;
+		top: 0;
+		background-color: #f0f0f0;
+		font-weight: bold;
+		border-bottom: 1px solid #ccc;
+		display: flex;
+		z-index: 1;
+		/* 确保表头在内容之上 */
+	}
+
+	.table-cell1 {
+		min-width: 160px;
+		display: flex;
+		justify-content: left;
+		align-items: center;
+		border-right: 1px solid #ccc;
+		/* border: 1px solid red; */
+	}
+
+	.table-cell1-1 {
+		min-width: 160px;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		border-right: 1px solid #ccc;
+	}
+
+	.table-cell {
+		min-width: 100px;
+		padding: 10px;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		border-right: 1px solid #ccc;
+	}
+
+	.header-cell {
+		border-right: none;
+		/* 取消最后一列的右边框 */
+	}
+
+	.table-body {
+		flex: 1;
+		width: fit-content;
+		/* 使内容宽度适应内容的宽度 */
+	}
+
+	.table-row {
+		display: flex;
+		border-bottom: 1px solid #ccc;
+	}
+
+	.checkbox {
+		width: 100%;
+		height: 100%;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.bottom-bar {
+		display: flex;
+		/* justify-content: center; */
+		justify-content: flex-end;
+		/* 将按钮靠右对齐 */
+		align-items: center;
+		/* padding: 10px; */
+		padding: 3px;
+		background-color: #f0f0f0;
+	}
+
+	.button {
+		margin: 0 10px;
+		/* padding: 10px 20px; */
+	}
+
+	.cancel-btn {
+		background-color: #ff0000;
+		/* 取消按钮样式 */
+		color: #fff;
+	}
+
+	.confirm-btn {
+		background-color: #00ff00;
+		/* 确认按钮样式 */
+		color: #fff;
+	}
+
+	.checkbox-container {
+		display: flex;
+		align-items: center;
+		margin-left: 10px;
+		margin-right: 10px;
+		/* 可根据需要调整间距 */
+	}
+</style>

+ 4 - 0
utils/newparams.js

@@ -6,6 +6,7 @@ const FieldKeysMap = {
 	"PUR_MRB": "FID,FPURMRBENTRY_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FInventoryQty,FENCHASENUM_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FDate,FSTOCKERID.fname,FStockId.FNumber,FRMREALQTY,FFabricOrderNo,FPURCHASERID.fname",
 	"STK_OEMInStockRETURN": "FID,FBillEntry_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBoxNo,FInventoryQty,FENCHASENUM_LT,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FDate,FSTOCKERID.fname,FStockId.FNumber,FQty,FFabricOrderNo,FNoteEntry",
 	"SAL_OUTSTOCK": "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBoxNumber,FInventoryQty_LT,FENCHASENUM_LT,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FDate,FSTOCKERID.fname,FStockId.FNumber,FRealQty,FFABRICORDERNO_LT,FEntrynote"
+
 };
 
 export function getSearchParam(condition) {
@@ -148,12 +149,14 @@ export function getSearchParam(condition) {
 		}]
 	}
 }
+
 export function getBillDetailListParam(condition) {
 	console.log(condition)
 	let FieldKeys = FieldKeysMap[condition.FormId]
 	if(condition.FormId == "SP_PickMtrl" && condition.FBillType =='B'){
 		FieldKeys = "FID,FSumEntity_FEntryID,FBillNo,FSTOCKERID.fname,FSumStockLocId.FF102029.fname,FSumMaterialId.fnumber,FSumBoxNo_LT,FSumActualQty,FSumEnchaseNum_LT,FSumAuxPropId.FF101501.FNumber,FSumLot.FNumber,FWorkCenterId.fname,FDate,FPickerId.fname,FWorkShopId.fname,FPickingPeople_LT.FName"
 	}
+
 	return {
 		"parameters": [{
 			"FormId": condition.FormId,
@@ -362,6 +365,7 @@ export function get2SaveParam(FormId, data, indexList) {
 			}
 		]
 	};
+
 }
 export function getSubmitParam(FormId, data) {
 	const params = {

+ 83 - 0
utils/requestnew.js

@@ -0,0 +1,83 @@
+import store from '@/store'
+import config, {
+	baseUrl,
+	foreignUrl
+} from '@/config'
+import {
+	getToken,
+	getServerUrl
+} from '@/utils/auth'
+import errorCode from '@/utils/errorCode'
+import {
+	toast,
+	showConfirm,
+	tansParams
+} from '@/utils/common'
+
+let timeout = 200000
+
+console.log(baseUrl)
+const request1 = config => {
+	// 是否需要设置 token
+	const isToken = (config.headers || {}).isToken === false
+	config.header = config.header || {}
+	// if (getToken() && !isToken) {
+	// 	// config.header['Authorization'] = 'Bearer ' + getToken()
+	// 	config.header['UserKey'] = getToken()
+	// 	config.header['ServerUrl'] = getServerUrl()
+	// } else {
+	// 	uni.reLaunch({
+	// 		url: '/pages/index/login'
+	// 	})
+	// }
+	// get请求映射params参数
+	if (config.params) {
+		let url = config.url + '?' + tansParams(config.params)
+		url = url.slice(0, -1)
+		config.url = url
+	}
+	const xml2js = require('xml2js');
+	return new Promise((resolve, reject) => {
+		let requestUrl = uni.getStorageSync("Url") + "/k3cloud/services/LUTAIWebService.asmx/"
+		console.log(requestUrl)
+		uni.request({
+			method: config.method || 'get',
+			timeout: config.timeout || timeout,
+			url: requestUrl + config.url,
+			data: config.data,
+			header: config.header,
+			dataType: 'json',
+			success: res => {
+				if (res.statusCode == 200) {
+					xml2js.parseString(res.data, (err, result) => {
+						console.log(err)
+						console.log(result)
+						if (err) {
+							reject(err);
+						}
+						// 解析后的结果保存在result中
+						const jsonResult = JSON.parse(result.string._);
+						resolve(jsonResult)
+						// if(jsonResult.flag){
+						// 	resolve(jsonResult.result)
+						// }else{
+						// 	reject(jsonResult.message)
+						// }
+					});
+				} else {
+					reject("获取数据失败!")
+					console.log(res)
+				}
+
+			},
+			fail: err => {
+				console.log("获取数据失败")
+				reject(err)
+			},
+			complete: () => {
+				//uni.hideLoading()
+			}
+		})
+	})
+}
+export default request1

+ 304 - 0
utils/storageParams.js

@@ -0,0 +1,304 @@
+// 定义字段映射
+const FieldKeysMap = {
+	"STK_MISCELLANEOUS": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
+	"STK_InStock": "FID,FInStockEntry_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FRealQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
+	"STK_OEMInStock": "FID,FBillEntry_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
+	"LT_PRD_PMCWorkBench": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FActualQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
+	"SP_ReturnMtrl": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
+	"STK_MisDelivery": "FID,FEntity_FEntryID,FENCHASENUM_LT,FSTOCKID.FName,FStockLocId.FF102029.FNumber,FMATERIALID.FNumber,FLOT.FNumber,FQty,FUnitID.FName,FDate,FBillNo,FSTOCKID.FNumber",
+};
+export function getStorageSearchParam(condition) {
+	let FilterString = [{
+		"Left": "(",
+		"FieldName": "FDocumentStatus",
+		"Compare": "105",
+		"Value": "A",
+		"Right": "",
+		"Logic": 1
+	}, {
+		"Left": "",
+		"FieldName": "FDocumentStatus",
+		"Compare": "105",
+		"Value": "D",
+		"Right": ")",
+		"Logic": 0
+	}, {
+		"Left": "",
+		"FieldName": "FStockDirect",
+		"Compare": "29",
+		"Value": "GENERAL",
+		"Right": "",
+		"Logic": 0
+	}, {
+		"Left": "(",
+		"FieldName": "FEntryStoreType_LT.FDataValue",
+		"Compare": "67",
+		"Value": "自产入库",
+		"Right": "",
+		"Logic": 1
+	}, {
+		"Left": "",
+		"FieldName": "FEntryStoreType_LT.FDataValue",
+		"Compare": "67",
+		"Value": "衬衣面料内部调入",
+		"Right": ")",
+		"Logic": 0
+	}, {
+		"Left": "",
+		"FieldName": "FEnchaseNum_LT",
+		"Compare": "67",
+		"Value": condition.FEnchaseNum_LT,
+		"Right": "",
+		"Logic": 0
+	}]
+	if (condition.FormId == "STK_InStock" || condition.FormId == "STK_OEMInStock"||condition.FormId == "SP_ReturnMtrl") { 
+		FilterString = [{
+			"Left": "(",
+			"FieldName": "FDocumentStatus",
+			"Compare": "105",
+			"Value": "A",
+			"Right": "",
+			"Logic": 1
+		}, {
+			"Left": "",
+			"FieldName": "FDocumentStatus",
+			"Compare": "105",
+			"Value": "D",
+			"Right": ")",
+			"Logic": 0
+		}, {
+			"Left": "",
+			"FieldName": "FEnchaseNum_LT",
+			"Compare": "67",
+			"Value": condition.FEnchaseNum_LT,
+			"Right": "",
+			"Logic": 0
+		}]
+
+	}
+	if (condition.FormId == "LT_PRD_PMCWorkBench") { //
+		FilterString = [{
+				"Left": "(",
+				"FieldName": "FDocumentStatus",
+				"Compare": "105",
+				"Value": "A",
+				"Right": "",
+				"Logic": 1
+			}, {
+				"Left": "",
+				"FieldName": "FDocumentStatus",
+				"Compare": "105",
+				"Value": "D",
+				"Right": ")",
+				"Logic": 0
+			}, {
+				"Left": "",
+				"FieldName": "FEnchaseNum_LT",
+				"Compare": "67",
+				"Value": condition.FEnchaseNum_LT,
+				"Right": "",
+				"Logic": 0
+			},
+			{
+				"Left": "",
+				"FieldName": "FStockId.FName",
+				"Compare": "17",
+				"Value": "面料",
+				"Right": "",
+				"Logic": 0
+			},
+			{
+				"Left": "",
+				"FieldName": "FBillType",
+				"Compare": "105",
+				"Value": "d43d7e5b9def82fd11e3e603ca986cd9",
+				"Right": "",
+				"Logic": 0
+			}
+		]
+
+	}
+	if (condition.FormId == "STK_MisDelivery") { //
+		FilterString = [{
+				"Left": "(",
+				"FieldName": "FDocumentStatus",
+				"Compare": "105",
+				"Value": "A",
+				"Right": "",
+				"Logic": 1
+			}, {
+				"Left": "",
+				"FieldName": "FDocumentStatus",
+				"Compare": "105",
+				"Value": "D",
+				"Right": ")",
+				"Logic": 0
+			}, {
+				"Left": "",
+				"FieldName": "FEnchaseNum_LT",
+				"Compare": "67",
+				"Value": condition.FEnchaseNum_LT,
+				"Right": "",
+				"Logic": 0
+			},
+			{
+				"Left": "",
+				"FieldName": "FStockId.FName",
+				"Compare": "17",
+				"Value": "面料",
+				"Right": "",
+				"Logic": 0
+			},
+			{
+				"Left": "",
+				"FieldName": "FStockDirect",
+				"Compare": "29",
+				"Value": "RETURN",
+				"Right": "",
+				"Logic": 0
+			}
+		]
+
+	}
+
+	return {
+		"parameters": [{
+			"FormId": condition.FormId,
+			"FieldKeys": FieldKeysMap[condition.FormId],
+			"FilterString": FilterString,
+		}]
+	}
+}
+export function getStorageByBillNoParam(condition) {
+	return {
+		"parameters": [{
+			"FormId": condition.FormId,
+			"FieldKeys": FieldKeysMap[condition.FormId],
+			"FilterString": [{
+				"Left": "",
+				"FieldName": "FBillNo",
+				"Compare": "338",
+				"Value": condition.FBillNo,
+				"Right": "",
+				"Logic": 0
+			}],
+		}]
+	}
+}
+
+function createEntityObject(item, FEntryIDKey) {
+	return {
+		"FEntryID": item[FEntryIDKey+".FEntryID"],
+		// "FInventoryQty": item["FInventoryQty"],
+		// "FAuxPropId": {
+		// 	"FAUXPROPID__FF101501": {
+		// 		"FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
+		// 	}
+		// },
+		"FStockLocId": {
+			"FSTOCKLOCID__FF102029": {
+				"Fnumber": item["FStockLocId.FF102029.FNumber"]
+				
+			}
+		},
+		// "FLot": {
+		// 	"FNumber": item["Flot.FNumber"]
+		// },
+		// "FENCHASENUM_LT": item["FENCHASENUM.LT"],
+		// [actualQtyKey]: item[actualQtyKey] // 使用动态键名
+	};
+}
+function getFEntryIDKey(FormId) {
+	const keyMap = {
+		'STK_MISCELLANEOUS': 'FEntity',
+		'STK_InStock': 'FInStockEntry',
+		'STK_OEMInStock': 'FBillEntry',
+		'LT_PRD_PMCWorkBench': 'FEntity',
+		'SP_ReturnMtrl': 'FEntity',
+		'STK_MisDelivery': 'FEntity',
+	};
+	return keyMap[FormId];
+}
+
+export function getSaveParam(FormId, data, indexList) {
+	const targetFID = data;
+	const FEntryIDKey = getFEntryIDKey(FormId);
+
+	const FEntityObjects = indexList
+		.filter(item => item.FID === targetFID)
+		.map(item => createEntityObject(item,FEntryIDKey));
+
+	const needUpdateFields = [
+		// "FInventoryQty",
+		// "FAuxPropId",
+		"FStockLocId",
+		"FIsScanFabric",
+		// "FLot",
+		// "FENCHASENUM_LT",
+		// actualQtyKey // 直接添加到数组中
+	];
+
+	return {
+		"parameters": [
+			FormId,
+			{
+				"NeedUpDateFields": needUpdateFields,
+				"NeedReturnFields": ["FID"],
+				"IsDeleteEntry": "true",
+				"SubSystemId": "",
+				"IsVerifyBaseDataField": "false",
+				"IsEntryBatchFill": "true",
+				"ValidateFlag": "true",
+				"NumberSearch": "true",
+				"IsAutoAdjustField": "false",
+				"InterationFlags": "",
+				"IgnoreInterationFlag": "",
+				"IsControlPrecision": "false",
+				"ValidateRepeatJson": "false",
+				"Model": {
+					"FID": targetFID,
+					"FIsScanFabric": true,
+					[FEntryIDKey]: FEntityObjects
+				}
+			}
+		]
+	};
+}
+export function getSubmitParam(FormId, data) {
+	const params = {
+		"parameters": [
+			FormId,
+			{
+				"CreateOrgId": 0,
+				"Numbers": [],
+				"Ids": data.toString(),
+				"SelectedPostId": 0,
+				"UseOrgId": 0,
+				"NetworkCtrl": "",
+				"IgnoreInterationFlag": ""
+			}
+		]
+	};
+	console.log(params);
+	return params;
+}
+export function getAuditParam(FormId, data) {
+	const params = {
+		"parameters": [
+			FormId,
+			{
+				"CreateOrgId": 0,
+				"Numbers": [],
+				"Ids": data.toString(),
+				"InterationFlags": "",
+				"UseOrgId": 0,
+				"NetworkCtrl": "",
+				"IsVerifyProcInst": "true",
+				"IgnoreInterationFlag": "",
+				"UseBatControlTimes": "false"
+			}
+		]
+	}
+	console.log(params)
+	return params
+}

+ 93 - 0
utils/storageSubmitHelper.js

@@ -0,0 +1,93 @@
+import {
+	audit,
+	save,
+	submit
+} from '../api/production_replenishment.js';
+import modal from '../plugins/modal.js';
+import {
+	audioUrls,
+	playVoice
+} from './audio2.js';
+import {
+	getSaveParam,
+	getSubmitParam,
+	getAuditParam
+} from './storageParams.js';
+
+
+export default {
+	async submit(FormId,FID, indexList) {
+		try {
+			modal.loading("提交中,请耐心等待...");
+			const saveParam = getSaveParam(FormId,FID, indexList);
+			console.log(saveParam)
+			const saveRes = await this.saveData(saveParam);
+			if (!saveRes.IsSuccess) {
+				throw new Error(saveRes.Errors[0].Message);
+			}
+
+			const submitParam = getSubmitParam(FormId,FID);
+			const submitRes = await this.submitData(submitParam);
+			if (!submitRes.IsSuccess) {
+				throw new Error(submitRes.Errors[0].Message);
+			}
+
+			const auditParam = getAuditParam(FormId,submitRes.SuccessEntitys[0].Id);
+			const auditRes = await this.auditData(auditParam);
+			if (!auditRes.IsSuccess) {
+				throw new Error(auditRes.Errors[0].Message);
+			}
+
+			this.handleSuccess(FID, indexList);
+
+		} catch (error) {
+			// this.handleError(error);
+			throw new Error(error);
+		} finally {
+			modal.closeLoading();
+		}
+	},
+
+	saveData(params) {
+		return save(JSON.stringify(params))
+			.then(res => res.Result.ResponseStatus);
+	},
+
+	submitData(params) {
+		return submit(JSON.stringify(params))
+			.then(res => res.Result.ResponseStatus);
+	},
+
+	auditData(params) {
+		return audit(JSON.stringify(params))
+			.then(res => res.Result.ResponseStatus);
+	},
+
+	handleSuccess(FID, indexList) {
+
+		// Assuming that you pass indexList back to where it's needed
+		uni.showModal({
+			title: "提示",
+			content: "提交成功",
+			showCancel: true,
+			success: (res) => {
+				if (res.confirm) {
+					// 用户点击确定
+				} else {
+					// 用户点击取消
+				}
+			}
+		});
+		playVoice(audioUrls.warningSuccessUrl);
+	},
+
+	handleError(error) {
+		uni.showToast({
+			title: error.message || '操作失败',
+			duration: 3000,
+			icon: "error"
+		});
+		playVoice(audioUrls.successVoiceUrl)
+		console.error('操作失败:', error);
+	}
+};