Browse Source

简单生产领料(智能)

LT31650A 1 month ago
parent
commit
7000612c56

+ 21 - 0
pages/index/index.vue

@@ -80,6 +80,7 @@
 						"采购退料单",
 						"受托加工材料退料单",
 						"销售出库",
+						"简单生产领料(智能)",
 					]
 				}]
 
@@ -129,6 +130,17 @@
 						url: '/pages/stock-dispatch/index'
 					});
 				}
+				if (item.name == "简单生产领料(智能)") {
+					const formId = 'SP_PickMtrl';
+					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
+					uni.setStorageSync('formId', formId)
+					uni.setStorageSync('fbillType', 'B')
+					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 = 'PUR_MRB';
 					// const fbillType = 'd43d7e5b9def82fc11e3e582178e4360';
@@ -149,6 +161,15 @@
 						// url: `/pages/stock-dispatch/index?FormId=${encodeURIComponent(formId)}&FBillType=${encodeURIComponent(fbillType)}`
 						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'
+					});
 				}
 			},
 			goScan() {

+ 154 - 113
pages/stock-dispatch/index.vue

@@ -22,9 +22,9 @@
 					<view class="table-cellwl">物料编码</view>
 					<view class="table-cell1">箱号</view>
 					<view class="table-cell1">实际作业数量</view>
-					<view class="table-cell1">即时库存数量</view>
+					<view class="table-cell1" v-if="showInventoryQty">即时库存数量</view>
 					<view class="table-cell1">装箱单号</view>
-					<view class="table-cell">面料订单号</view>
+					<view class="table-cell" v-if="showInventoryQty">面料订单号</view>
 					<view class="table-cell">等级</view>
 					<view class="table-cellph">批号</view>
 					<view class="table-cell2" v-if="showWorkCenter">工作中心</view>
@@ -47,30 +47,22 @@
 					<view class="table-cell"><button type="default" size="mini" @click="edit(item,index)">编辑</button>
 					</view>
 					<view class="table-cell">{{ item.smzt? '已扫描' : '未扫描' }}</view>
-					<view class="table-cell">{{ item["FStockLocId.FF102029.fname"] }}</view>
-					<view class="table-cellwl" :style="getStyle(item.smzt)">{{ item["FMaterialId.fnumber"] }}</view>
+					<view class="table-cell">{{ getPosition(item) }}</view>
+					<view class="table-cellwl" :style="getStyle(item.smzt)">{{ getMaterial(item) }}</view>
 					<view class="table-cell1" :style="getStyle(item.smzt)">{{ getBoxNo(item) }}</view>
-					<!-- <view class="table-cell1" :style="getStyle(item.smzt)"
-						v-if="formId === 'LT_PRD_PMCWorkBench'||formId === 'SP_PickMtrl'">{{ item["FActualQty"] }}
-					</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)" v-else-if="formId === 'STK_MisDelivery'">
-						{{ item["FQty"] }}
-					</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)" v-else-if="formId === 'PUR_MRB'">
-						{{ item["FRMREALQTY"] }}
-					</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)" v-else>{{ item["FQty"] }}</view> -->
 					<view class="table-cell1" :style="getStyle(item.smzt)">
 						{{ getActualWorkQuantity(item) }}
 					</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FInventoryQty"] }}</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FENCHASENUM.LT"] }}</view>
-					<view class="table-cell" :style="getStyle(item.smzt)">
+					<view class="table-cell1" :style="getStyle(item.smzt)" v-if="showInventoryQty">
+						{{ getInventoryQty(item) }}
+					</view>
+					<view class="table-cell1" :style="getStyle(item.smzt)">{{ getFENCHASENUM(item) }}</view>
+					<view class="table-cell" :style="getStyle(item.smzt)" v-if="showInventoryQty">
 						{{ getFabricOrderNo(item) }}
 					</view>
-					<view class="table-cell" :style="getStyle(item.smzt)">{{ item["FAuxPropId.FF101501.FDATAVALUE"] }}
+					<view class="table-cell" :style="getStyle(item.smzt)">{{ getFAuxPropId(item) }}
 					</view>
-					<view class="table-cellph" :style="getStyle(item.smzt)">{{ item["Flot.FNumber"] }}</view>
+					<view class="table-cellph" :style="getStyle(item.smzt)">{{ getFlot(item) }}</view>
 					<view class="table-cell2" :style="getStyle(item.smzt)" v-if="showWorkCenter">
 						{{ getWorkCenterName(item) }}
 					</view>
@@ -201,9 +193,12 @@
 					item["FStockLocId.FF102029.fname"] == this.Location && item['smzt'] != 1
 				).length
 			},
