Kaynağa Gözat

仓位页面修改,保存接口修改

ZL 1 hafta önce
ebeveyn
işleme
4680c9ec40

+ 1 - 1
pages.json

@@ -83,7 +83,7 @@
 		}, {
 			"path": "pages/direct-transfer/index",
 			"style": {
-				"navigationBarTitleText": "直接调拨管理平台"
+				"navigationBarTitleText": "直接调拨"
 				// "navigationStyle": "custom"
 			}
 		},

+ 128 - 47
pages/direct-transfer/index.vue

@@ -10,7 +10,7 @@
 			</view>
 			<view class="button-group" v-else>
 				<button type="default" @click="reset">取消</button>
-				<button type="default" @click="navigateToSearch">提交</button>
+				<button type="default" @click="submit">提交</button>
 			</view>
 			<uni-easyinput prefixIcon="search" :focus="isFocus" v-model="searchValue" @blur="isFocus = false"
 				@confirm="getIsCreate()" @clear="clear" placeholder="请扫描拼件单号">
@@ -24,7 +24,7 @@
 			<scroll-view class="table-content" :style="{'height': clientHeight + 'px'}" scroll-x scroll-y
 				:scroll-into-view="scrollItem">
 				<!-- 表头-正常-->
-				<view class="table-header" v-if="isCreate === false">
+				<view class="table-header" v-if="!isCreate">
 					<view class="table-cell">操作</view>
 					<view class="table-cell">扫描状态</view>
 					<view class="table-cell">调出仓位</view>
@@ -48,38 +48,43 @@
 					<view class="table-cell2">调出仓位</view>
 					<view class="table-cell2">调入仓位</view>
 				</view>
-				<view class="table-row" v-for="(item, index) in indexList" :key="index" :id="'scrollItem-' + index"
-					:style="getStyle(item.smzt)" v-if="isCreate === false">
-					<view class="table-cell">
-						<button type="default" size="mini" @click="edit(item,index)">编辑</button>
-					</view>
-					<view class="table-cell">{{ item.smzt? '已扫描' : '未扫描' }}</view>
-					<view class="table-cell">{{ item["FSrcStockLocId.FF102029.FName"] }}</view>
-					<view class="table-cellwl" :style="getStyle(item.smzt)">{{ item["FMaterialId.FNumber"] }}</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FENCHASENUM.LT"] }}</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FQty"] }}</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FBOXNO.LT"] }}</view>
-					<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FAuxPropId.FF101501.FDataValue"] }}
+				<view v-if="!isCreate">
+					<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-cell">{{ item["FSrcStockLocId.FF102029.FName"] }}</view>
+						<view class="table-cellwl" :style="getStyle(item.smzt)">{{ item["FMaterialId.FNumber"] }}</view>
+						<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FENCHASENUM.LT"] }}</view>
+						<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FQty"] }}</view>
+						<view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FBOXNO.LT"] }}</view>
+						<view class="table-cell1" :style="getStyle(item.smzt)">
+							{{ item["FAuxPropId.FF101501.FDataValue"] }}
+						</view>
+						<view class="table-cellph" :style="getStyle(item.smzt)">{{ item["FLot.FNumber"] }}</view>
+						<view class="table-cell2" :style="getStyle(item.smzt)">{{ item["rowCount"] }}</view>
+						<view class="table-cell" :style="getStyle(item.smzt)">{{ item["FNoteEntry"] }}</view>
+						<view class="table-cell2" :style="getStyle(item.smzt)">{{ item["quantity"] }}</view>
+						<view class="table-cell" :style="getStyle(item.smzt)">{{ item["rowCount"] }}</view>
+						<view class="table-cell3" :style="getStyle(item.smzt)">{{ item["FBillNo"] }}</view>
+						<view class="table-cell" :style="getStyle(item.smzt)">{{ item["FStockerId.FName"] }}</view>
 					</view>
