ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue
@@ -92,7 +92,7 @@ </div> <!-- æå å¼¹çª --> <div v-if="showCustomSplitDialog" class="custom-dialog-overlay"> <div v-show="showCustomSplitDialog" class="custom-dialog-overlay"> <div class="custom-dialog-wrapper"> <div class="custom-dialog"> <div class="custom-dialog-header"> @@ -154,7 +154,7 @@ </div> <!-- æ¤éæå å¼¹çª --> <div v-if="showRevertSplitDialog" class="custom-dialog-overlay"> <div v-show="showRevertSplitDialog" class="custom-dialog-overlay"> <div class="custom-dialog-wrapper"> <div class="custom-dialog"> <div class="custom-dialog-header"> @@ -214,7 +214,7 @@ </div> <!-- æå é¾ä¿¡æ¯å¼¹çª --> <div v-if="showSplitChainDialog" class="custom-dialog-overlay"> <div v-show="showSplitChainDialog" class="custom-dialog-overlay"> <div class="custom-dialog-wrapper"> <div class="custom-dialog" style="width: 750px;"> <div class="custom-dialog-header"> @@ -501,11 +501,87 @@ { required: true, message: '请è¾å ¥æçç ', trigger: 'blur' } ] }, // å¼¹çªç¶æ - æ¹ä¸ºä½¿ç¨å¯¹è±¡ç®¡çï¼é¿å åæ¶æå¼å¤ä¸ªå¼¹çª dialogs: { customSplit: false, revertSplit: false, splitChain: false, batchReturn: false, emptyPallet: false }, // å è½½ç¶æ loading: { split: false, revertSplit: false, batchReturn: false, emptyPallet: false, splitChain: false }, // å½åæ´»å¨çå¼¹çªç±»å activeDialog: null, isProcessing: false } }, computed: { // 计ç®å±æ§æ å°å°dialogs对象 showCustomSplitDialog: { get() { return this.dialogs.customSplit; }, set(val) { this.dialogs.customSplit = val; this.activeDialog = val ? 'customSplit' : null; } }, showRevertSplitDialog: { get() { return this.dialogs.revertSplit; }, set(val) { this.dialogs.revertSplit = val; this.activeDialog = val ? 'revertSplit' : null; } }, showSplitChainDialog: { get() { return this.dialogs.splitChain; }, set(val) { this.dialogs.splitChain = val; this.activeDialog = val ? 'splitChain' : null; } }, showBatchReturnDialog: { get() { return this.dialogs.batchReturn; }, set(val) { this.dialogs.batchReturn = val; this.activeDialog = val ? 'batchReturn' : null; } }, showEmptyPalletDialog: { get() { return this.dialogs.emptyPallet; }, set(val) { this.dialogs.emptyPallet = val; this.activeDialog = val ? 'emptyPallet' : null; }, }, // å è½½ç¶ææ å° splitLoading: { get() { return this.loading.split; }, set(val) { this.loading.split = val; } }, revertSplitLoading: { get() { return this.loading.revertSplit; }, set(val) { this.loading.revertSplit = val; } }, batchReturnLoading: { get() { return this.loading.batchReturn; }, set(val) { this.loading.batchReturn = val; } }, emptypalletOutLoading: { get() { return this.loading.emptyPallet; }, set(val) { this.loading.emptyPallet = val; } }, splitChainLoading: { get() { return this.loading.splitChain; }, set(val) { this.loading.splitChain = val; } }, // æ¯å¦å¯ä»¥åæ¶æ´ä¸ªæå é¾ canCancelWholeChain() { return this.splitChainInfo.splitChain && @@ -574,10 +650,23 @@ this.$message.warning('è¯·å æ«ææçç '); return; } // å ³éå ¶ä»ææå¼¹çª this.closeAllDialogs(); // å»¶è¿æå¼æ°å¼¹çªï¼ç¡®ä¿å ¶ä»å¼¹çªå®å ¨å ³é this.$nextTick(() => { this.showCustomSplitDialog = true; this.resetSplitForm(); this.splitForm.orderNo = this.scanData.orderNo; this.splitForm.palletCode = this.scanData.palletCode; // ç¡®ä¿è¾å ¥æ¡è·å¾ç¦ç¹ this.$nextTick(() => { const inputs = document.querySelectorAll('.custom-dialog input'); if (inputs.length > 0) { inputs[0].focus(); } }); }); }, async onSplitBarcodeScan() { @@ -608,8 +697,9 @@ async handleSplitPackage() { if (this.$refs.splitFormRef) { this.$refs.splitFormRef.validate(async (valid) => { if (valid) { const valid = await this.$refs.splitFormRef.validate(); if (!valid) return; this.splitLoading = true; try { const res = await http.post('/api/OutboundBatchPicking/split-package', { @@ -626,12 +716,10 @@ this.$message.error(res.message || 'æå 失败'); } } catch (error) { this.$message.error('æå 失败'); this.$message.error('æå 失败: ' + (error.message || 'ç½ç»é误')); } finally { this.splitLoading = false; } } }); } }, // 卿å å¼¹çªä¸æ¥çæå é¾ @@ -653,15 +741,13 @@ async onRevertSplitBarcodeScan() { if (!this.revertSplitForm.newBarcode) return; this.revertSplitForm.newBarcode = this.revertSplitForm.newBarcode.replace(/\n/g, '').trim(); // æ°å¢ï¼æ«æåèªå¨æ¾ç¤ºæå é¾ä¿¡æ¯ await this.viewSplitChain(this.revertSplitForm.newBarcode); }, async handleRevertSplit() { if (this.$refs.revertSplitFormRef) { this.$refs.revertSplitFormRef.validate(async (valid) => { if (valid) { const valid = await this.$refs.revertSplitFormRef.validate(); if (!valid) return; this.revertSplitLoading = true; try { const res = await http.post('/api/OutboundBatchPicking/cancel-split', { @@ -677,12 +763,10 @@ this.$message.error(res.message || 'æ¤éæå 失败'); } } catch (error) { this.$message.error('æ¤éæå 失败'); this.$message.error('æ¤éæå 失败: ' + (error.message || 'ç½ç»é误')); } finally { this.revertSplitLoading = false; } } }); } }, // æ¥æ¾å®æ´æå é¾ï¼ä»æ ¹æ¡ç å¼å§ï¼ @@ -724,7 +808,13 @@ if (res.status) { this.splitChainInfo = res.data; // æ¾ç¤ºæç¤ºä¿¡æ¯ï¼åè¯ç¨æ·è¿æ¯ä»ä¹ç±»åçæå é¾ // å ³éå ¶ä»å¼¹çªååæå¼æå é¾å¼¹çª this.closeAllDialogs(); await this.$nextTick(() => { this.showSplitChainDialog = true; // æ¾ç¤ºæç¤ºä¿¡æ¯ let chainType = "å½åæ¡ç çæå é¾"; if (this.splitChainInfo.chainType === 'root') { chainType = "宿´æå é¾ï¼ä»åå§æ¡ç å¼å§ï¼"; @@ -733,12 +823,12 @@ } this.$message.info(`å·²å è½½${chainType}ï¼å ±${this.splitChainInfo.totalSplitTimes}次æå `); this.showSplitChainDialog = true; }); } else { this.$message.error(res.message || 'è·åæå é¾ä¿¡æ¯å¤±è´¥'); } } catch (error) { this.$message.error('è·åæå é¾ä¿¡æ¯å¤±è´¥'); this.$message.error('è·åæå é¾ä¿¡æ¯å¤±è´¥: ' + (error.message || 'ç½ç»é误')); } finally { this.splitChainLoading = false; } @@ -788,20 +878,15 @@ }, // åæ¶å个æå è®°å½ async cancelSingleSplit(newBarcode) { // å è®°å½å½åä¿¡æ¯ï¼ç¶åå ³éå¼¹çª const originalBarcode = this.splitChainInfo.originalBarcode; this.closeSplitChainDialog(); await this.$nextTick(); try { await this.$confirm( await ElMessageBox.confirm( `ç¡®å®è¦åæ¶æ¡ç ${newBarcode} çæå æä½åï¼`, 'åæ¶å个æå ', { confirmButtonText: 'ç¡®å®åæ¶', cancelButtonText: 'åæ³æ³', type: 'warning' type: 'warning', customClass: 'message-box-top' } ); @@ -816,19 +901,17 @@ if (res.status) { this.$message.success('åæ¶æå æå'); await this.loadPalletData(); // éæ°æå¼å¼¹çªæ¾ç¤ºæ´æ°åçç¶æ await this.viewSplitChain(originalBarcode); // éæ°å è½½æå é¾ä¿¡æ¯ if (this.splitChainInfo.originalBarcode) { await this.viewSplitChain(this.splitChainInfo.originalBarcode); } } else { this.$message.error(res.message || 'åæ¶æå 失败'); await this.viewSplitChain(originalBarcode); } } catch (error) { if (error === 'cancel') { // ç¨æ·åæ¶åéæ°æå¼å¼¹çª await this.viewSplitChain(originalBarcode); } else { this.$message.error('åæ¶æå 失败'); await this.viewSplitChain(originalBarcode); if (error !== 'cancel') { this.$message.error('åæ¶æå 失败: ' + error.message); } } finally { this.revertSplitLoading = false; @@ -837,59 +920,40 @@ // åæ¶æ´ä¸ªæå é¾ async cancelWholeSplitChain() { // å è®°å½å½åæå é¾ä¿¡æ¯ï¼ç¶åå ³éå¼¹çª const originalBarcode = this.splitChainInfo.originalBarcode; this.closeSplitChainDialog(); // ç»ä¸ç¹æ¶é´è®©å¼¹çªå®å ¨å ³é await this.$nextTick(); if (!this.canCancelWholeChain) return; try { // ç°å¨æ¾ç¤ºç¡®è®¤å¯¹è¯æ¡ï¼ç¡®ä¿å®å¨æåé¢ await this.$confirm( `ç¡®å®è¦åæ¶æ´ä¸ªæå é¾åï¼\nè¿å°åæ¶ä»æ¡ç ${originalBarcode} å¼å§çæææå æä½ã`, await ElMessageBox.confirm( `ç¡®å®è¦åæ¶æ´ä¸ªæå é¾åï¼\nè¿å°åæ¶ä»æ¡ç ${this.splitChainInfo.originalBarcode} å¼å§çæææå æä½ã`, 'åæ¶æå é¾ç¡®è®¤', { confirmButtonText: 'ç¡®å®åæ¶', cancelButtonText: 'åæ³æ³', type: 'warning', center: true, closeOnClickModal: false closeOnClickModal: false, customClass: 'message-box-top' } ); // ç¨æ·ç¡®è®¤åæ§è¡åæ¶æä½ this.revertSplitLoading = true; const res = await http.post('/api/OutboundBatchPicking/cancel-split-chain', { orderNo: this.scanData.orderNo, palletCode: this.scanData.palletCode, startBarcode: originalBarcode startBarcode: this.splitChainInfo.originalBarcode }); console.log('åæ¶æå é¾ååº:', res); if (res.status) { this.$message.success('åæ¶æå 龿å'); this.closeSplitChainDialog(); await this.loadPalletData(); // å¯éï¼éæ°æå¼æå é¾ä¿¡æ¯å¼¹çªæ¾ç¤ºæ´æ°åçç¶æ // await this.viewSplitChain(originalBarcode); } else { this.$message.error(res.message || 'åæ¶æå é¾å¤±è´¥'); // 失败åéæ°æå¼å¼¹çª await this.viewSplitChain(originalBarcode); } } catch (error) { // ç¨æ·åæ¶æä½ if (error === 'cancel') { console.log('ç¨æ·åæ¶äºæå 龿ä½'); // ç¨æ·åæ¶åéæ°æå¼å¼¹çª await this.viewSplitChain(originalBarcode); } else { console.error('åæ¶æå é¾é误:', error); if (error !== 'cancel') { this.$message.error('åæ¶æå é¾å¤±è´¥: ' + error.message); // åºéåéæ°æå¼å¼¹çª await this.viewSplitChain(originalBarcode); } } finally { this.revertSplitLoading = false; @@ -907,18 +971,31 @@ const date = new Date(dateTime); return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`; }, closeAllDialogs() { this.showCustomSplitDialog = false; this.showRevertSplitDialog = false; this.showSplitChainDialog = false; this.showBatchReturnDialog = false; this.showEmptyPalletDialog = false; this.activeDialog = null; }, // ååºç¸å ³æ¹æ³ openBatchReturnDialog() { if (!this.scanData.palletCode) { this.$message.warning('è¯·å æ«ææçç '); return; } // å ³éå ¶ä»å¼¹çª this.closeAllDialogs(); this.$nextTick(() => { this.showBatchReturnDialog = true; this.batchReturnForm.orderNo = this.scanData.orderNo; this.batchReturnForm.palletCode = this.scanData.palletCode; this.batchReturnForm.unpickedCount = this.summary.unpickedCount; this.batchReturnForm.unpickedQuantity = this.summary.unpickedQuantity; }); }, async handleBatchReturnConfirm() { @@ -936,7 +1013,7 @@ this.$message.error(res.message || 'ååºå¤±è´¥'); } } catch (error) { this.$message.error('ååºå¤±è´¥'); this.$message.error('ååºå¤±è´¥: ' + (error.message || 'ç½ç»é误')); } finally { this.batchReturnLoading = false; } @@ -944,9 +1021,14 @@ // åç©ºç®±æ¹æ³ handleEmptyPallet() { // å ³éå ¶ä»å¼¹çª this.closeAllDialogs(); this.$nextTick(() => { this.showEmptyPalletDialog = true; this.emptypalletOutForm.orderNo = this.scanData.orderNo; this.emptypalletOutForm.palletCode = ''; }); }, async handleEmptyPalletConfirm() { @@ -964,7 +1046,7 @@ this.$message.error(res.message || 'å走空箱失败'); } } catch (error) { this.$message.error('å走空箱失败'); this.$message.error('å走空箱失败: ' + (error.message || 'ç½ç»é误')); } finally { this.emptypalletOutLoading = false; } @@ -974,9 +1056,15 @@ async loadPalletData() { if (!this.scanData.orderNo || !this.scanData.palletCode) return; await this.loadUnpickedList(); await this.loadPickedList(); await this.loadPalletStatus(); try { await Promise.all([ this.loadUnpickedList(), this.loadPickedList(), this.loadPalletStatus() ]); } catch (error) { console.error('å è½½æçæ°æ®å¤±è´¥:', error); } }, async loadUnpickedList() { @@ -986,12 +1074,12 @@ palletCode: this.scanData.palletCode }); if (res.status) { //this.unpickedList = res.data || []; this.unpickedList = (res.data || []).filter(item => item.canPick === true); this.summary.unpickedCount = this.unpickedList.length; this.summary.unpickedQuantity = this.unpickedList.reduce((sum, item) => sum + (item.remainQuantity || 0), 0); } } catch (error) { console.error('å è½½æªæ£éå表失败:', error); this.$message.error('å è½½æªæ£éå表失败'); } }, @@ -1003,19 +1091,14 @@ palletCode: this.scanData.palletCode }); if (res.status) { this.pickedList = res.data || []; this.pickedList = res.data.map(item => { // æ¹å¼1ï¼ä¿çåbarcodeåæ®µï¼æ°å¢currentBarcode return { this.pickedList = res.data.map(item => ({ ...item, currentBarcode: item.barcode }; }); })); this.summary.pickedCount = this.pickedList.length; } } catch (error) { console.error('å 载已æ£éå表失败:', error); this.$message.error('å 载已æ£éå表失败'); } }, @@ -1030,6 +1113,7 @@ this.palletStatus = res.data.statusText || 'æªç¥'; } } catch (error) { console.error('å è½½æçç¶æå¤±è´¥:', error); this.palletStatus = 'æªç¥'; } }, @@ -1074,12 +1158,18 @@ return; } this.$confirm(`ç¡®å®è¦åæ¶éä¸ç ${this.selectedPickedRows.length} 项åï¼`, 'æç¤º', { try { await ElMessageBox.confirm( `ç¡®å®è¦åæ¶éä¸ç ${this.selectedPickedRows.length} 项åï¼`, 'æç¤º', { confirmButtonText: 'ç¡®å®', cancelButtonText: 'åæ¶', type: 'warning' }).then(async () => { try { type: 'warning', customClass: 'message-box-top' } ); for (const row of this.selectedPickedRows) { try { const res = await http.post('/api/OutboundBatchPicking/cancel-picking', { @@ -1098,9 +1188,10 @@ await this.loadPalletData(); this.selectedPickedRows = []; } catch (error) { if (error !== 'cancel') { this.$message.error('æ¹éåæ¶æä½å¤±è´¥'); } }); } }, // éç½®æ¹æ³ @@ -1117,8 +1208,13 @@ }, openRevertSplitDialog() { // å ³éå ¶ä»å¼¹çª this.closeAllDialogs(); this.$nextTick(() => { this.showRevertSplitDialog = true; this.revertSplitForm.newBarcode = ''; }); }, closeRevertSplitDialog() { @@ -1184,15 +1280,20 @@ /* èªå®ä¹å¼¹çªæ ·å¼ */ :deep(.el-message-box) { z-index: 10010 !important; z-index: 9999 !important; } :deep(.el-overlay) { z-index: 10009 !important; z-index: 9998 !important; } :deep(.el-message) { z-index: 10011 !important; z-index: 10000 !important; } /* ç¡®ä¿ç¡®è®¤å¯¹è¯æ¡å¨æåé¢ */ :deep(.message-box-top) { z-index: 10001 !important; } .custom-dialog-overlay { @@ -1205,7 +1306,7 @@ display: flex; align-items: center; justify-content: center; z-index: 2000; /* ä¿æä¸ä¸ªåçç z-index */ z-index: 2000; } .custom-dialog-wrapper { @@ -1276,14 +1377,7 @@ flex-direction: column; align-items: stretch; } /* ç¡®ä¿ç¡®è®¤å¯¹è¯æ¡å¨æåé¢ */ .el-message-box__wrapper { z-index: 10001 !important; } .el-message { z-index: 10002 !important; } .scanner-form .el-input { width: 100%; } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shmBinary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shmBinary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_CheckService/ReCheckOrderService.cs
@@ -92,6 +92,11 @@ { return WebResponseContent.Instance.Error($"æªæ¾å°åä¿¡æ¯"); } var isupdate = false; if (recheckOrder.SignSeq == model.SignSeq) { isupdate = true; } recheckOrder.OrderNo = model.OrderNo; recheckOrder.MaterielCode = model.MaterielCode; recheckOrder.BatchNo = model.BatchNo; @@ -107,14 +112,15 @@ BaseDal.UpdateData(recheckOrder); if (isupdate) { _outboundService.OutboundOrderService.Db.Deleteable<Dt_OutboundOrder>().Where(x => x.OrderNo == model.OrderNo).ExecuteCommand(); _outboundService.OutboundOrderDetailService.Db.Deleteable<Dt_OutboundOrderDetail>() .Where(p => SqlFunc.Subqueryable<Dt_OutboundOrder>().Where(s => s.Id == p.OrderId && s.OrderNo == model.OrderNo).Any()).ExecuteCommand(); var outboundOrders = ConvertToOutboundOrders(model); await _outboundService.OutboundOrderService.ReceiveOutboundOrder(outboundOrders, 1); } return WebResponseContent.Instance.OK(); } catch (Exception ex) ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs
@@ -869,52 +869,235 @@ .WhereIF(whereExpression != null, whereExpression).ToListAsync(); } //public bool DeleteAndMoveIntoHty(TEntity entity, OperateTypeEnum operateType) //{ // Type type = entity.GetType(); // Assembly assembly = type.Assembly; // Type? htyType = assembly.GetType(type.FullName + "_Hty"); // if (htyType != null) // { // object? obj = Activator.CreateInstance(htyType); // PropertyInfo keyPro = typeof(TEntity).GetKeyProperty(); // PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType)); // PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId)); // if (obj != null && keyPro != null && operateTypePro != null && sourceIdPro != null) // { // operateTypePro.SetValue(obj, operateType.ToString()); // sourceIdPro.SetValue(obj, keyPro.GetValue(entity)); // List<PropertyInfo> propertyInfos = htyType.GetProperties().Where(x => x.Name != operateTypePro.Name && x.Name != sourceIdPro.Name && x.Name != keyPro.Name).ToList(); // for (int i = 0; i < propertyInfos.Count; i++) // { // PropertyInfo propertyInfo = propertyInfos[i]; // PropertyInfo? property = type.GetProperty(propertyInfo.Name); // if (property != null) // { // if (propertyInfo.Name == nameof(BaseEntity.Modifier)) // { // propertyInfo.SetValue(obj, App.User.UserId > 0 ? App.User.UserName : "System"); // } // else if (propertyInfo.Name == nameof(BaseEntity.ModifyDate)) // { // propertyInfo.SetValue(obj, DateTime.Now); // } // else // { // propertyInfo.SetValue(obj, property.GetValue(entity)); // } // } // } // if (obj != null) // _db.InsertableByObject(obj).AS(type.Name + "_Hty").ExecuteCommand(); // } // } // return DeleteData(entity); //} public bool DeleteAndMoveIntoHty(TEntity entity, OperateTypeEnum operateType) { Type type = entity.GetType(); Assembly assembly = type.Assembly; Type? htyType = assembly.GetType(type.FullName + "_Hty"); if (htyType != null) { object? obj = Activator.CreateInstance(htyType); PropertyInfo keyPro = typeof(TEntity).GetKeyProperty(); PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType)); PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId)); if (obj != null && keyPro != null && operateTypePro != null && sourceIdPro != null) { operateTypePro.SetValue(obj, operateType.ToString()); sourceIdPro.SetValue(obj, keyPro.GetValue(entity)); // æ ¸å¿é»è¾ï¼ç¨äºå¡ä¿è¯ååæ§ï¼å¼å¸¸æè·é¿å æµç¨ä¸æï¼æ¥å¿è¾ å©ææ¥ bool isSuccess = false; string entityTypeName = entity?.GetType().Name ?? "æªç¥å®ä½"; List<PropertyInfo> propertyInfos = htyType.GetProperties().Where(x => x.Name != operateTypePro.Name && x.Name != sourceIdPro.Name && x.Name != keyPro.Name).ToList(); for (int i = 0; i < propertyInfos.Count; i++) try { PropertyInfo propertyInfo = propertyInfos[i]; PropertyInfo? property = type.GetProperty(propertyInfo.Name); if (property != null) // åç½®æ ¡éªï¼å®ä½ä¸è½ä¸ºç©º if (entity == null) { if (propertyInfo.Name == nameof(BaseEntity.Modifier)) { propertyInfo.SetValue(obj, App.User.UserId > 0 ? App.User.UserName : "System"); return false; } else if (propertyInfo.Name == nameof(BaseEntity.ModifyDate)) Type entityType = entity.GetType(); Assembly assembly = entityType.Assembly; string htyTypeName = $"{entityType.FullName}_Hty"; Type? htyType = assembly.GetType(htyTypeName); // 1. æ£æ¥åå²è¡¨ç±»åæ¯å¦åå¨ if (htyType == null) { propertyInfo.SetValue(obj, DateTime.Now); return false; } // 2. å建åå²è¡¨å®ä¾ï¼å¤çæ åæé 彿°ä¸åå¨çæ åµï¼ object? htyObj; try { htyObj = Activator.CreateInstance(htyType); } catch (Exception ex) { // _logger.LogError(ex, "DeleteAndMoveIntoHtyï¼å建åå²è¡¨å®ä¾ {HtyTypeName} 失败", htyTypeName); return false; } if (htyObj == null) { // _logger.LogWarning("DeleteAndMoveIntoHtyï¼åå²è¡¨å®ä¾ {HtyTypeName} åå»ºç»æä¸ºnull", htyTypeName); return false; } // 3. è·åæ ¸å¿å±æ§ï¼æå®BindingFlagsç¡®ä¿è·åå ¬å ±å®ä¾å±æ§ï¼ BindingFlags propFlags = BindingFlags.Public | BindingFlags.Instance; PropertyInfo? keyPro = typeof(TEntity).GetKeyProperty(); // èªå®ä¹æ¹æ³éç¡®ä¿è¿åéç©ºï¼æ¤å¤å¢å å¤ç©º PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType), propFlags); PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId), propFlags); // æ ¡éªæ ¸å¿å±æ§æ¯å¦åå¨ if (keyPro == null) { //_logger.LogError("DeleteAndMoveIntoHtyï¼å®ä½ {EntityType} æªæ¾å°ä¸»é®å±æ§", entityType.FullName); return false; } if (operateTypePro == null) { //_logger.LogError("DeleteAndMoveIntoHtyï¼åå²è¡¨ {HtyTypeName} æªæ¾å°OperateType屿§", htyTypeName); return false; } if (sourceIdPro == null) { // _logger.LogError("DeleteAndMoveIntoHtyï¼åå²è¡¨ {HtyTypeName} æªæ¾å°SourceId屿§", htyTypeName); return false; } // 4. èµå¼æ ¸å¿å±æ§ï¼æ ¡éªç±»åå¹é ï¼é¿å SetValueæå¼å¸¸ï¼ try { // å¤çOperateTypeç±»åå¹é ï¼è¥åå²è¡¨å±æ§æ¯æä¸¾ç±»åï¼ç´æ¥ä¼ æä¸¾èéå符串 if (operateTypePro.PropertyType == typeof(OperateTypeEnum)) { operateTypePro.SetValue(htyObj, operateType); } else if (operateTypePro.PropertyType == typeof(string)) { operateTypePro.SetValue(htyObj, operateType.ToString()); } else { propertyInfo.SetValue(obj, property.GetValue(entity)); //_logger.LogError("DeleteAndMoveIntoHtyï¼åå²è¡¨ {HtyTypeName} çOperateType屿§ç±»å {PropType} ä¸å¹é ï¼ä» æ¯ææä¸¾/å符串ï¼", htyTypeName, operateTypePro.PropertyType.FullName); return false; } } } if (obj != null) _db.InsertableByObject(obj).AS(type.Name + "_Hty").ExecuteCommand(); } } return DeleteData(entity); // èµå¼SourceIdï¼æ ¡éªç±»åå¹é ï¼ object sourceIdValue = keyPro.GetValue(entity)!; if (sourceIdPro.PropertyType != sourceIdValue.GetType()) { sourceIdValue = Convert.ChangeType(sourceIdValue, sourceIdPro.PropertyType); // ç±»åè½¬æ¢ } sourceIdPro.SetValue(htyObj, sourceIdValue); } catch (Exception ex) { // _logger.LogError(ex, "DeleteAndMoveIntoHtyï¼åå²è¡¨ {HtyTypeName} æ ¸å¿å±æ§èµå¼å¤±è´¥", htyTypeName); return false; } // 5. èµå¼å ¶ä»å±æ§ï¼æé¤æ ¸å¿å±æ§ï¼ List<PropertyInfo> htyProperties = htyType.GetProperties(propFlags) .Where(x => x.Name != operateTypePro.Name && x.Name != sourceIdPro.Name && x.Name != keyPro.Name) .ToList(); foreach (PropertyInfo htyProp in htyProperties) { PropertyInfo? entityProp = entityType.GetProperty(htyProp.Name, propFlags); if (entityProp == null) continue; // å®ä½æ è¯¥å±æ§åè·³è¿ try { object propValue; // å¤çä¿®æ¹äººï¼é¿å App.User空å¼ç¨ if (htyProp.Name == nameof(BaseEntity.Modifier)) { propValue = App.User?.UserId > 0 ? App.User?.UserName : "System"; } // å¤çä¿®æ¹æ¶é´ else if (htyProp.Name == nameof(BaseEntity.ModifyDate)) { propValue = DateTime.Now; } // å ¶ä»å±æ§ä»åå®ä½åå¼ else { propValue = entityProp.GetValue(entity) ?? DBNull.Value; // å¤çnullå¼ } // ç±»å转æ¢åèµå¼ï¼é¿å ç±»åä¸å¹é ï¼ if (propValue != DBNull.Value && propValue != null) { propValue = Convert.ChangeType(propValue, htyProp.PropertyType); } htyProp.SetValue(htyObj, propValue); } catch (Exception ex) { // _logger.LogWarning(ex, "DeleteAndMoveIntoHtyï¼åå²è¡¨ {HtyTypeName} 屿§ {PropName} èµå¼å¤±è´¥ï¼è·³è¿è¯¥å±æ§", htyTypeName, htyProp.Name); } } try { // æ§è¡æå ¥åå²è¡¨ int insertRows = _db.InsertableByObject(htyObj).AS(entityType.Name + "_Hty").ExecuteCommand(); if (insertRows <= 0) { // _logger.LogError("DeleteAndMoveIntoHtyï¼åå²è¡¨ {HtyTypeName} æå ¥å¤±è´¥ï¼å½±åè¡æ°0ï¼", htyTypeName); _db.InsertableByObject(htyObj).AS(entityType.Name + "_Hty").ExecuteCommand(); return false; } // æå ¥æååæ§è¡å é¤ bool deleteSuccess = DeleteData(entity); if (!deleteSuccess) { //_logger.LogError("DeleteAndMoveIntoHtyï¼å®ä½ {EntityType} å é¤å¤±è´¥", entityType.FullName); DeleteData(entity); return false; } // æäº¤äºå¡ isSuccess = true; //_logger.LogInformation("DeleteAndMoveIntoHtyï¼å®ä½ {EntityType} å·²æåç§»å ¥åå²è¡¨å¹¶å é¤åæ°æ®", entityType.FullName); } catch (Exception ex) { // _logger.LogError(ex, "DeleteAndMoveIntoHtyï¼äºå¡æ§è¡å¤±è´¥ï¼æå ¥åå²è¡¨/å é¤åæ°æ®ï¼", entityType.FullName); return false; } } catch (Exception ex) { // _logger.LogError(ex, "DeleteAndMoveIntoHtyï¼å¤çå®ä½ {EntityTypeName} æ¶åçæªæè·å¼å¸¸", entityTypeName); return false; } return isSuccess; } public bool DeleteAndMoveIntoHty(List<TEntity> entities, OperateTypeEnum operateType) { ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs
@@ -2093,8 +2093,7 @@ { // 1. å é¤åºåæ°é为0çæç»è®°å½ var deleteDetailCount = await _stockInfoDetailService.Db.Deleteable<Dt_StockInfoDetail>() .Where(x => x.StockId == stockId && x.StockQuantity == 0 && (x.Status == StockStatusEmun.åºåºå®æ.ObjToInt() || x.Status == StockStatusEmun.å ¥åºå®æ.ObjToInt())) .Where(x => x.StockId == stockId && x.StockQuantity == 0) .ExecuteCommandAsync(); await _stockInfoService.Db.Deleteable<Dt_StockInfo>() @@ -2978,6 +2977,8 @@ { return content.Error("åªææ¿å°éæ£ç»ææè½å ¥åºï¼"); } } // Dt_InboundOrder inboundOrder = GetInboundOrder(materielGroupDTO.OrderNo); @@ -3046,7 +3047,7 @@ FactoryArea = item.FactoryArea, Status = 0, OrderNo = item.OrderNo, BusinessType = InOrderTypeEnum.InternalAllocat.ObjToInt().ToString() BusinessType = materielGroupDTO.orderTypes.ToString() }); item.WarehouseCode = item.WarehouseCode; ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs
@@ -13,6 +13,8 @@ using WIDESEA_Core; using WIDESEA_Core.Attributes; using WIDESEA_Core.BaseController; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.Enums; using WIDESEA_DTO.Allocate; using WIDESEA_DTO.Inbound; using WIDESEA_DTO.Mes; @@ -42,8 +44,9 @@ private readonly IMaterialUnitService _materialUnitService; private readonly IOutStockLockInfoService _outStockLockInfoService; private readonly IOutboundOrderDetailService _outboundOrderDetailService; private readonly IRepository<Dt_Task> _taskRepository; private readonly ILogger<InboundOrderController> _logger; public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService, IOutStockLockInfoService outStockLockInfoService, IOutboundOrderDetailService outboundOrderDetailService) : base(service) public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService, IOutStockLockInfoService outStockLockInfoService, IOutboundOrderDetailService outboundOrderDetailService, IRepository<Dt_Task> taskRepository) : base(service) { this.erpApiService = erpApiService; _invokeMESService = invokeMESService; @@ -55,20 +58,21 @@ _inboundService = inboundService; _outStockLockInfoService = outStockLockInfoService; _outboundOrderDetailService = outboundOrderDetailService; _taskRepository = taskRepository; } [HttpPost, Route("Test"), AllowAnonymous, MethodParamsValidate] public async Task<WebResponseContent> Test() { var originalTask = _taskRepository.Db.Queryable<Dt_Task>().First(); _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.èªå¨å®æ); // Service.Db.Deleteable<Dt_InboundOrder>().Where(x=>x.UpperOrderNo== "12020251100040").ExecuteCommand(); //_inboundService.InboundOrderDetailService.Db.Deleteable<Dt_InboundOrderDetail>() // .Where(p => SqlFunc.Subqueryable<Dt_InboundOrder>().Where(s => s.Id == p.OrderId && s.UpperOrderNo == "12020251100040").Any()).ExecuteCommand(); var purchaseToStockResult = await _materialUnitService.ConvertPurchaseToStockAsync("100513-00303", 1); //var purchaseToStockResult = await _materialUnitService.ConvertPurchaseToStockAsync("100513-00303", 1); var pdddurchaseToStockResult = await _materialUnitService.ConvertFromToStockAsync("100513-00303", "W013", 1); //var pdddurchaseToStockResult = await _materialUnitService.ConvertFromToStockAsync("100513-00303", "W013", 1); //var sddd = _locationInfoService.AssignLocation(); //var code = sddd.LocationCode;