+			showInventoryQty() {
+				return this.formId !== 'SP_PickMtrl' && uni.getStorageSync("fbillType") !== "B";
+			},
 			showWorkCenter() {
 				return this.formId !== 'PUR_MRB' && this.formId !== 'STK_MisDelivery' && this.formId !==
-					'STK_OEMInStockRETURN';
+					'STK_OEMInStockRETURN' && this.formId !== 'SAL_OUTSTOCK';
 			},
 			showRemark() {
 				return this.formId !== 'PUR_MRB';
@@ -278,45 +273,23 @@
 				console.log(data)
 				let index = data["index"]
 				if ("NewFENCHASENUM.LT" in data) {
-					this.indexList[index]["FENCHASENUM.LT"] = data["NewFENCHASENUM.LT"]
+					let FENCHASENUMFieldName = this.indexList[index].hasOwnProperty('FSumEnchaseNum.LT') ? 'FSumEnchaseNum.LT' : 'FENCHASENUM.LT';
+					this.indexList[index][FENCHASENUMFieldName] = data["NewFENCHASENUM.LT"]
 				}
-				if (this.indexList[index]["FStockLocId.FF102029.fname"] != data["FStockLocId.FF102029.fname"]) {
-
-					// const data1 = {
-					// 	"parameters": [{
-					// 		"FormId": "STK_Inventory",
-					// 		"FieldKeys": "fID",
-					// 		"FilterString": [{
-					// 				"Left": "",
-					// 				"FieldName": "FStockLocId.FF102029.FName",
-					// 				"Compare": "67",
-					// 				"Value": data["FStockLocId.FF102029.fname"],
-					// 				"Right": "",
-					// 				"Logic": 0
-					// 			},
-					// 			{
-					// 				"Left": "",
-					// 				"FieldName": "FBaseQty",
-					// 				"Compare": "21",
-					// 				"Value": "0",
-					// 				"Right": "",
-					// 				"Logic": 0
-					// 			}
-					// 		],
-					// 	}]
-					// }
-					const requestData = createInventoryQueryRequest(data["FStockLocId.FF102029.fname"])
+				let FStockLocIdFieldName = this.indexList[index].hasOwnProperty('FSumStockLocId.FF102029.fname') ? 'FSumStockLocId.FF102029.fname' : 'FStockLocId.FF102029.fname';
+				if (this.indexList[index][FStockLocIdFieldName] != data[FStockLocIdFieldName]) {
+					const requestData = createInventoryQueryRequest(data[FStockLocIdFieldName])
 					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"]
+						this.indexList[index][FStockLocIdFieldName] = data[
+							FStockLocIdFieldName]
 						// 用于记录每个组合的计数
 						let countMap = {};
 						// 统计每个组合的行数
 						this.indexList.forEach(obj => {
 							// 获取当前对象的组合键
-							let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
+							let key = obj.FBillNo + '|' + obj[FStockLocIdFieldName];
 							// 如果该组合已经存在于 countMap 中,则增加计数,否则初始化为 1
 							if (countMap[key]) {
 								countMap[key]++;
@@ -326,12 +299,16 @@
 						});
 						// 将计数值添加到每个对象中
 						this.indexList.forEach(obj => {
-							let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
+							let key = obj.FBillNo + '|' + obj[FStockLocIdFieldName];
 							obj.rowCount = countMap[key];
 						});
 					})
 				}
-				this.indexList[index]['FInventoryQty'] = data["FInventoryQty"]
+				if (this.formId === 'SAL_OUTSTOCK') {
+					this.indexList[index]['FInventoryQty.LT'] = data["FInventoryQty.LT"]
+				} else {
+					this.indexList[index]['FInventoryQty'] = data["FInventoryQty"]
+				}
 				// if (this.formId === 'LT_PRD_PMCWorkBench' || this.formId === 'SP_PickMtrl') {
 				// 	this.indexList[index]['FActualQty'] = data["FActualQty"]
 				// }
@@ -342,21 +319,31 @@
 				// 	this.indexList[index]['FRMREALQTY'] = data["FRMREALQTY"]
 				// }
 				// 定义一个映射对象
+			
 				const formIdMap = {
 					'LT_PRD_PMCWorkBench': 'FActualQty',
 					'SP_PickMtrl': 'FActualQty',
 					'STK_MisDelivery': 'FQty',
-					'PUR_MRB': 'FRMREALQTY'
+					'STK_OEMInStockRETURN': 'FQty',
+					'PUR_MRB': 'FRMREALQTY',
+					'SAL_OUTSTOCK': 'FRealQty'
 				};
-				// 获取对应的字段名称
-				const field = formIdMap[this.formId];
-				// 如果存在匹配的字段,则更新 indexList
-				if (field) {
-					this.indexList[index][field] = data[field];
+				if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B"){
+					this.indexList[index]["FSumActualQty"] = data["FSumActualQty"]
+				}else{
+					// 获取对应的字段名称
+					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"]
+				let lotFieldName = this.indexList[index].hasOwnProperty('FSumLot.FNumber') ? 'FSumLot.FNumber' : 'Flot.FNumber';
+				let FAuxPropIdFieldName = this.indexList[index].hasOwnProperty('FSumAuxPropId.FF101501.FNumber') ? 'FSumAuxPropId.FF101501.FNumber' : 'FAuxPropId.FF101501.FDATAVALUE';
+				this.indexList[index][lotFieldName] = data[lotFieldName]
+				this.indexList[index][FAuxPropIdFieldName] = data[FAuxPropIdFieldName]
 				this.indexList[index]['smzt'] = data["smzt"]
 				console.log(this.indexList[index])
 				this.$nextTick(() => {
@@ -376,7 +363,9 @@
 				// 统计每个组合的行数
 				this.indexList.forEach(obj => {
 					// 获取当前对象的组合键
-					let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
+					let stockLocName = obj['FStockLocId.FF102029.fname'] || obj[
+						'FSumStockLocId.FF102029.fname'];
+					let key = obj.FBillNo + '|' + stockLocName;
 
 					// 如果该组合已经存在于 countMap 中,则增加计数,否则初始化为 1
 					if (countMap[key]) {
@@ -388,13 +377,15 @@
 
 				// 将计数值添加到每个对象中
 				this.indexList.forEach(obj => {
-					let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
+					let stockLocName = obj['FStockLocId.FF102029.fname'] || obj[
+						'FSumStockLocId.FF102029.fname'];
+					let key = obj.FBillNo + '|' + stockLocName;
 					// obj.rowCount = countMap[key];
 					this.$set(obj, 'rowCount', countMap[key])
 				});
 				// 1. 提取不同的仓位
-				this.uniqueFStockLocId = [...new Set(this.indexList.map(obj => obj[
-					'FStockLocId.FF102029.fname']))];
+				this.uniqueFStockLocId = [...new Set(this.indexList.map(obj => obj['FStockLocId.FF102029.fname'] ||
+					obj['FSumStockLocId.FF102029.fname']))];
 				console.log(this.uniqueFStockLocId)
 				// this.processQuantity(this.uniqueFStockLocId[0])
 				this.updateIndexList(this.indexList)
@@ -448,16 +439,27 @@
 		},
 		methods: {
 			getActualWorkQuantity(item) {
+				if (this.formId === 'LT_PRD_PMCWorkBench' || (this.formId === 'SP_PickMtrl' && uni.getStorageSync(
+						"fbillType") !== "B")) {
+					return item["FActualQty"];
+				} else if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+					return item["FSumActualQty"];
+				} else if (this.formId === 'STK_MisDelivery') {
+					return item["FQty"];
+				} else if (this.formId === 'PUR_MRB') {
+					return item["FRMREALQTY"];
+				} else if (this.formId === 'SAL_OUTSTOCK') {
+					return item["FRealQty"];
+				} else {
+					return item["FQty"];
+				}
+			},
+			getInventoryQty(item) {
 				switch (this.formId) {
-					case 'LT_PRD_PMCWorkBench':
-					case 'SP_PickMtrl':
-						return item["FActualQty"];
-					case 'STK_MisDelivery':
-						return item["FQty"];
-					case 'PUR_MRB':
-						return item["FRMREALQTY"];
+					case 'SAL_OUTSTOCK':
+						return item["FInventoryQty.LT"];
 					default:
-						return item["FQty"];
+						return item["FInventoryQty"];
 				}
 			},
 			getFabricOrderNo(item) {
@@ -466,16 +468,61 @@
 					case 'LT_PRD_PMCWorkBench':
 					case 'STK_OEMInStockRETURN':
 						return item["FFabricOrderNo"];
+					case 'SAL_OUTSTOCK':
+						return item["FFABRICORDERNO_LT"];
 					default:
 						return item["FFabricOrderNo.LT"];
 				}
 			},
+			getMaterial(item) {
+				if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+					return item["FSumMaterialId.fnumber"];
+
+				} else {
+					return item["FMaterialId.fnumber"];
+				}
+			},
+			getFENCHASENUM(item) {
+				if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+					return item["FSumEnchaseNum.LT"];
+
+				} else {
+					return item["FENCHASENUM.LT"];
+				}
+			},
+			getFAuxPropId(item) {
+				if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+					return item["FSumAuxPropId.FF101501.FNumber"];
+
+				} else {
+					return item["FAuxPropId.FF101501.FDATAVALUE"];
+				}
+			},
+			getFlot(item) {
+				if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+					return item["FSumLot.FNumber"];
+
+				} else {
+					return item["Flot.FNumber"];
+				}
+			},
+			getPosition(item) {
+				if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+					return item["FSumStockLocId.FF102029.fname"];
+
+				} else {
+					return item["FStockLocId.FF102029.fname"];
+				}
+			},
 			getBoxNo(item) {
-				switch (this.formId) {
-					case 'STK_OEMInStockRETURN':
-						return item["FBoxNo"];
-					default:
-						return item["FBOXNO.LT"];
+				if (this.formId === 'STK_OEMInStockRETURN') {
+					return item["FBoxNo"];
+				} else if (this.formId === 'SAL_OUTSTOCK') {
+					return item["FBoxNumber"];
+				} else if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+					return item["FSumBoxNo.LT"];
+				} else {
+					return item["FBOXNO.LT"];
 				}
 			},
 			getWorkCenterName(item) {
@@ -501,6 +548,14 @@
 						return ''; // 默认返回值,可以根据需求调整
 				}
 			},