-					<view class="table-cellph" :style="getStyle(item.smzt)">{{ item["FLot.FNumber"] }}</view>
-					<view class="table-cell2" :style="getStyle(item.smzt)">{{ item["rowCount"] }}</view>
-					<view class="table-cell" :style="getStyle(item.smzt)">{{ item["FNoteEntry"] }}</view>
-					<view class="table-cell2" :style="getStyle(item.smzt)">{{ item["quantity"] }}</view>
-					<view class="table-cell" :style="getStyle(item.smzt)">{{ item["rowCount"] }}</view>
-					<view class="table-cell3" :style="getStyle(item.smzt)">{{ item["FBillNo"] }}</view>
-					<view class="table-cell" :style="getStyle(item.smzt)">{{ item["FStockerId.FName"] }}</view>
 				</view>
-				<view class="table-row" v-for="(item, index) in indexList" :key="index" :id="'scrollItem-' + index"
-					:style="getStyle(item.smzt)" v-else>
-					<view class="table-cell">
-						
-						<button type="default" size="mini" @click="edit(item,index)">编辑</button>
-					</view>
-					<view class="table-cell2">{{ item["FCMKBarCode"] }}</view>
-					<view class="table-cell2">{{ item["FStockName"] }}</view>
-					<view class="table-cell2">{{ item["smzt"] }}</view>
+				<view v-else>
+					<view class="table-row" v-for="(item) in indexList" :key="item.FCMKBarCode"
+						:id="'scrollItem-' + item.index">
+						<view class="table-cell">
+							<button type="default" size="mini" @click="edit(item,item.index)">编辑</button>
+						</view>
+						<view class="table-cell2">{{ item["FCMKBarCode"] }}</view>
+						<view class="table-cell2">{{ item["FStockName"] }}</view>
+						<view class="table-cell2">{{ item["FStockId.FName"] }}</view>
 
+					</view>
 				</view>
+
 			</scroll-view>
 		</view>
 
@@ -90,7 +95,7 @@
 					<uni-data-select v-model="loginForm.acctID" :localdata="range" @change="change"
 						:clear="false"></uni-data-select>
 				</view> -->
-				<view v-if="isCreate === false"
+				<view v-if="!isCreate"
 					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>
@@ -215,6 +220,11 @@
 				this.Location = newValue
 				// 可以在这里执行相应的操作
 			},