+			getStockClerk(item) {
+				switch (this.formId) {
+					case 'SAL_OUTSTOCK':
+						return item["FStockerEId_LT.FName"];
+					default:
+						return item["FSTOCKERID.fname"]; // 默认返回值,可以根据需求调整
+				}
+			},
 			getRemark(item) {
 				switch (this.formId) {
 					case 'STK_OEMInStockRETURN':
@@ -510,7 +565,7 @@
 						// case 'SP_PickMtrl':
 						// 	return item["FPickerId.fname"];
 					default:
-						return 'FEntrtyMemo'; // 默认返回值,可以根据需求调整
+						return item["FEntrtyMemo"]; // 默认返回值,可以根据需求调整
 				}
 			},
 			async updateIndexList(data1) {
@@ -519,34 +574,12 @@
 					let promises = [];
 					// 遍历 uniqueFStockLocId 数组
 					for (let fname of this.uniqueFStockLocId) {
-						// const data = {
-						// 	"parameters": [{
-						// 		"FormId": "STK_Inventory",
-						// 		"FieldKeys": "fID",
-						// 		"FilterString": [{
-						// 				"Left": "",
-						// 				"FieldName": "FStockLocId.FF102029.FName",
-						// 				"Compare": "67",
-						// 				"Value": fname,
-						// 				"Right": "",
-						// 				"Logic": 0
-						// 			},
-						// 			{
-						// 				"Left": "",
-						// 				"FieldName": "FBaseQty",
-						// 				"Compare": "21",
-						// 				"Value": "0",
-						// 				"Right": "",
-						// 				"Logic": 0
-						// 			}
-						// 		],
-						// 	}]           
-						// };
 						const requestData = createInventoryQueryRequest(fname)
 
 						// 发起异步请求,并将 promise 存储在数组中
 						let promise = getInventoryList(JSON.stringify(requestData)).then(res => {
-							let objs = data1.filter(item => item['FStockLocId.FF102029.fname'] === fname);
+							let objs = data1.filter(item => item['FStockLocId.FF102029.fname'] === fname ||
+								item['FSumStockLocId.FF102029.fname'] === fname);
 
 							objs.forEach(obj => {
 								this.$set(obj, 'quantity', res.length);
@@ -751,8 +784,9 @@
 			},
 			async handleSubmit(FID) {
 				const FormId = uni.getStorageSync('formId')
+				const fbillType = uni.getStorageSync('fbillType')
 				try {
-					await submitHelper.submit(FormId, FID, this.indexList);
+					await submitHelper.submit(FormId, FID, this.indexList,fbillType);
 					this.indexList = this.indexList.filter(item => item.FID !== FID);
 					console.log(this.indexList)
 					if (this.isStage == true) {
@@ -813,8 +847,8 @@
 					}.bind(this)
 				})
 			},
-			handleScanSuccess(nowindex) {
-				this.Location = this.indexList[nowindex]["FStockLocId.FF102029.fname"]
+			handleScanSuccess(nowindex,FStockLocIdkey) {
+				this.Location = this.indexList[nowindex][FStockLocIdkey]
 				this.indexList[nowindex].smzt = 1 //修改数据状态
 				console.log(this.indexList.filter(obj => obj.smzt === 1).length)
 				this.$forceUpdate()
@@ -832,7 +866,7 @@
 				// audioUrlsArr.push(audioUrls.success2VoiceUrl);
 				// playSequentially(audioUrlsArr);
 				if (this.indexList.filter(item =>
-						item["FStockLocId.FF102029.fname"] == this.Location && item[
+						item[FStockLocIdkey] == this.Location && item[
 							'smzt'] != 1
 					).length == 0) { //该仓位扫描完
 					// playVoice(audioUrls.allSuccessVoiceUrl)
@@ -862,8 +896,15 @@
 					this.focusPoint()
 					return
 				}
+				let FENCHASENUMkey = "FENCHASENUM.LT"; // 默认字段名
+				let FStockLocIdkey = "FStockLocId.FF102029.fname"; // 默认字段名
+
+				if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") === "B") {
+					FENCHASENUMkey = "FSumEnchaseNum.LT"; // 条件满足时使用的字段名
+					FStockLocIdkey = "FSumStockLocId.FF102029.fname";
+				}
 				// 校验条码是否存在
-				if (this.checkBarcodeInArray(this.searchValue, this.indexList, "FENCHASENUM.LT")) {
+				if (this.checkBarcodeInArray(this.searchValue, this.indexList, FENCHASENUMkey)) {
 					uni.showModal({
 						title: '提示',
 						content: "条码:" + vm.searchValue + '不存在',
@@ -906,8 +947,8 @@
 				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"] //当前仓位
+					if (this.indexList[i][FENCHASENUMkey] === this.searchValue) {
+						nowlocation = this.indexList[i][FStockLocIdkey] //当前仓位
 						nowindex = i //当前索引
 						this.balance = this.indexList[i]["quantity"] - this.indexList[i]["rowCount"]
 						break;
@@ -916,7 +957,7 @@
 				//不是首次扫描
 				if (this.indexListLength != 0) { //已有操作,计算上次操作的仓位未扫描数
 					let UnscannedNumber = this.indexList.filter(item =>
-						item["FStockLocId.FF102029.fname"] == this.Location && item['smzt'] != 1
+						item[FStockLocIdkey] == this.Location && item['smzt'] != 1
 					).length
 					if (nowlocation != this.Location && UnscannedNumber != 0) { //仓位不一致
 						playVoice(audioUrls.warningSuccessUrl)
@@ -926,7 +967,7 @@
 							showCancel: true,
 							success: function(res) {
 								if (res.confirm) {
-									vm.handleScanSuccess(nowindex)
+									vm.handleScanSuccess(nowindex,FStockLocIdkey)
 								} else {
 									// 执行取消后的操作
 									vm.$nextTick(() => {
@@ -938,11 +979,11 @@
 						})
 						return
 					} else { //仓位一致或原仓位已扫完,正常扫描,无切换
-						this.handleScanSuccess(nowindex)
+						this.handleScanSuccess(nowindex,FStockLocIdkey)
 
 					}
 				} else { //首次扫描
-					this.handleScanSuccess(nowindex)
+					this.handleScanSuccess(nowindex,FStockLocIdkey)
 				}
 			},
 			getHeightStyle() {

+ 35 - 6
pages/stock-dispatch/search.vue

@@ -36,7 +36,19 @@
 				<view class="table-cell"
 					style="background-color: #f0f0f0;font-weight: bold;border-bottom: 1px solid #ccc;">单据日期</view>
 			</view>
-			<view class="table-header" ref="tableHeader" v-else-if="formId === 'STK_MisDelivery'" >
+			<view class="table-header" ref="tableHeader" v-else-if="formId === 'SAL_OUTSTOCK'">
+				<view class="table-cell1">单据编号</view>
+				<view class="table-cell">仓管员</view>
+				<view class="table-cell1"
+					style="background-color: #f0f0f0;font-weight: bold;border-bottom: 1px solid #ccc;">客户</view>
+				<view class="table-cell1"
+					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 class="table-cell"
+					style="background-color: #f0f0f0;font-weight: bold;border-bottom: 1px solid #ccc;">单据日期</view>
+			</view>
+			<view class="table-header" ref="tableHeader" v-else-if="formId === 'STK_MisDelivery'">
 				<view class="table-cell1">领料部门</view>
 				<view class="table-cell">领料人</view>
 				<view class="table-cell"
@@ -50,7 +62,7 @@
 			</view>
 			<!-- 表头 -->
 			<view class="table-header" ref="tableHeader" v-else>
-				<view class="table-cell1" >工作中心</view>
+				<view class="table-cell1">工作中心</view>
 				<view class="table-cell" v-if="formId === 'SP_PickMtrl'">领料人</view>
 				<view class="table-cell" v-else>作业申请人</view>
 				<view class="table-cell"
@@ -94,6 +106,21 @@
 					</view>
 				</checkbox-group>
 			</view>
+			<view class="table-body" v-else-if="formId === 'SAL_OUTSTOCK'">
+				<checkbox-group @change="checkboxChange">
+					<view class="table-row" v-for="(item, index) in BillList" :key="item.FID">
+						<view class="table-cell1-1">
+							<checkbox :value="item.FID" :checked="item.checked" />
+							{{ item["FBillNo"]}}
+						</view>
+						<view class="table-cell">{{ item["FSTOCKERID.fname"] }}</view>
+						<view class="table-cell1">{{ item["FCustomerID.FName"] }}</view>
+						<view class="table-cell1">{{ item["FSalesManID.FName"] }}</view>
+						<view class="table-cell">{{ item["FSaleDeptID.FName"] }}</view>
+						<view class="table-cell">{{ item["FDate"].substring(0, 10) }}</view>
+					</view>
+				</checkbox-group>
+			</view>
 			<view class="table-body" v-else-if="formId === 'STK_MisDelivery'">
 				<checkbox-group @change="checkboxChange">
 					<view class="table-row" v-for="(item, index) in BillList" :key="item.FID">
@@ -106,7 +133,7 @@
 						<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>
@@ -125,7 +152,8 @@
 							<checkbox :value="item.FID" :checked="item.checked" />
 							{{ item["FWorkCenterId.LT.fname"]}}
 						</view>
-						<view class="table-cell"  v-if="formId === 'SP_PickMtrl'">{{ item["FPickingPeople.LT.FName"] }}</view>
+						<view class="table-cell" v-if="formId === 'SP_PickMtrl'">{{ item["FPickingPeople.LT.FName"] }}
+						</view>
 						<view class="table-cell" v-else>{{ item["FApplicantId.fname"] }}</view>
 						<view class="table-cell">{{ item["FSTOCKERID.fname"] }}</view>
 						<view class="table-cell1-1">{{ item["FBillNo"] }}</view>
@@ -237,7 +265,7 @@
 				} catch (error) {
 					playVoice(audioUrls.failVoiceUrl)
 					console.error('操作失败:', error);
-					modal.confirm(error|| '操作失败').then(res => {
+					modal.confirm(error || '操作失败').then(res => {
 						if (res) {
 
 						} else {
@@ -272,7 +300,8 @@
 			createSubmitCondition() {
 				return {
 					FormId: uni.getStorageSync('formId'),
-					selectedFID: this.selected.join(',')
+					selectedFID: this.selected.join(','),
+					FBillType:uni.getStorageSync('fbillType')
 				};
 			},
 			// 发起请求并获取数据

+ 202 - 25
pages/stock-dispatch/show.vue

@@ -4,7 +4,7 @@
 			<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 v-model="inputFENCHASENUM" disabled>
 						</uni-easyinput>
 					</uni-forms-item>
 					<uni-forms-item label="新装箱单号" name="Mdd">
@@ -12,28 +12,21 @@
 						</uni-easyinput>
 					</uni-forms-item>
 					<uni-forms-item label="物料编码" name="Ch">
-						<uni-easyinput v-model="item['FMaterialId.fnumber']" disabled />
+						<uni-easyinput v-model="inputMaterial" 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 label="实际作业数量" :name="fieldName">
+						<uni-easyinput type="number" v-model="inputValue" 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-forms-item label="剩余数量" v-if="showRemainingQuantity">
 						<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 label="即时库存数量" name="FInventoryQty" v-if="showFInventoryQty">
+						<uni-easyinput disabled v-model="InventoryQtyValue" placeholder="即时库存数量" />
 					</uni-forms-item>
-					<uni-forms-item label="生产车间" name="FWorkShopId.fname" v-if="formId !== 'PUR_MRB'">
+					<uni-forms-item label="生产车间" name="FWorkShopId.fname" v-if="showWorkShop">
 						<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-forms-item label="仓位" name="FStockLocId.FF102029.fname" v-if="showLocation">
 						<uni-easyinput disabled v-model="item['FStockLocId.FF102029.fname']" />
 					</uni-forms-item>
 					<uni-forms-item label="采购员" name="FPURCHASERID.fname" v-if="formId === 'PUR_MRB'">
@@ -85,7 +78,14 @@
 						rules: [{
 								required: true,
 								errorMessage: '请输入实发数量',
-							},
+							}, {
+								validateFunction: function(rule, value, data, callback) {
+									if (value < 0) {
+										callback('实际作业数量不能小于0')
+									}
+									return true
+								}
+							}
 
 						]
 					},
@@ -93,7 +93,44 @@
 						rules: [{
 								required: true,
 								errorMessage: '请输入实际作业数量',
-							},
+							}, {
+								validateFunction: function(rule, value, data, callback) {
+									if (value < 0) {
+										callback('实际作业数量不能小于0')
+									}
+									return true
+								}
+							}
+
+						]
+					},
+					FRealQty: {
+						rules: [{
+								required: true,
+								errorMessage: '请输入实际作业数量',
+							}, {
+								validateFunction: function(rule, value, data, callback) {
+									if (value < 0) {
+										callback('实际作业数量不能小于0')
+									}
+									return true
+								}
+							}
+
+						]
+					},
+					FSumActualQty: {
+						rules: [{
+								required: true,
+								errorMessage: '请输入实际作业数量',
+							}, {
+								validateFunction: function(rule, value, data, callback) {
+									if (value < 0) {
+										callback('实际作业数量不能小于0')
+									}
+									return true
+								}
+							}
 
 						]
 					},
@@ -106,12 +143,145 @@
 				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') {
+				if (this.formId === 'STK_MisDelivery' || this.formId === 'STK_OEMInStockRETURN') {
 					return Math.round((this.item["FInventoryQty"] - this.item["FQty"]) * 100) / 100;
 				}
-			}
+				if (this.formId === 'SAL_OUTSTOCK') {
+					return Math.round((this.item["FInventoryQty.LT"] - this.item["FRealQty"]) * 100) / 100;
+				}
+			},
+			fieldName() {
+				if (this.formId === 'LT_PRD_PMCWorkBench' || (this.formId === 'SP_PickMtrl' && uni.getStorageSync(
+						"fbillType") !== "B")) {
+					return 'FActualQty';
+				} else if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+					return 'FSumActualQty';
+				} else if (this.formId === 'STK_MisDelivery') {
+					return 'FQty';
+				} else if (this.formId === 'PUR_MRB') {
+					return 'FRMREALQTY';
+				} else if (this.formId === 'SAL_OUTSTOCK') {
+					return 'FRealQty';
+				} else {
+					return 'FQty';
+				}
+			},
+			inputFENCHASENUM: {
+				get() {
+					if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+						return this.item["FSumEnchaseNum.LT"];
+					} else {
+						return this.item["FENCHASENUM.LT"];
+					}
+				},
+				set(value) {
+					if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+						this.item["FSumEnchaseNum.LT"] = value;
+					} else {
+						this.item["FENCHASENUM.LT"] = value;
+					}
+				}
+			},
+			inputMaterial: {
+				get() {
+					if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+						return this.item["FSumMaterialId.fnumber"];
+					} else {
+						return this.item["FMaterialId.fnumber"];
+					}
+				},
+				set(value) {
+					if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+						this.item["FSumMaterialId.fnumber"] = value;
+					} else {
+						this.item["FMaterialId.fnumber"] = value;
+					}
+				}
+			},
+			inputValue: {
+				get() {
+					if (this.formId === 'LT_PRD_PMCWorkBench' || (this.formId === 'SP_PickMtrl' && uni.getStorageSync(
+							"fbillType") !== "B")) {
+						return this.item.FActualQty;
+					} else if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+						return this.item.FSumActualQty;
+					} else if (this.formId === 'STK_MisDelivery') {
+						return this.item.FQty;
+					} else if (this.formId === 'PUR_MRB') {
+						return this.item.FRMREALQTY;
+					} else if (this.formId === 'SAL_OUTSTOCK') {
+						return this.item.FRealQty;
+					} else {
+						return this.item.FQty;
+					}
+				},
+				set(value) {
+					if (this.formId === 'LT_PRD_PMCWorkBench' || (this.formId === 'SP_PickMtrl' && uni.getStorageSync(
+							"fbillType") !== "B")) {
+						this.item.FActualQty = value;
+					} else if (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") == "B") {
+						return this.item.FSumActualQty = value;
+					} else if (this.formId === 'STK_MisDelivery' || this.formId === 'STK_OEMInStockRETURN') {
+						this.item.FQty = value;
+					} else if (this.formId === 'PUR_MRB') {
+						this.item.FRMREALQTY = value;
+					} else if (this.formId === 'SAL_OUTSTOCK') {
+						this.item.FRealQty = value;
+					}
+				}
+			},
+
+			InventoryQtyValue: {
+				get() {
+					switch (this.formId) {
+						case 'SAL_OUTSTOCK':
+							return this.item["FInventoryQty.LT"];
+						default:
+							return this.item.FInventoryQty;
+					}
+				},
+				set(value) {
+					switch (this.formId) {
+						// case 'LT_PRD_PMCWorkBench':
+						// case 'SP_PickMtrl':
+						// 	this.item.FActualQty = value;
+						// 	break;
+						// case 'STK_MisDelivery':
+						// case 'STK_OEMInStockRETURN':
+						// 	this.item.FQty = value;
+						// 	break;
+						// case 'PUR_MRB':
+						// 	this.item.FRMREALQTY = value;
+						// 	break;
+						// case 'SAL_OUTSTOCK':
+						// 	this.item.FRealQty = value;
+						// 	break;
+						case 'SAL_OUTSTOCK':
+							return this.item["FInventoryQty.LT"] = value;
+						default:
+							return this.item.FInventoryQty = value;
+					}
+				}
+			},
+			showRemainingQuantity() {
+				return this.formId !== 'PUR_MRB' && (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") !=
+					"B")
+			},
+			showFInventoryQty() {
+				return this.formId !== 'PUR_MRB' && (this.formId === 'SP_PickMtrl' && uni.getStorageSync("fbillType") !=
+					"B")
+			},
+			showWorkShop() {
+				return this.formId !== 'PUR_MRB' && this.formId !== 'SAL_OUTSTOCK' && this.formId !==
+					'STK_OEMInStockRETURN'
+			},
+			showLocation() {
+				return this.formId === 'PUR_MRB' || this.formId === 'STK_OEMInStockRETURN'
+			},
 		},
 		methods: {
+
+
 			async search() {
 
 				if (this.item['NewFENCHASENUM.LT'] == "") {
@@ -150,7 +320,7 @@
 					});
 					return; // 停止保存操作
 				}
-				if (firstResponse[0]["FMaterialId.fnumber"] != this.item["FMaterialId.fnumber"]) {
+				if (firstResponse[0]["FMaterialId.fnumber"] != (this.item["FMaterialId.fnumber"]||this.item["FSumMaterialId.fnumber"])) {
 					console.log("dafafadf")
 					uni.showToast({
 						title: '编码与原物料编码不一致,请重新替换装箱单号',
@@ -202,10 +372,17 @@
 					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"]
+				if (this.formId === 'SAL_OUTSTOCK') {
+					this.item['FInventoryQty.LT'] = secondResponse[0]["FBaseQty"]
+				} else {
+					this.item['FInventoryQty'] = secondResponse[0]["FBaseQty"]
+				}
+				let lotFieldName = this.item.hasOwnProperty('FSumLot.FNumber') ? 'FSumLot.FNumber' : 'Flot.FNumber';
+				let FAuxPropIdFieldName = this.item.hasOwnProperty('FSumAuxPropId.FF101501.FNumber') ? 'FSumAuxPropId.FF101501.FNumber' : 'FAuxPropId.FF101501.FDATAVALUE';
+				let FStockLocIdFieldName = this.item.hasOwnProperty('FSumStockLocId.FF102029.fname') ? 'FSumStockLocId.FF102029.fname' : 'FStockLocId.FF102029.fname';
+				this.item[lotFieldName] = firstResponse[0]["FLot.FNumber"];
+				this.item[FAuxPropIdFieldName] = secondResponse[0]["FAuxPropId.FF101501.FDATAVALUE"]
+				this.item[FStockLocIdFieldName] = secondResponse[0]["FStockLocId.FF102029.fname"]
 				this.item['smzt'] = 1
 				console.log("替换后item", this.item)
 				console.log(secondResponse)

+ 9 - 3
utils/commonSubmitHelper.js

@@ -11,15 +11,21 @@ import {
 import {
 	getSaveParam,
 	getSubmitParam,
-	getAuditParam
+	getAuditParam,
+	get2SaveParam
 } from './newparams.js';
 
 
 export default {
-	async submit(FormId,FID, indexList) {
+	async submit(FormId,FID, indexList,fbillType) {
 		try {
 			modal.loading("提交中,请耐心等待...");
-			const saveParam = getSaveParam(FormId,FID, indexList);
+			let saveParam; 
+			if(fbillType == "B"){
+				 saveParam = get2SaveParam(FormId,FID, indexList);
+			}else{
+				 saveParam = getSaveParam(FormId,FID, indexList);
+			}
 			console.log(saveParam)
 			const saveRes = await this.saveData(saveParam);
 			if (!saveRes.IsSuccess) {

+ 201 - 81
utils/newparams.js

@@ -4,7 +4,8 @@ const FieldKeysMap = {
 	"SP_PickMtrl": "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FActualQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FWorkCenterId.fname,FEntrtyMemo,FDate,FPickerId.fname,FSTOCKERID.fname,FStockActualQty,FWorkShopId.fname,FPickingPeople_LT.FName",
 	"LT_PRD_PMCWorkBench": "FID,FEntity_FEntryID,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBOXNO_LT,FActualQty,FInventoryQty,FENCHASENUM_LT,FFabricOrderNo,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FWorkCenterId_LT.fname,FEntrtyMemo,FDate,FApplicantId.fname,FSTOCKERID.fname,FStockActualQty,FWorkShopId.fname",
 	"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,FBillNo,FStockLocId.FF102029.fname,FMaterialId.fnumber,FBoxNo,FInventoryQty,FENCHASENUM_LT,FInventoryQty,FAuxPropId.FF101501.FDATAVALUE,Flot.FNumber,FDate,FSTOCKERID.fname,FStockId.FNumber,FQty,FFabricOrderNo,FNoteEntry"
+	"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) {
@@ -75,7 +76,7 @@ export function getSearchParam(condition) {
 	let FieldKeys =
 		"FID,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId"
 	console.log(condition.FBillType)
-	if (condition.FBillType != null) { //领料
+	if (condition.FBillType == "d43d7e5b9def82fc11e3e582178e4360") { //领料
 		FilterString.push({
 			"Left": "",
 			"FieldName": "FBillType",
@@ -100,19 +101,44 @@ export function getSearchParam(condition) {
 		FieldKeys =
 			"FID,FWorkCenterId.fname,FPickingPeople_LT.fname,FSTOCKERID.fname,FBillNo,FDate,FNote,FStockOrgId,FDeptId.FName,FPickerId.FName"
 	}
-	if (condition.FormId == "SP_PickMtrl") { //简单生产领料单
+	if (condition.FormId == "SP_PickMtrl" && condition.FBillType !=='B') { //简单生产领料单
+	FilterString.push({
+		"Left": "",
+		"FieldName": "FCollectStatus_LT",
+		"Compare": "106",
+		"Value": "B",
+		"Right": "",
+		"Logic": 0
+	});
 		FieldKeys =
-			"FID,FWorkCenterId.fname,FPickerId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId,FPickingPeople_LT.FName"
+			"FID,FWorkCenterId.fname,FPickerId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId,FPickingPeople_LT.FName,FCollectStatus_LT"
+	}
+	if (condition.FormId == "SP_PickMtrl" && condition.FBillType =='B') { //简单生产领料单(智能)
+	FilterString.push({
+		"Left": "",
+		"FieldName": "FCollectStatus_LT",
+		"Compare": "105",
+		"Value": "B",
+		"Right": "",
+		"Logic": 0
+	});
+		FieldKeys =
+			"FID,FWorkCenterId.fname,FPickerId.fname,FSTOCKERID.fname,FBillNo,FDate,FDescription,FStockOrgId,FPickingPeople_LT.FName,FCollectStatus_LT"
 	}
 	if (condition.FormId == "PUR_MRB") { //采购退料单
 		FieldKeys =
 			"FID,FSupplierID.fname,FPURCHASERID.fname,FPURCHASEDEPTID.fname,FSTOCKERID.fname,FBillNo,FDate,FStockOrgId"
 	}
-	if (condition.FormId == "STK_OEMInStockRETURN") { //
+	if (condition.FormId == "STK_OEMInStockRETURN") {
 		FieldKeys =
 			"FID,FCustId.FName,FDeptId_LT.FName,FBillNo,FSTOCKERID.fname,FDate,FNote,FStockOrgId"
 	}
+	if (condition.FormId == "SAL_OUTSTOCK") { //销售出库
+		FieldKeys =
+			"FID,FBillNo,FCustomerID.FName,FSalesManID.FName,FSaleDeptID.FName,FSTOCKERID.fname,FDate"
+	}
 	console.log(FieldKeys)
+	console.log(FilterString)
 
 	return {
 		"parameters": [{
@@ -124,10 +150,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,
-			"FieldKeys": FieldKeysMap[condition.FormId],
+			"FieldKeys": FieldKeys,
 			"FilterString": [{
 				"Left": "",
 				"FieldName": "FID",
@@ -167,81 +197,171 @@ export function createInventoryQueryRequest(value) {
 	};
 }
 
-function getActualQtyKey(FormId) {
-	const keyMap = {
-		'LT_PRD_PMCWorkBench': 'FActualQty',
-		'SP_PickMtrl': 'FActualQty',
-		'STK_MisDelivery': 'FQty',
-		'PUR_MRB': 'FRMREALQTY'
-	};
-	return keyMap[FormId] || 'FQty';
-}
-
-function createEntityObject(item, actualQtyKey) {
-	return {
-		"FEntryID": item["FEntity.FEntryID"],
-		"FInventoryQty": item["FInventoryQty"],
-		"FAuxPropId": {
-			"FAUXPROPID__FF101501": {
-				"FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
-			}
-		},
-		"FStockLocId": {
-			"FSTOCKLOCID__FF102029": {
-				"Fname": item["FStockLocId.FF102029.fname"]
-			}
-		},
-		"FLot": {
-			"FNumber": item["Flot.FNumber"]
-		},
-		"FENCHASENUM_LT": item["FENCHASENUM.LT"],
-		[actualQtyKey]: item[actualQtyKey] // 使用动态键名
-	};
-}
-
-export function getSaveParam(FormId, data, indexList) {
-	const targetFID = data;
-	const actualQtyKey = getActualQtyKey(FormId);
-
-	const FEntityObjects = indexList
-		.filter(item => item.FID === targetFID)
-		.map(item => createEntityObject(item, actualQtyKey));
-
-	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,
-					"FEntity": FEntityObjects
-				}
-			}
-		]
-	};
+function getActualQtyKey(FormId) {
+	const keyMap = {
+		'LT_PRD_PMCWorkBench': 'FActualQty',
+		'SP_PickMtrl': 'FActualQty',
+		'STK_MisDelivery': 'FQty',
+		'PUR_MRB': 'FRMREALQTY',
+		'SAL_OUTSTOCK': 'FRealQty',
+	};
+	return keyMap[FormId] || 'FQty';
+}
+
+function getFInventoryQtyKey(FormId) {
+	const keyMap = {
+		'SAL_OUTSTOCK': 'FInventoryQty.LT',
+	};
+	return keyMap[FormId] || 'FInventoryQty';
+}
+
+function getStockLocIdKey(FormId) {
+	const keyMap = {
+		'SAL_OUTSTOCK': 'FName',
+	};
+	return keyMap[FormId] || 'FNumber';
+}
+
+function getEntityKey(FormId) {
+	const keyMap = {
+		'STK_OEMInStockRETURN': 'FBillEntry',
+	};
+	return keyMap[FormId] || 'FEntity';
+}
+
+function createEntityObject(item, actualQtyKey, entityKey, InventoryQtyKey,StockLocIdKey) {
+	return {
+		"FEntryID": item[entityKey + ".FEntryID"],
+		[InventoryQtyKey]: item[InventoryQtyKey],
+		"FAuxPropId": {
+			"FAUXPROPID__FF101501": {
+				"FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
+			}
+		},
+		"FStockLocId": {
+			"FSTOCKLOCID__FF102029": {
+				[StockLocIdKey]: item["FStockLocId.FF102029.fname"]
+			}
+		},
+		"FLot": {
+			"FNumber": item["Flot.FNumber"]
+		},
+		"FENCHASENUM_LT": item["FENCHASENUM.LT"],
+		[actualQtyKey]: item[actualQtyKey] // 使用动态键名
+	};
+}
+function createEntityObject2(item) {
+	return {
+		"FEntryID": item["FSumEntity.FEntryID"],
+		"FSumAuxPropId": {
+			"FSUMAUXPROPID__FF101501": {
+				"FNumber": item["FSumAuxPropId.FF101501.FDATAVALUE"]
+			}
+		},
+		"FSumStockLocId": {
+			"FSUMSTOCKLOCID__FF102029": {
+				"FNumber": item["FSumStockLocId.FF102029.fname"]
+			}
+		},
+		"FSumLot": {
+			"FNumber": item["FSumLot.FNumber"]
+		},
+		"FSumEnchaseNum_LT": item["FSumEnchaseNum.LT"],
+		"FSumActualQty": item["FSumActualQty"] 
+	};
+}
+
+export function getSaveParam(FormId, data, indexList) {
+	const targetFID = data;
+	const actualQtyKey = getActualQtyKey(FormId);
+	const InventoryQtyKey = getFInventoryQtyKey(FormId);
+	const entityKey = getEntityKey(FormId);
+	const StockLocIdKey = getStockLocIdKey(FormId);
+	const FEntityObjects = indexList
+		.filter(item => item.FID === targetFID)
+		.map(item => createEntityObject(item, actualQtyKey, entityKey, InventoryQtyKey,StockLocIdKey));
+
+	const needUpdateFields = [
+		InventoryQtyKey,
+		"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,
+					[entityKey]: FEntityObjects
+				}
+			}
+		]
+	};
+}
+export function get2SaveParam(FormId, data, indexList) {
+	const targetFID = data;
+	// const actualQtyKey = getActualQtyKey(FormId);
+	// const InventoryQtyKey = getFInventoryQtyKey(FormId);
+	const entityKey = getEntityKey(FormId);
+	// const StockLocIdKey = getStockLocIdKey(FormId);
+	const FEntityObjects = indexList
+		.filter(item => item.FID === targetFID)
+		.map(item => createEntityObject2(item));
+
+	const needUpdateFields = [
+		// InventoryQtyKey,
+		"FSumAuxPropId",
+		"FSumStockLocId",
+		"FIsScanFabric",
+		"FSumLot",
+		"FSumEnchaseNum_LT",
+		"FSumActualQty" // 直接添加到数组中
+	];
+
+	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,
+					"FSumEntity": FEntityObjects
+				}
+			}
+		]
+	};
 }
 export function getSubmitParam(FormId, data) {
 	const params = {