+			indexList(newValue, oldValue) {
+				console.log(`Location changed from ${oldValue} to ${newValue}`)
+				this.indexList = newValue
+				// 可以在这里执行相应的操作
+			},
 		},
 		data() {
 			return {
@@ -438,7 +448,7 @@
 					let promises = [];
 					// 遍历 uniqueFStockLocId 数组
 					for (let fname of this.uniqueFStockLocId) {
-						
+
 						const requestData = createInventoryQueryRequest(fname)
 
 						// 发起异步请求,并将 promise 存储在数组中
@@ -486,11 +496,21 @@
 				})
 			},
 			edit(item, index) {
-				uni.navigateTo({
-					url: '/pages/direct-transfer/show?item=' + encodeURIComponent(JSON.stringify(
-							item)) +
-						'&&index=' + encodeURIComponent(JSON.stringify(index))
-				});
+				if (this.isCreate) {
+					uni.navigateTo({
+						url: '/pages/direct-transfer/show?isCreate=true&&item=' + encodeURIComponent(JSON
+								.stringify(
+									item)) +
+							'&&index=' + encodeURIComponent(JSON.stringify(index))
+					});
+				} else {
+					uni.navigateTo({
+						url: '/pages/direct-transfer/show?item=' + encodeURIComponent(JSON.stringify(
+								item)) +
+							'&&index=' + encodeURIComponent(JSON.stringify(index))
+					});
+				}
+
 			},
 
 			showDetail(index) {
@@ -511,6 +531,35 @@
 			clear() {
 				this.focusPoint()
 			},
+			submit() {
+				let vm = this
+				uni.showModal({
+					title: "提示",
+					content: "是否生成单据?",
+					showCancel: true,
+					success: function(res) {
+						if (res.confirm) {
+							vm.createSubmit()
+						} else {
+							// 执行取消后的操作
+							vm.$nextTick(() => {
+								vm.searchValue = ''
+								vm.focusPoint();
+							})
+							// return
+						}
+					}
+				})
+				//重置页面
+				// {
+				// 	this.depotList = []
+				// 	this.indexList = []
+				// 	this.searchValue = ""
+				// 	this.balance = 0
+				// 	this.isFocus = true
+				// 	playVoice(audioUrls.warningSuccessUrl)
+				// }
+			},
 			//跳转到查询页面
 			navigateToSearch() {
 				if (this.indexList.length > 0) {
@@ -528,6 +577,7 @@
 					url: `/pages/direct-transfer/search?FormId=${this.formId}&FBillType=${this.fbillType}`
 				});
 
+
 			},
 			navigateToSummary() {
 				uni.navigateTo({
@@ -615,6 +665,17 @@
 				// 	icon: "none"
 				// });
 
+			},
+			async createSubmit() {
+				const FormId = uni.getStorageSync('formId')
+				try {
+					await submitHelper.createSubmit(FormId, this.indexList);
+					this.indexList = [];
+					console.log("提交成功!this.indexList已清空");
+				} catch (error) {
+					this.handleError(error)
+				}
+
 			},
 			async handleSubmit(FID) {
 				const FormId = uni.getStorageSync('formId')
@@ -723,8 +784,11 @@
 			CreateScanSuccess(nowindex) {
 				console.log("扫描完成开始渲染------------", nowindex)
 				this.indexList[nowindex].smzt = 1
-				this.$forceUpdate()
+				this.indexList[nowindex]['FStockId.FNumber'] = 'MLCK006'
+				this.indexList[nowindex]['FStockLocId.FF102029.FNumber'] = '301100206'
+				// this.$forceUpdate()
 				this.$nextTick(() => {
+					console.log("准备刷新---------------", this.indexList)
 					this.searchValue = ''
 					this.isFocus = true;
 					this.scrollToItem("scrollItem-" + nowindex)
@@ -746,8 +810,21 @@
 					return
 				}
 				info.FCMKBarCode = this.searchValue
+				//校验是否重复扫码
+				const isDuplicate = this.indexList.some(item => item.FCMKBarCode === info.FCMKBarCode);
+				if (isDuplicate) {
+					this.$nextTick(() => {
+						console.log("重复扫码---------------", this.indexList)
+						this.searchValue = ''
+						playVoice(audioUrls.successVoiceUrl);
+						this.focusPoint()
+					})
+
+					return;
+				}
 				modal.loading('扫描数据中,请耐心等待...')
 				try {
+
 					//根据条形码找编码
 					const lot = await this.getFLotCode(this.searchValue)
 					if (!lot) {
@@ -797,14 +874,18 @@
 						this.showPicker = true
 						this.indexList.push(info)
 					} else {
+						info.index = this.indexList.length
 						Object.assign(info, stockLoc[0])
-						this.indexList.push(info)
-						this.CreateScanSuccess(this.indexList.length)
+						console.log("不用选择--------------------", info)
+						this.$nextTick(() => {
+							this.indexList.push(info);
+							this.CreateScanSuccess(this.indexList.length - 1);
+						});
 					}
 
 				} finally {
 					modal.closeLoading();
-					console.log("```````````````````",this.indexList)
+					console.log("`````````````结束扫描生成", this.indexList)
 				}
 
 			},
@@ -910,12 +991,12 @@
 				this.Location = e.value[0]
 				const selectedValue = e.value[0];
 				if (this.indexList.length > 0) {
-				            this.$set(this.indexList, this.indexList.length - 1, {
-				                ...this.indexList[this.indexList.length - 1],
-				                FStockName: selectedValue.FStockName,
-				            });
-				        }
-				this.indexList[this.indexList.length - 1].FStockName = e.value[0].FStockName
+					this.$set(this.indexList, this.indexList.length - 1, {
+						...this.indexList[this.indexList.length - 1],
+						...selectedValue,
+					});
+				}
+				// this.indexList[this.indexList.length - 1].FStockName = e.value[0].FStockName
 				console.log('confirm2', this.indexList)
 				this.showPicker = false
 				this.CreateScanSuccess(this.indexList.length - 1)

+ 20 - 25
pages/direct-transfer/show.vue

@@ -3,15 +3,18 @@
 		<uni-section title="">
 			<view class="example">
 				<uni-forms ref="form" :modelValue="item" labelWidth="80px" :rules="rules">
-					<uni-forms-item label="装箱单号" name="FBillNo">
+					<uni-forms-item label="装箱单号" name="FBillNo" v-if="isCreate">
 						<uni-easyinput v-model="item['FENCHASENUM.LT']" disabled>
 						</uni-easyinput>
 					</uni-forms-item>
-					
-					<uni-forms-item label="调拨数量" name="FQty" >
-						<uni-easyinput  v-model="item['FQty']"/>
+
+					<uni-forms-item label="调拨数量" name="FQty" v-if="isCreate">
+						<uni-easyinput v-model="item['FQty']" />
+					</uni-forms-item>
+
+					<uni-forms-item label="调入仓位" name="FQty" v-if="!isCreate">
+						<uni-data-select v-model="destStock" :localdata="destStockList" ></uni-data-select>
 					</uni-forms-item>
-					
 				</uni-forms>
 				<button type="primary" @click="submit()">确认</button>
 			</view>
@@ -32,40 +35,33 @@
 	export default {
 		onLoad(option) {
 			this.formId = uni.getStorageSync("formId")
+			const isCreate = JSON.parse(decodeURIComponent(option.isCreate))
 			const item = JSON.parse(decodeURIComponent(option.item))
 			const index = JSON.parse(decodeURIComponent(option.index))
 			console.log(item)
 			console.log(index)
+			if(isCreate){
+				//加载仓位
+				
+			}
+			this.isCreate = isCreate
 			this.item = item
 			this.index = index
 		},
 		data() {
 			return {
+				isCreate: false,
+				destStockList:[],
+				destStock:'',
 				formId: '',
 				item: {},
 				index: '',
 				isReplace: false,
 				rules: {
-					FActualQty: {
-						rules: [{
-								required: true,
-								errorMessage: '请输入实发数量',
-							},
-
-						]
-					},
 					FQty: {
 						rules: [{
 								required: true,
-								errorMessage: '请输入实发数量',
-							},
-
-						]
-					},
-					FRMREALQTY: {
-						rules: [{
-								required: true,
-								errorMessage: '请输入实际作业数量',
+								errorMessage: '请输入调拨数量',
 							},
 
 						]
@@ -74,7 +70,7 @@
 			};
 		},
 		computed: {
-			
+
 		},
 		methods: {
 			handleError(error) {
@@ -87,8 +83,7 @@
 			submit() {
 				console.log(this.item)
 				this.$refs.form.validate().then(res => {
-					
-					
+
 					this.item["index"] = this.index
 					let self = this
 					uni.navigateBack({

+ 38 - 1
utils/commonSubmitHelper.js

@@ -14,7 +14,10 @@ import {
 	getAuditParam,
 	get2SaveParam
 } from './newparams.js';
-
+import {
+	getCreateSaveParam,
+	getCreateSubmitParam,
+} from './transferparams.js'
 
 export default {
 	async submit(FormId,FID, indexList,fbillType) {
@@ -53,6 +56,40 @@ export default {
 			modal.closeLoading();
 		}
 	},
+	
+	async createSubmit(FormId,indexList) {
+		try {
+			modal.loading("提交中,请耐心等待...");
+			let saveParam; 
+			const username = uni.getStorageSync('HBusername')
+			saveParam = getCreateSaveParam(FormId,username,indexList)
+			
+			console.log(saveParam)
+			const saveRes = await this.saveData(saveParam);
+			if (!saveRes.IsSuccess) {
+				throw new Error(saveRes.Errors[0].Message);
+			}
+			const submitParam = getCreateSubmitParam(FormId,saveRes.SuccessEntitys[0].Id);
+			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))

+ 59 - 20
utils/transferparams.js

@@ -155,12 +155,12 @@ function createEntityObject(item, actualQtyKey) {
 		"FInventoryQty": item["FInventoryQty"],
 		"FAuxPropId": {
 			"FAUXPROPID__FF101501": {
-				"FNumber": item["FAuxPropId.FF101501.FDATAVALUE"]
+				"FNumber": item["FAuxPropId.FF101501.FDATAVALUE"] || item["FAuxPropId.FF101501.FDataValue"]
 			}
 		},
 		"FStockLocId": {
 			"FSTOCKLOCID__FF102029": {
-				"Fname": item["FStockLocId.FF102029.fname"]
+				"Fname": item["FStockLocId.FF102029.fname"] || item["FStockLocId.FF102029.FName"]
 			}
 		},
 		"FLot": {
@@ -171,30 +171,22 @@ function createEntityObject(item, actualQtyKey) {
 	};
 }
 
-export function getSaveParam(FormId, data, indexList) {
+export function getCreateSaveParam(FormId, username, 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 // 直接添加到数组中
-	];
+	
+	const datetime = new Date().toISOString();
 
 	return {
 		"parameters": [
 			FormId,
 			{
-				"NeedUpDateFields": needUpdateFields,
-				"NeedReturnFields": ["FID"],
+				"NeedUpDateFields": [],
+				"NeedReturnFields": [],
 				"IsDeleteEntry": "true",
 				"SubSystemId": "",
 				"IsVerifyBaseDataField": "false",
@@ -207,15 +199,62 @@ export function getSaveParam(FormId, data, indexList) {
 				"IsControlPrecision": "false",
 				"ValidateRepeatJson": "false",
 				"Model": {
-					"FID": targetFID,
-					"FIsScanFabric": true,
-					"FEntity": FEntityObjects
+					"FID": 0,
+					"FBillTypeID": {
+						"FNUMBER": "ZJDB01_SYS"
+					},
+					"FBizType": "NORMAL",
+					"FTransferDirect": "GENERAL",
+					"FTransferBizType": "InnerOrgTransfer",
+					"FStockOutOrgId": {
+						"FNumber": "100"
+					},
+					"FOwnerTypeOutIdHead": "BD_OwnerOrg",
+					"FOwnerOutIdHead": {
+						"FNumber": "100"
+					},
+					"FStockOrgId": {
+						"FNumber": "100"
+					},
+					"FIsIncludedTax": true,
+					"FIsPriceExcludeTax": true,
+					"FExchangeTypeId": {
+						"FNUMBER": "HLTX01_SYS"
+					},
+					"FOwnerTypeIdHead": "BD_OwnerOrg",
+					"FSETTLECURRID": {
+						"FNUMBER": "PRE001"
+					},
+					"FExchangeRate": 1.0,
+					"FOwnerIdHead": {
+						"FNumber": "100"
+					},
+					"FStockerId": {
+						"FNumber": username
+					},
+					"FDate": datetime,
+					"FBaseCurrId": {
+						"FNumber": "PRE001"
+					},
+					"FPrintNum_LT": 0,
+					"FScanType": {
+						"FNumber": "TransferInStockScan"
+					},
+					"FExtTransType_LT": {
+						"FNumber": "ZCFX"
+					},
+					"FWriteOffConsign": false,
+					"FBillEntry": FEntityObjects
 				}
+
+
 			}
 		]
 	};
 }
-export function getSubmitParam(FormId, data) {
+
+
+export function getCreateSubmitParam(FormId, data) {
 	const params = {
 		"parameters": [
 			FormId,
@@ -274,7 +313,7 @@ export function getFLotFNumber(lotCode) {
 	};
 }
 //根据编号批号查即时库存
-export function getInventory(lot,material) {
+export function getInventory(lot, material) {
 	return {
 		parameters: [{
 			FormId: "STK_Inventory",