ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue
@@ -92,7 +92,7 @@ </div> <!-- æå å¼¹çª --> <div v-if="showCustomSplitDialog" class="custom-dialog-overlay"> <div v-if="showCustomSplitDialog" class="custom-dialog-overlay" style="z-index: 2000;"> <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-if="showRevertSplitDialog" class="custom-dialog-overlay" style="z-index: 2001;"> <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-if="showSplitChainDialog" class="custom-dialog-overlay" style="z-index: 2002;"> <div class="custom-dialog-wrapper"> <div class="custom-dialog" style="width: 750px;"> <div class="custom-dialog-header"> @@ -338,7 +338,7 @@ </div> <!-- æ¹éååºå¼¹çª --> <div v-if="showBatchReturnDialog" class="custom-dialog-overlay"> <div v-if="showBatchReturnDialog" class="custom-dialog-overlay" style="z-index: 2003;"> <div class="custom-dialog-wrapper"> <div class="custom-dialog"> <div class="custom-dialog-header"> @@ -370,7 +370,7 @@ </div> <!-- åèµ°ç©ºç®±å¼¹çª --> <div v-if="showEmptyPalletDialog" class="custom-dialog-overlay"> <div v-if="showEmptyPalletDialog" class="custom-dialog-overlay" style="z-index: 2004;"> <div class="custom-dialog-wrapper"> <div class="custom-dialog"> <div class="custom-dialog-header"> @@ -405,11 +405,12 @@ </div> </template> <script> import http from '@/api/http.js' import { ref, defineComponent } from "vue"; import { defineComponent } from "vue"; import { ElMessage } from 'element-plus' import { useRoute } from 'vue-router' import printView from "@/extension/outbound/extend/printView.vue" export default defineComponent({ @@ -417,6 +418,7 @@ components: {printView}, data() { return { // ä¿æææåå§æ°æ®ç»æä¸å... scanData: { orderNo: '', palletCode: '', @@ -432,21 +434,24 @@ }, palletStatus: 'æªç¥', // å¼¹çªç¶æ // å¼¹çªç¶æ - å ³é®ä¿®å¤ï¼åªå 许ä¸ä¸ªå¼¹çªæå¼ activeDialog: null, // 'split', 'revert', 'batchReturn', 'emptyPallet', 'splitChain' showCustomSplitDialog: false, showRevertSplitDialog: false, showBatchReturnDialog: false, showEmptyPalletDialog: false, showSplitChainDialog: false, // æ°å¢ï¼æå é¾ä¿¡æ¯å¼¹çª showSplitChainDialog: false, // æ·»å é²éå¤ç¹å»æ å¿ isOpeningDialog: false, // å è½½ç¶æ splitLoading: false, revertSplitLoading: false, batchReturnLoading: false, emptypalletOutLoading: false, splitChainLoading: false, // æ°å¢ï¼æå é¾å è½½ç¶æ splitChainLoading: false, // è¡¨åæ°æ® // è¡¨åæ°æ®... splitForm: { orderNo: '', palletCode: '', @@ -472,14 +477,13 @@ palletCode: '' }, // æ°å¢ï¼æå é¾ç¸å ³æ°æ® splitChainInfo: { originalBarcode: '', totalSplitTimes: 0, splitChain: [] }, // éªè¯è§å // éªè¯è§å... splitFormRules: { originalBarcode: [ { required: true, message: '请è¾å ¥åæ¡ç ', trigger: 'blur' } @@ -505,8 +509,17 @@ isProcessing: false } }, watch: { // å ³é®ä¿®å¤ï¼ç¡®ä¿å䏿¶é´åªæä¸ä¸ªå¼¹çªæå¼ activeDialog(newVal, oldVal) { this.showCustomSplitDialog = newVal === 'split' this.showRevertSplitDialog = newVal === 'revert' this.showBatchReturnDialog = newVal === 'batchReturn' this.showEmptyPalletDialog = newVal === 'emptyPallet' this.showSplitChainDialog = newVal === 'splitChain' } }, computed: { // æ¯å¦å¯ä»¥åæ¶æ´ä¸ªæå é¾ canCancelWholeChain() { return this.splitChainInfo.splitChain && this.splitChainInfo.splitChain.some(item => !item.isReverted); @@ -519,9 +532,13 @@ this.batchReturnForm.orderNo = this.$route.query.orderNo; this.emptypalletOutForm.orderNo = this.$route.query.orderNo; } this.$nextTick(() => { this.$refs.palletInput.focus(); // ä½¿ç¨ requestAnimationFrame ç¡®ä¿é¡µé¢å®å ¨å è½½ requestAnimationFrame(() => { if (this.$refs.palletInput) { this.$refs.palletInput.focus(); } }); }, methods: { goBack(){ @@ -568,16 +585,445 @@ } }, // æå ç¸å ³æ¹æ³ openSplitDialog() { openSplitDialog() { console.log('ç´§æ¥ä¿®å¤çï¼æå¼æå å¼¹çª'); if (!this.scanData.palletCode) { this.$message.warning('è¯·å æ«ææçç '); return; } this.showCustomSplitDialog = true; this.resetSplitForm(); this.splitForm.orderNo = this.scanData.orderNo; this.splitForm.palletCode = this.scanData.palletCode; // 1. å ³éææVueå¼¹çª this.closeAllDialogs(); // 2. 强å¶ä»DOMä¸ç§»é¤ææå¼¹çª setTimeout(() => { const dialogs = document.querySelectorAll('.custom-dialog-overlay'); dialogs.forEach(dialog => { if (dialog.parentNode) { dialog.parentNode.removeChild(dialog); } }); // 妿已ç»å卿å¨å¼¹çªï¼å ç§»é¤ if (this.manualDialog && this.manualDialog.parentNode) { this.manualDialog.parentNode.removeChild(this.manualDialog); } // 3. çå¾ ä¸å¸§ requestAnimationFrame(() => { // 4. ç´æ¥å建æ°å¼¹çªï¼ä¸ä¾èµVueçååºå¼ç³»ç» this.createManualSplitDialog(); }); }, 10); }, // å建æå¨æå å¼¹çª createManualSplitDialog() { const newDialog = document.createElement('div'); newDialog.className = 'custom-dialog-overlay emergency-fix'; // çæéæºIDç¨äºäºä»¶ç»å® const dialogId = 'manual-dialog-' + Date.now(); newDialog.id = dialogId; // åå¨å¼ç¨ this.manualDialog = newDialog; // å¼¹çªå 容 newDialog.innerHTML = ` <div class="custom-dialog-wrapper"> <div class="custom-dialog" style="width: 500px;"> <div class="custom-dialog-header"> <h3 style="margin: 0; color: #303133;">æå æä½</h3> <button class="close-button" onclick="document.getElementById('${dialogId}').remove()" style=" font-size: 18px; color: #909399; padding: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; ">Ã</button> </div> <div class="custom-dialog-body" style="padding: 20px;"> <div style="margin-bottom: 15px;"> <div style="display: flex; align-items: center; margin-bottom: 5px;"> <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">订åç¼å·:</span> <input type="text" value="${this.scanData.orderNo}" disabled style=" flex: 1; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px; background-color: #f5f7fa; color: #909399; "> </div> </div> <div style="margin-bottom: 15px;"> <div style="display: flex; align-items: center; margin-bottom: 5px;"> <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">æçç¼å·:</span> <input type="text" value="${this.scanData.palletCode}" disabled style=" flex: 1; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px; background-color: #f5f7fa; color: #909399; "> </div> </div> <div style="margin-bottom: 15px;"> <div style="display: flex; align-items: center; margin-bottom: 5px;"> <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">åæ¡ç :</span> <div style="flex: 1; display: flex; align-items: center; gap: 10px;"> <input type="text" id="${dialogId}-barcode" placeholder="æ«æåæ¡ç " style=" flex: 1; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px; "> <button id="${dialogId}-viewChain" style=" padding: 8px 16px; background: #409eff; color: white; border: none; border-radius: 4px; cursor: pointer; white-space: nowrap; ">æ¥çæå é¾</button> </div> </div> </div> <div style="margin-bottom: 15px;"> <div style="display: flex; align-items: center; margin-bottom: 5px;"> <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">ç©æç¼ç :</span> <input type="text" id="${dialogId}-materiel" disabled style=" flex: 1; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px; background-color: #f5f7fa; color: #909399; "> </div> </div> <div style="margin-bottom: 15px;"> <div style="display: flex; align-items: center; margin-bottom: 5px;"> <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">å©ä½æ°é:</span> <input type="text" id="${dialogId}-remain" disabled style=" flex: 1; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px; background-color: #f5f7fa; color: #909399; "> </div> </div> <div style="margin-bottom: 15px;"> <div style="display: flex; align-items: center; margin-bottom: 5px;"> <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">æå æ°é:</span> <div style="flex: 1;"> <input type="number" id="${dialogId}-splitQty" value="1" min="0.01" step="0.01" style=" width: 100%; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px; "> </div> </div> </div> </div> <div class="custom-dialog-footer" style=" padding: 10px 20px 20px; text-align: right; border-top: 1px solid #ebeef5; "> <button id="${dialogId}-cancel" style=" padding: 9px 15px; background: white; color: #606266; border: 1px solid #dcdfe6; border-radius: 4px; cursor: pointer; margin-right: 10px; ">åæ¶</button> <button id="${dialogId}-confirm" style=" padding: 9px 15px; background: #409eff; color: white; border: none; border-radius: 4px; cursor: pointer; ">确认æå </button> </div> </div> </div> `; // æ·»å æ ·å¼ newDialog.style.cssText = ` position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 999999; `; // å¼¹çªå®¹å¨æ ·å¼ const wrapper = newDialog.querySelector('.custom-dialog-wrapper'); if (wrapper) { wrapper.style.position = 'relative'; wrapper.style.zIndex = '1000000'; } // å¼¹çªå å®¹æ ·å¼ const dialog = newDialog.querySelector('.custom-dialog'); if (dialog) { dialog.style.background = 'white'; dialog.style.borderRadius = '4px'; dialog.style.maxWidth = '90vw'; dialog.style.maxHeight = '90vh'; dialog.style.boxShadow = '0 2px 12px 0 rgba(0, 0, 0, 0.1)'; dialog.style.overflow = 'auto'; } // å¼¹çªå¤´é¨æ ·å¼ const header = newDialog.querySelector('.custom-dialog-header'); if (header) { header.style.display = 'flex'; header.style.justifyContent = 'space-between'; header.style.alignItems = 'center'; header.style.padding = '20px 20px 10px'; header.style.borderBottom = '1px solid #ebeef5'; } document.body.appendChild(newDialog); console.log('ç´§æ¥å¼¹çªå·²å建'); // ç»å®äºä»¶ this.bindManualDialogEvents(dialogId); // èªå¨èç¦å°æ¡ç è¾å ¥æ¡ setTimeout(() => { const barcodeInput = document.getElementById(`${dialogId}-barcode`); if (barcodeInput) { barcodeInput.focus(); // æ·»å å车é®çå¬ barcodeInput.addEventListener('keyup', (event) => { if (event.key === 'Enter') { this.onManualSplitBarcodeScan(dialogId); } }); } }, 100); }, // ç»å®æå¨å¼¹çªäºä»¶ bindManualDialogEvents(dialogId) { const vm = this; // ä¿åVueå®ä¾å¼ç¨ // æ¥çæå é¾æé® const viewChainBtn = document.getElementById(`${dialogId}-viewChain`); if (viewChainBtn) { viewChainBtn.onclick = () => { const barcodeInput = document.getElementById(`${dialogId}-barcode`); if (barcodeInput && barcodeInput.value.trim()) { vm.viewSplitChainFromManualDialog(barcodeInput.value.trim(), dialogId); } else { ElMessage.warning('请å è¾å ¥æ¡ç '); } }; } // åæ¶æé® const cancelBtn = document.getElementById(`${dialogId}-cancel`); if (cancelBtn) { cancelBtn.onclick = () => { const dialog = document.getElementById(dialogId); if (dialog && dialog.parentNode) { dialog.parentNode.removeChild(dialog); } }; } // 确认æå æé® const confirmBtn = document.getElementById(`${dialogId}-confirm`); if (confirmBtn) { confirmBtn.onclick = () => { vm.handleManualSplitPackage(dialogId); }; } // æ¡ç è¾å ¥æ¡ååäºä»¶ const barcodeInput = document.getElementById(`${dialogId}-barcode`); if (barcodeInput) { // 鲿å¤ç let timeout; barcodeInput.addEventListener('input', () => { clearTimeout(timeout); timeout = setTimeout(() => { if (barcodeInput.value.trim()) { vm.onManualSplitBarcodeScan(dialogId); } }, 500); }); } }, // æå¨å¼¹çªçæ¡ç æ«æå¤ç async onManualSplitBarcodeScan(dialogId) { const barcodeInput = document.getElementById(`${dialogId}-barcode`); if (!barcodeInput || !barcodeInput.value.trim()) return; const barcode = barcodeInput.value.trim(); try { const res = await http.post('/api/OutboundBatchPicking/split-package-info', { orderNo: this.scanData.orderNo, palletCode: this.scanData.palletCode, barcode: barcode }); if (res.status) { // æ´æ°ç©æç¼ç const materielInput = document.getElementById(`${dialogId}-materiel`); if (materielInput) { materielInput.value = res.data.materielCode || ''; } // æ´æ°å©ä½æ°é const remainInput = document.getElementById(`${dialogId}-remain`); if (remainInput) { remainInput.value = res.data.remainQuantity || 0; } // æ´æ°æå æ°éï¼é»è®¤ä¸º1ï¼ä¸è¶ è¿å©ä½æ°éï¼ const splitQtyInput = document.getElementById(`${dialogId}-splitQty`); if (splitQtyInput) { const maxQty = res.data.remainQuantity || 0; splitQtyInput.max = maxQty; const currentVal = parseFloat(splitQtyInput.value) || 1; if (currentVal > maxQty) { splitQtyInput.value = Math.min(1, maxQty); } } } else { ElMessage.error(res.message || 'è·åæå ä¿¡æ¯å¤±è´¥'); } } catch (error) { console.error('è·åæå ä¿¡æ¯å¤±è´¥:', error); ElMessage.error('è·åæå ä¿¡æ¯å¤±è´¥'); } }, // 仿å¨å¼¹çªæ¥çæå é¾ viewSplitChainFromManualDialog(barcode, dialogId) { // å å ³éæå¨å¼¹çª const dialog = document.getElementById(dialogId); if (dialog && dialog.parentNode) { dialog.parentNode.removeChild(dialog); } // å»¶è¿ä¸ä¸ï¼ç¶åæå¼Vueçæå é¾å¼¹çª setTimeout(() => { this.viewSplitChain(barcode); }, 50); }, // å¤çæå¨å¼¹çªçæå æä½ async handleManualSplitPackage(dialogId) { const barcodeInput = document.getElementById(`${dialogId}-barcode`); const splitQtyInput = document.getElementById(`${dialogId}-splitQty`); if (!barcodeInput || !barcodeInput.value.trim()) { ElMessage.warning('请è¾å ¥åæ¡ç '); return; } if (!splitQtyInput || !splitQtyInput.value || parseFloat(splitQtyInput.value) <= 0) { ElMessage.warning('请è¾å ¥ææçæå æ°é'); return; } const originalBarcode = barcodeInput.value.trim(); const splitQuantity = parseFloat(splitQtyInput.value); try { // æ¾ç¤ºå è½½ç¶æ const confirmBtn = document.getElementById(`${dialogId}-confirm`); if (confirmBtn) { confirmBtn.disabled = true; confirmBtn.textContent = 'å¤çä¸...'; } const res = await http.post('/api/OutboundBatchPicking/split-package', { orderNo: this.scanData.orderNo, palletCode: this.scanData.palletCode, originalBarcode: originalBarcode, splitQuantity: splitQuantity }); if (res.status) { ElMessage.success('æå æå'); // å ³éæå¨å¼¹çª const dialog = document.getElementById(dialogId); if (dialog && dialog.parentNode) { dialog.parentNode.removeChild(dialog); } // éæ°å è½½æ°æ® await this.loadPalletData(); } else { ElMessage.error(res.message || 'æå 失败'); // æ¢å¤æé®ç¶æ if (confirmBtn) { confirmBtn.disabled = false; confirmBtn.textContent = '确认æå '; } } } catch (error) { console.error('æå 失败:', error); ElMessage.error('æå 失败'); // æ¢å¤æé®ç¶æ const confirmBtn = document.getElementById(`${dialogId}-confirm`); if (confirmBtn) { confirmBtn.disabled = false; confirmBtn.textContent = '确认æå '; } } }, closeAllDialogsImmediately() { console.log('ç«å³å ³éææå¼¹çª'); // ç´æ¥è®¾ç½®ä¸º falseï¼ä¸çå¾ ä»»ä½å¼æ¥æä½ this.showCustomSplitDialog = false; this.showRevertSplitDialog = false; this.showBatchReturnDialog = false; this.showEmptyPalletDialog = false; this.showSplitChainDialog = false; // 强å¶DOMæ´æ° this.$forceUpdate(); }, async onSplitBarcodeScan() { @@ -620,7 +1066,7 @@ }); if (res.status) { this.$message.success('æå æå'); this.showCustomSplitDialog = false; this.closeAllDialogs(); await this.loadPalletData(); } else { this.$message.error(res.message || 'æå 失败'); @@ -634,28 +1080,24 @@ }); } }, // 卿å å¼¹çªä¸æ¥çæå é¾ async viewSplitChainFromSplit(barcode) { if (!barcode) { this.$message.warning('请å è¾å ¥æ¡ç '); return; } // å å ³éæå å¼¹çª this.closeCustomSplitDialog(); await this.$nextTick(); // ç¶åæå¼æå é¾ä¿¡æ¯å¼¹çª await this.viewSplitChain(barcode); }, async viewSplitChainFromSplit(barcode) { if (!barcode) { this.$message.warning('请å è¾å ¥æ¡ç '); return; } this.closeAllDialogs(); setTimeout(() => { this.viewSplitChain(barcode); }, 50); }, // æ¤éæå 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() { @@ -671,7 +1113,7 @@ }); if (res.status) { this.$message.success('æ¤éæå æå'); this.showRevertSplitDialog = false; this.closeAllDialogs(); await this.loadPalletData(); } else { this.$message.error(res.message || 'æ¤éæå 失败'); @@ -685,216 +1127,140 @@ }); } }, // æ¥æ¾å®æ´æå é¾ï¼ä»æ ¹æ¡ç å¼å§ï¼ async findRootChain(currentBarcode) { this.splitChainLoading = true; try { const res = await http.post('/api/OutboundBatchPicking/find-root-split-chain', { orderNo: this.scanData.orderNo, barcode: currentBarcode }); if (res.status) { this.splitChainInfo = res.data; this.$message.success('å·²å è½½å®æ´æå é¾'); } else { this.$message.error(res.message || 'æ¥æ¾å®æ´æå é¾å¤±è´¥'); } } catch (error) { this.$message.error('æ¥æ¾å®æ´æå é¾å¤±è´¥'); } finally { this.splitChainLoading = false; } }, // æå é¾ç¸å ³æ¹æ³ // æ¥çæå é¾ä¿¡æ¯ async viewSplitChain(barcode) { if (!barcode) { this.$message.warning('请å è¾å ¥æ¡ç '); return; } this.splitChainLoading = true; try { const res = await http.post('/api/OutboundBatchPicking/split-package-chain-info', { orderNo: this.scanData.orderNo, barcode: barcode }); if (res.status) { this.splitChainInfo = res.data; // æ¾ç¤ºæç¤ºä¿¡æ¯ï¼åè¯ç¨æ·è¿æ¯ä»ä¹ç±»åçæå é¾ let chainType = "å½åæ¡ç çæå é¾"; if (this.splitChainInfo.chainType === 'root') { chainType = "宿´æå é¾ï¼ä»åå§æ¡ç å¼å§ï¼"; } else if (this.splitChainInfo.chainType === 'branch') { chainType = "忝æå é¾"; async findRootChain(currentBarcode) { this.splitChainLoading = true; try { const res = await http.post('/api/OutboundBatchPicking/find-root-split-chain', { orderNo: this.scanData.orderNo, barcode: currentBarcode }); if (res.status) { this.splitChainInfo = res.data; this.$message.success('å·²å è½½å®æ´æå é¾'); } else { this.$message.error(res.message || 'æ¥æ¾å®æ´æå é¾å¤±è´¥'); } } catch (error) { this.$message.error('æ¥æ¾å®æ´æå é¾å¤±è´¥'); } finally { this.splitChainLoading = false; } }, // æ¥çæå é¾ä¿¡æ¯ async viewSplitChain(barcode) { if (!barcode) { this.$message.warning('请å è¾å ¥æ¡ç '); return; } this.$message.info(`å·²å è½½${chainType}ï¼å ±${this.splitChainInfo.totalSplitTimes}次æå `); this.showSplitChainDialog = true; } else { this.$message.error(res.message || 'è·åæå é¾ä¿¡æ¯å¤±è´¥'); } } catch (error) { this.$message.error('è·åæå é¾ä¿¡æ¯å¤±è´¥'); } finally { this.splitChainLoading = false; } }, this.splitChainLoading = true; try { const res = await http.post('/api/OutboundBatchPicking/split-package-chain-info', { orderNo: this.scanData.orderNo, barcode: barcode }); if (res.status) { this.splitChainInfo = res.data; this.activeDialog = 'splitChain'; } else { this.$message.error(res.message || 'è·åæå é¾ä¿¡æ¯å¤±è´¥'); } } catch (error) { this.$message.error('è·åæå é¾ä¿¡æ¯å¤±è´¥'); } finally { this.splitChainLoading = false; } }, // å ³éæå é¾ä¿¡æ¯å¼¹çª closeSplitChainDialog() { closeSplitChainDialog() { this.showSplitChainDialog = false; }, // 卿¤éæå å¼¹çªä¸æ¥çæå é¾ async viewSplitChainFromRevert(barcode) { if (!barcode) { this.$message.warning('请å è¾å ¥æ¡ç '); return; } // å å ³éæ¤éæå å¼¹çª this.closeRevertSplitDialog(); await this.$nextTick(); // ç¶åæå¼æå é¾ä¿¡æ¯å¼¹çª await this.viewSplitChain(barcode); }, // å¿«ééæ°æå¼æå é¾å¼¹çª async quickReopenSplitChainDialog(barcode) { if (!barcode) return; this.showSplitChainDialog = true; this.splitChainLoading = true; try { const res = await http.post('/api/OutboundBatchPicking/split-package-chain-info', { orderNo: this.scanData.orderNo, barcode: barcode }); if (res.status) { this.splitChainInfo = res.data; } } catch (error) { console.error('éæ°å è½½æå é¾ä¿¡æ¯å¤±è´¥:', error); } finally { this.splitChainLoading = false; } }, // åæ¶å个æå è®°å½ async cancelSingleSplit(newBarcode) { // å è®°å½å½åä¿¡æ¯ï¼ç¶åå ³éå¼¹çª const originalBarcode = this.splitChainInfo.originalBarcode; this.closeSplitChainDialog(); await this.$nextTick(); try { await this.$confirm( `ç¡®å®è¦åæ¶æ¡ç ${newBarcode} çæå æä½åï¼`, 'åæ¶å个æå ', { confirmButtonText: 'ç¡®å®åæ¶', cancelButtonText: 'åæ³æ³', type: 'warning' } ); this.revertSplitLoading = true; const res = await http.post('/api/OutboundBatchPicking/cancel-split', { orderNo: this.scanData.orderNo, palletCode: this.scanData.palletCode, newBarcode: newBarcode }); if (res.status) { this.$message.success('åæ¶æå æå'); await this.loadPalletData(); // éæ°æå¼å¼¹çªæ¾ç¤ºæ´æ°åçç¶æ await this.viewSplitChain(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); } } finally { this.revertSplitLoading = false; } }, // åæ¶æ´ä¸ªæå é¾ async cancelWholeSplitChain() { // å è®°å½å½åæå é¾ä¿¡æ¯ï¼ç¶åå ³éå¼¹çª const originalBarcode = this.splitChainInfo.originalBarcode; this.closeSplitChainDialog(); // ç»ä¸ç¹æ¶é´è®©å¼¹çªå®å ¨å ³é await this.$nextTick(); try { // ç°å¨æ¾ç¤ºç¡®è®¤å¯¹è¯æ¡ï¼ç¡®ä¿å®å¨æåé¢ await this.$confirm( `ç¡®å®è¦åæ¶æ´ä¸ªæå é¾åï¼\nè¿å°åæ¶ä»æ¡ç ${originalBarcode} å¼å§çæææå æä½ã`, 'åæ¶æå é¾ç¡®è®¤', { confirmButtonText: 'ç¡®å®åæ¶', cancelButtonText: 'åæ³æ³', type: 'warning', center: true, closeOnClickModal: false // åæ¶å个æå è®°å½ async cancelSingleSplit(newBarcode) { const originalBarcode = this.splitChainInfo.originalBarcode; try { await this.$confirm( `ç¡®å®è¦åæ¶æ¡ç ${newBarcode} çæå æä½åï¼`, 'åæ¶å个æå ', { confirmButtonText: 'ç¡®å®åæ¶', cancelButtonText: 'åæ³æ³', type: 'warning' } ); this.revertSplitLoading = true; const res = await http.post('/api/OutboundBatchPicking/cancel-split', { orderNo: this.scanData.orderNo, palletCode: this.scanData.palletCode, newBarcode: newBarcode }); if (res.status) { this.$message.success('åæ¶æå æå'); await this.loadPalletData(); this.closeAllDialogs(); setTimeout(() => { this.viewSplitChain(originalBarcode); }, 50); } else { this.$message.error(res.message || 'åæ¶æå 失败'); } } catch (error) { if (error !== 'cancel') { this.$message.error('åæ¶æå 失败'); } } finally { this.revertSplitLoading = false; } ); // ç¨æ·ç¡®è®¤åæ§è¡åæ¶æä½ this.revertSplitLoading = true; const res = await http.post('/api/OutboundBatchPicking/cancel-split-chain', { orderNo: this.scanData.orderNo, palletCode: this.scanData.palletCode, startBarcode: originalBarcode }); console.log('åæ¶æå é¾ååº:', res); if (res.status) { this.$message.success('åæ¶æå 龿å'); 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); this.$message.error('åæ¶æå é¾å¤±è´¥: ' + error.message); // åºéåéæ°æå¼å¼¹çª await this.viewSplitChain(originalBarcode); } } finally { this.revertSplitLoading = false; } }, }, // åæ¶æ´ä¸ªæå é¾ async cancelWholeSplitChain() { try { await this.$confirm( `ç¡®å®è¦åæ¶æ´ä¸ªæå é¾åï¼\nè¿å°åæ¶ä»æ¡ç ${this.splitChainInfo.originalBarcode} å¼å§çæææå æä½ã`, 'åæ¶æå é¾ç¡®è®¤', { confirmButtonText: 'ç¡®å®åæ¶', cancelButtonText: 'åæ³æ³', type: 'warning', center: true, closeOnClickModal: false } ); this.revertSplitLoading = true; const res = await http.post('/api/OutboundBatchPicking/cancel-split-chain', { orderNo: this.scanData.orderNo, palletCode: this.scanData.palletCode, startBarcode: this.splitChainInfo.originalBarcode }); if (res.status) { this.$message.success('åæ¶æå 龿å'); this.closeAllDialogs(); await this.loadPalletData(); } else { this.$message.error(res.message || 'åæ¶æå é¾å¤±è´¥'); } } catch (error) { if (error !== 'cancel') { this.$message.error('åæ¶æå é¾å¤±è´¥: ' + error.message); } } finally { this.revertSplitLoading = false; } }, // æ£æ¥æ¡ç æ¯å¦å·²è¢«åæ£ hasPicked(barcode) { @@ -908,17 +1274,58 @@ 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.activeDialog = null; // ç¡®ä¿ææå¼¹çªç¶æé½è¢«éç½® // å ³éVueå¼¹çª this.showCustomSplitDialog = false; this.showRevertSplitDialog = false; this.showBatchReturnDialog = false; this.showEmptyPalletDialog = false; this.showSplitChainDialog = false; // å ³éæå¨å¼¹çª if (this.manualDialog && this.manualDialog.parentNode) { this.manualDialog.parentNode.removeChild(this.manualDialog); this.manualDialog = null; } // ç§»é¤ææç´§æ¥å¼¹çª const emergencyDialogs = document.querySelectorAll('.emergency-fix'); emergencyDialogs.forEach(dialog => { if (dialog.parentNode) { dialog.parentNode.removeChild(dialog); } }); }, // ååºç¸å ³æ¹æ³ openBatchReturnDialog() { if (!this.scanData.palletCode) { this.$message.warning('è¯·å æ«ææçç '); return; } 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; if (this.isOpeningDialog) return; this.isOpeningDialog = true; setTimeout(() => { this.closeAllDialogsImmediately(); requestAnimationFrame(() => { 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; this.$nextTick(() => { this.isOpeningDialog = false; }); }); }, 0); }, async handleBatchReturnConfirm() { @@ -930,7 +1337,7 @@ }); if (res.status) { this.$message.success('ååºæå'); this.showBatchReturnDialog = false; this.closeAllDialogs(); await this.loadPalletData(); } else { this.$message.error(res.message || 'ååºå¤±è´¥'); @@ -943,10 +1350,24 @@ }, // åç©ºç®±æ¹æ³ handleEmptyPallet() { this.showEmptyPalletDialog = true; this.emptypalletOutForm.orderNo = this.scanData.orderNo; this.emptypalletOutForm.palletCode = ''; handleEmptyPallet() { if (this.isOpeningDialog) return; this.isOpeningDialog = true; setTimeout(() => { this.closeAllDialogsImmediately(); requestAnimationFrame(() => { this.showEmptyPalletDialog = true; this.emptypalletOutForm.orderNo = this.scanData.orderNo; this.emptypalletOutForm.palletCode = ''; this.$nextTick(() => { this.isOpeningDialog = false; }); }); }, 0); }, async handleEmptyPalletConfirm() { @@ -958,7 +1379,7 @@ }); if (res.status) { this.$message.success('å走空箱æå'); this.showEmptyPalletDialog = false; this.closeAllDialogs(); await this.loadPalletData(); } else { this.$message.error(res.message || 'å走空箱失败'); @@ -974,9 +1395,13 @@ async loadPalletData() { if (!this.scanData.orderNo || !this.scanData.palletCode) return; await this.loadUnpickedList(); await this.loadPickedList(); await this.loadPalletStatus(); try { await this.loadUnpickedList(); await this.loadPickedList(); await this.loadPalletStatus(); } catch (error) { console.error('å è½½æçæ°æ®å¤±è´¥:', error); } }, async loadUnpickedList() { @@ -986,7 +1411,6 @@ 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); @@ -1003,16 +1427,10 @@ palletCode: this.scanData.palletCode }); if (res.status) { this.pickedList = res.data || []; this.pickedList = res.data.map(item => { // æ¹å¼1ï¼ä¿çåbarcodeåæ®µï¼æ°å¢currentBarcode return { ...item, currentBarcode: item.barcode }; }); this.pickedList = res.data.map(item => ({ ...item, currentBarcode: item.barcode })); this.summary.pickedCount = this.pickedList.length; } } catch (error) { @@ -1116,17 +1534,31 @@ this.resetSplitForm(); }, openRevertSplitDialog() { this.showRevertSplitDialog = true; this.revertSplitForm.newBarcode = ''; openRevertSplitDialog() { if (this.isOpeningDialog) return; this.isOpeningDialog = true; setTimeout(() => { this.closeAllDialogsImmediately(); requestAnimationFrame(() => { this.showRevertSplitDialog = true; this.revertSplitForm.newBarcode = ''; this.$nextTick(() => { this.isOpeningDialog = false; }); }); }, 0); }, closeRevertSplitDialog() { closeRevertSplitDialog() { this.showRevertSplitDialog = false; this.revertSplitForm.newBarcode = ''; }, closeBatchReturnDialog() { closeBatchReturnDialog() { this.showBatchReturnDialog = false; }, @@ -1135,7 +1567,7 @@ this.emptypalletOutForm.palletCode = this.emptypalletOutForm.palletCode.replace(/\n/g, '').trim(); }, closeEmptyPalletDialog() { closeEmptyPalletDialog() { this.showEmptyPalletDialog = false; this.emptypalletOutForm.palletCode = ''; }, @@ -1182,19 +1614,7 @@ color: #909399; } /* èªå®ä¹å¼¹çªæ ·å¼ */ :deep(.el-message-box) { z-index: 10010 !important; } :deep(.el-overlay) { z-index: 10009 !important; } :deep(.el-message) { z-index: 10011 !important; } /* èªå®ä¹å¼¹çªæ ·å¼ - å ³é®ä¿®å¤ */ .custom-dialog-overlay { position: fixed; top: 0; @@ -1205,7 +1625,130 @@ display: flex; align-items: center; justify-content: center; z-index: 2000; /* ä¿æä¸ä¸ªåçç z-index */ z-index: 9999; /* æé«z-indexç¡®ä¿å¨æä¸å± */ } .custom-dialog-wrapper { position: relative; z-index: 10000; } .custom-dialog { background: white; border-radius: 4px; width: 500px; max-width: 90vw; max-height: 90vh; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); overflow: auto; } .custom-dialog-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 10px; border-bottom: 1px solid #ebeef5; } .custom-dialog-header h3 { margin: 0; color: #303133; } .close-button { font-size: 18px; color: #909399; padding: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; } .close-button:hover { color: #409EFF; background-color: transparent; } .custom-dialog-body { padding: 20px; } .custom-dialog-footer { padding: 10px 20px 20px; text-align: right; border-top: 1px solid #ebeef5; } .custom-dialog-footer .el-button { margin-left: 10px; } @media (max-width: 768px) { .custom-dialog { width: 95vw; margin: 10px; } .scanner-form { flex-direction: column; align-items: stretch; } .scanner-form .el-input { width: 100%; } } /* åæçæ ·å¼ä¿æä¸å */ .OutboundPicking-container { padding: 20px; } .scanner-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .scanner-form .el-input { width: 200px; } .summary-info { display: flex; gap: 20px; flex-wrap: wrap; } .table-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 0 10px; } .selection-count { font-size: 12px; color: #909399; } /* åæçèªå®ä¹å¼¹çªæ ·å¼ */ .custom-dialog-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 2000; } .custom-dialog-wrapper { @@ -1276,16 +1819,22 @@ 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%; } } /* æ°å¢ï¼æå¨å¼¹çªçæé®æ¬åææ */ :deep(button) { transition: all 0.3s; } :deep(button:hover) { opacity: 0.8; } :deep(button:active) { opacity: 0.6; } </style> ÏîÄ¿´úÂë/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_BasicService/ErpApiService.cs
@@ -41,7 +41,10 @@ { try { //erp æµè¯ç¯å¢ var request = new TokenRequest { appId = "BG_SYSTEM", secretKey = "7e9239c1e132462a9cf03bfa342a044aMTcxODE5MzgxODI4Mw" }; ////erp æ£å¼ç¯å¢ //var request = new TokenRequest { appId = "BG_SYSTEM", secretKey = "9a3d0b5a37Bfc6dAM4b34ODb8ebDOSb937106d1b19DS29098" }; var response = await PostAsync<TokenRequest, TokenResponse>("auth/getAccessToken", request, includeToken: false); var _token = response?.data?.access_token; return _token ?? ""; ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs
@@ -26,6 +26,7 @@ using WIDESEA_IBasicService; using WIDESEA_IOutboundService; using WIDESEA_Model.Models; using WIDESEA_Model.Models.Outbound; namespace WIDESEA_BasicService { @@ -45,13 +46,14 @@ private readonly IOutboundOrderService _outboundOrderService; private readonly IOutboundOrderDetailService _outboundOrderDetailService; private readonly IOutStockLockInfoService _outStockLockInfoService; private readonly IRepository<Dt_InterfaceLog> _interfacelogRepository; // åå¨èµæºIDåå ¶å¯¹åºçé对象ãä½¿ç¨ ConcurrentDictionary ç¡®ä¿å¯¹åå ¸æä½æ¬èº«ç线ç¨å®å ¨ã private static readonly ConcurrentDictionary<string, object> _resourceLocks = new ConcurrentDictionary<string, object>(); // å ¨å±éæéï¼ç¨äºä¿æ¤ _resourceLocks åå ¸ä¸ GetOrAdd æ TryRemove æ¶çç«äº private static readonly object _globalLocker = new object(); public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService, IRepository<Dt_PickingRecord> pickingRecoreRepository) public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService, IRepository<Dt_PickingRecord> pickingRecoreRepository, IRepository<Dt_InterfaceLog> interfacelogRepository) { _httpClientFactory = httpClientFactory; _logger = logger; @@ -64,6 +66,7 @@ _outStockLockInfoService = outStockLockInfoService; _materialUnitService = materialUnitService; _pickingRecoreRepository = pickingRecoreRepository; _interfacelogRepository = interfacelogRepository; } /// <summary> @@ -393,7 +396,7 @@ { // æ¢é失败ï¼è¯´ææå¦ä¸ä¸ªçº¿ç¨ï¼WCSåè°æäººå·¥æä½ï¼æ£å¨å¤ç return WebResponseContent.Instance.OK("WMSæ£å¨å¤çæ¤åä¼ ä»»å¡ï¼è¯·å¿é夿ä½ã"); return WebResponseContent.Instance.Error("WMSæ£å¨å¤çæ¤åä¼ ä»»å¡ï¼è¯·å¿é夿ä½ã"); } return WebResponseContent.Instance.OK(); } @@ -430,218 +433,66 @@ return WebResponseContent.Instance.Error("没æéè¦åä¼ çåæ£è®°å½"); var documentNo = UniqueValueGenerator.Generate(); var feedModel = new FeedbackOutboundRequestModel var groups = pickingRecords.GroupBy(x => x.FeedBackMesDocumentNo).ToList(); foreach (var group in groups) { reqCode = Guid.NewGuid().ToString(), reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), business_type = outboundOrder.BusinessType, factoryArea = outboundOrder.FactoryArea, operationType = 1, Operator = outboundOrder.Operator != "" ? outboundOrder.Operator : App.User.UserName, orderNo = outboundOrder.UpperOrderNo, documentsNO = documentNo, status = outboundOrder.OrderStatus, details = new List<FeedbackOutboundDetailsModel>() }; var detailIds = new List<int>(); // å¡«å æç»åæ¡ç ä¿¡æ¯ foreach (var detail in orderDetails) { // æ¥è¯¢è¯¥æç»å¯¹åºçé宿¡ç è®°å½ var detailPicks = pickingRecords.Where(x => x.OrderNo == orderNo && detail.Id == x.OrderDetailId).ToList(); if (!detailPicks.Any()) { continue; } var detailModel = new FeedbackOutboundDetailsModel { materialCode = detail.MaterielCode, lineNo = detail.lineNo, warehouseCode = detail.WarehouseCode, qty = detail.BarcodeQty, currentDeliveryQty = 0, unit = detail.BarcodeUnit, barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>() }; // å¡«å æ¡ç ä¿¡æ¯ï¼å«åä½è½¬æ¢ï¼ foreach (var item in detailPicks) List<Dt_PickingRecord> records = group.ToList(); // 该åç»ä¸çææè®°å½ if (string.IsNullOrEmpty(group.Key)) { if (item.PickQuantity <= 0) var emptydocumentNo = UniqueValueGenerator.Generate(); records.ForEach(x => { x.FeedBackMesDocumentNo = emptydocumentNo; }); var result = await _pickingRecoreRepository.Db.Updateable(records).ExecuteCommandAsync(); var interfacelog = new Dt_InterfaceLog { continue; } var barModel = new WIDESEA_DTO.Outbound.BarcodesModel { barcode = item.Barcode, supplyCode = item.SupplyCode, batchNo = item.BatchNo, unit = item.BarcodeUnit, qty = item.PickQuantity Content = JsonConvert.SerializeObject(records), DocumentNo = emptydocumentNo, OrderNo = orderNo, OrderType = "2", }; _interfacelogRepository.AddData(interfacelog); // åä½ä¸ä¸è´æ¶è½¬æ¢ if (detail.BarcodeUnit != detail.Unit) if (result > 0) { var convertResult = await _materialUnitService.ConvertAsync( item.MaterielCode, item.PickQuantity, detail.Unit, detail.BarcodeUnit); barModel.unit = convertResult.Unit; barModel.qty = convertResult.Quantity; } else { barModel.qty = item.PickQuantity; } detailModel.currentDeliveryQty += barModel.qty; detailModel.barcodes.Add(barModel); } detailIds.Add(detail.Id); feedModel.details.Add(detailModel); } (bool _flowControl, WebResponseContent _value) = await FeedBackBatchToMes(outboundOrder, orderNo, orderDetails, pickingRecords, emptydocumentNo); feedModel.details = feedModel.details.GroupBy(item => new { item.materialCode, item.lineNo, item.warehouseCode, item.unit, item.qty }).Select(group => new FeedbackOutboundDetailsModel { materialCode = group.Key.materialCode, lineNo = group.Key.lineNo, warehouseCode = group.Key.warehouseCode, qty = group.Key.qty, currentDeliveryQty = group.Sum(x => x.currentDeliveryQty), unit = group.Key.unit, barcodes = group.SelectMany(x => x.barcodes.GroupBy(o => new { o.barcode, o.supplyCode, o.batchNo, o.unit }).Select(row => new WIDESEA_DTO.Outbound.BarcodesModel { barcode = row.Key.barcode, supplyCode = row.Key.supplyCode, batchNo = row.Key.batchNo, unit = row.Key.unit, qty = row.Sum(y => y.qty) })).ToList() }).ToList(); return _value; var allCompleted = true; // çéå¾ åä¼ çæç»ï¼ReturnToMESStatus=0ï¼ var pendingDetails = orderDetails.Where(x => x.ReturnToMESStatus == 0).ToList(); foreach (var detail in pendingDetails) { if (detail.OverOutQuantity < detail.NeedOutQuantity) { allCompleted = false; } } // åå¨åä¼ å¤±è´¥çæç»ï¼ReturnToMESStatus=2ï¼ï¼æ è®°æªå®æ if (orderDetails.Any(x => x.ReturnToMESStatus == 2)) { allCompleted = false; } // æ´æ°è®¢åç¶æ int newStatus = allCompleted ? (int)OutOrderStatusEnum.åºåºå®æ : (int)OutOrderStatusEnum.åºåºä¸; if (outboundOrder.OrderStatus != newStatus) { int updateCount = await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() .SetColumns(x => x.OrderStatus == newStatus) .Where(x => x.OrderNo == orderNo) .ExecuteCommandAsync(); if (updateCount <= 0) { _logger.LogWarning($"æ´æ°åºåºåç¶æå¤±è´¥ - OrderNo: {orderNo}, ç®æ ç¶æ: {newStatus}"); } } // è°ç¨MESåä¼ æ¥å£ var mesResult = await FeedbackOutbound(feedModel); if (mesResult == null || mesResult.code != 200) { // æ´æ°æç»ä¸ºåä¼ å¤±è´¥ï¼ReturnToMESStatus=2ï¼ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() .SetColumns(it => new Dt_OutboundOrderDetail { ReturnToMESStatus = 2, documentsNO = documentNo, }) .Where(x => detailIds.Contains(x.Id)) .ExecuteCommandAsync(); return WebResponseContent.Instance.Error($"åä¼ MES失败"); } foreach (var record in pickingRecords.Where(x => detailIds.Contains(x.OrderDetailId)).ToList()) { record.ReturnToMESStatus = 1; } var updates = pickingRecords.Where(x => detailIds.Contains(x.OrderDetailId)).ToList(); updates.ForEach(x => { x.ReturnToMESStatus = 1; }); await _pickingRecoreRepository.Db.Updateable(updates).ExecuteCommandAsync(); if (allCompleted) { //MESåä¼ æåï¼æ´æ°æç»ä¸ºåä¼ æåç¶æ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() .SetColumns(it => new Dt_OutboundOrderDetail { ReturnToMESStatus = 1, documentsNO = documentNo, }) .Where(x => detailIds.Contains(x.Id)) .ExecuteCommandAsync(); } // æ ¡éªæ¯å¦æææç»é½å®æï¼æ´æ°è®¢åæç»ç¶æ if (allCompleted && newStatus == (int)OutOrderStatusEnum.åºåºå®æ) { await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() .SetColumns(x => new Dt_OutboundOrder { ReturnToMESStatus = 1, OrderStatus = newStatus }) .Where(x => x.OrderNo == orderNo) .ExecuteCommandAsync(); } else { // äºæ¬¡æ ¡éªæ¯å¦æææªåä¼ æç»é½å·²å®æ var dbOrderDetails = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>() .LeftJoin<Dt_OutboundOrder>((o, item) => o.OrderId == item.Id) .Where((o, item) => item.OrderNo == orderNo && item.ReturnToMESStatus != 1) .Select((o, item) => o) .ToListAsync(); var secAllCompleted = true; foreach (var detail in dbOrderDetails.Where(x => x.ReturnToMESStatus == 0).ToList()) { if (detail.OverOutQuantity < detail.NeedOutQuantity) { secAllCompleted = false; break; } } if (secAllCompleted) else { await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() .SetColumns(it => new Dt_OutboundOrder var ilog = _interfacelogRepository.QueryFirst(x => x.DocumentNo == group.Key); if (ilog == null) { var interfacelog = new Dt_InterfaceLog { ReturnToMESStatus = 1, OrderStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(), }) .Where(x => x.OrderNo == orderNo) .ExecuteCommandAsync(); Content = JsonConvert.SerializeObject(records), DocumentNo = group.Key, OrderNo = orderNo, OrderType = "2", }; _interfacelogRepository.AddData(interfacelog); } (bool _flowControl, WebResponseContent _value) = await FeedBackBatchToMes(outboundOrder, orderNo, orderDetails, pickingRecords, group.Key); return _value; } } //var documentNo = UniqueValueGenerator.Generate(); //(bool flowControl, WebResponseContent value) = await FeedBackBatchToMes(outboundOrder, orderNo, orderDetails, pickingRecords, documentNo); //if (!flowControl) //{ // return value; //} // åä¼ æåçæç»è¿å response = WebResponseContent.Instance.OK($"åä¼ MESæåï¼åæ®å·ï¼{documentNo}"); response = WebResponseContent.Instance.OK($"åä¼ MESæåï¼åæ®å·ï¼{orderNo}"); } catch (Exception ex) { @@ -656,6 +507,223 @@ return response; } private async Task<(bool flowControl, WebResponseContent value)> FeedBackBatchToMes(Dt_OutboundOrder outboundOrder, string orderNo, List<Dt_OutboundOrderDetail> orderDetails, List<Dt_PickingRecord> pickingRecords, string documentNo) { var feedModel = new FeedbackOutboundRequestModel { reqCode = Guid.NewGuid().ToString(), reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), business_type = outboundOrder.BusinessType, factoryArea = outboundOrder.FactoryArea, operationType = 1, Operator = outboundOrder.Operator != "" ? outboundOrder.Operator : App.User.UserName, orderNo = outboundOrder.UpperOrderNo, documentsNO = documentNo, status = outboundOrder.OrderStatus, details = new List<FeedbackOutboundDetailsModel>() }; var detailIds = new List<int>(); // å¡«å æç»åæ¡ç ä¿¡æ¯ foreach (var detail in orderDetails) { // æ¥è¯¢è¯¥æç»å¯¹åºçé宿¡ç è®°å½ var detailPicks = pickingRecords.Where(x => x.OrderNo == orderNo && detail.Id == x.OrderDetailId).ToList(); if (!detailPicks.Any()) { continue; } var detailModel = new FeedbackOutboundDetailsModel { materialCode = detail.MaterielCode, lineNo = detail.lineNo, warehouseCode = detail.WarehouseCode, qty = detail.BarcodeQty, currentDeliveryQty = 0, unit = detail.BarcodeUnit, barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>() }; // å¡«å æ¡ç ä¿¡æ¯ï¼å«åä½è½¬æ¢ï¼ foreach (var item in detailPicks) { if (item.PickQuantity <= 0) { continue; } var barModel = new WIDESEA_DTO.Outbound.BarcodesModel { barcode = item.Barcode, supplyCode = item.SupplyCode, batchNo = item.BatchNo, unit = item.BarcodeUnit, qty = item.PickQuantity }; // åä½ä¸ä¸è´æ¶è½¬æ¢ if (detail.BarcodeUnit != detail.Unit) { var convertResult = await _materialUnitService.ConvertAsync( item.MaterielCode, item.PickQuantity, detail.Unit, detail.BarcodeUnit); barModel.unit = convertResult.Unit; barModel.qty = convertResult.Quantity; } else { barModel.qty = item.PickQuantity; } detailModel.currentDeliveryQty += barModel.qty; detailModel.barcodes.Add(barModel); } detailIds.Add(detail.Id); feedModel.details.Add(detailModel); } feedModel.details = feedModel.details.GroupBy(item => new { item.materialCode, item.lineNo, item.warehouseCode, item.unit, item.qty }).Select(group => new FeedbackOutboundDetailsModel { materialCode = group.Key.materialCode, lineNo = group.Key.lineNo, warehouseCode = group.Key.warehouseCode, qty = group.Key.qty, currentDeliveryQty = group.Sum(x => x.currentDeliveryQty), unit = group.Key.unit, barcodes = group.SelectMany(x => x.barcodes.GroupBy(o => new { o.barcode, o.supplyCode, o.batchNo, o.unit }).Select(row => new WIDESEA_DTO.Outbound.BarcodesModel { barcode = row.Key.barcode, supplyCode = row.Key.supplyCode, batchNo = row.Key.batchNo, unit = row.Key.unit, qty = row.Sum(y => y.qty) })).ToList() }).ToList(); var allCompleted = true; // çéå¾ åä¼ çæç»ï¼ReturnToMESStatus=0ï¼ var pendingDetails = orderDetails.Where(x => x.ReturnToMESStatus == 0).ToList(); foreach (var detail in pendingDetails) { if (detail.OverOutQuantity < detail.NeedOutQuantity) { allCompleted = false; } } // åå¨åä¼ å¤±è´¥çæç»ï¼ReturnToMESStatus=2ï¼ï¼æ è®°æªå®æ if (orderDetails.Any(x => x.ReturnToMESStatus == 2)) { allCompleted = false; } // æ´æ°è®¢åç¶æ int newStatus = allCompleted ? (int)OutOrderStatusEnum.åºåºå®æ : (int)OutOrderStatusEnum.åºåºä¸; if (outboundOrder.OrderStatus != newStatus) { int updateCount = await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() .SetColumns(x => x.OrderStatus == newStatus) .Where(x => x.OrderNo == orderNo) .ExecuteCommandAsync(); if (updateCount <= 0) { _logger.LogWarning($"æ´æ°åºåºåç¶æå¤±è´¥ - OrderNo: {orderNo}, ç®æ ç¶æ: {newStatus}"); } } // è°ç¨MESåä¼ æ¥å£ var mesResult = await FeedbackOutbound(feedModel); if (mesResult == null || mesResult.code != 200) { // æ´æ°æç»ä¸ºåä¼ å¤±è´¥ï¼ReturnToMESStatus=2ï¼ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() .SetColumns(it => new Dt_OutboundOrderDetail { ReturnToMESStatus = 2, documentsNO = documentNo, }) .Where(x => detailIds.Contains(x.Id)) .ExecuteCommandAsync(); return (flowControl: false, value: WebResponseContent.Instance.Error($"åä¼ MES失败")); } foreach (var record in pickingRecords.Where(x => detailIds.Contains(x.OrderDetailId)).ToList()) { record.ReturnToMESStatus = 1; } var updates = pickingRecords.Where(x => detailIds.Contains(x.OrderDetailId)).ToList(); updates.ForEach(x => { x.ReturnToMESStatus = 1; }); await _pickingRecoreRepository.Db.Updateable(updates).ExecuteCommandAsync(); await _interfacelogRepository.Db.Updateable<Dt_InterfaceLog>() .SetColumns(x => x.ReturnToMESStatus == 1) .Where(x => x.OrderNo == orderNo) .ExecuteCommandAsync(); if (allCompleted) { //MESåä¼ æåï¼æ´æ°æç»ä¸ºåä¼ æåç¶æ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() .SetColumns(it => new Dt_OutboundOrderDetail { ReturnToMESStatus = 1, documentsNO = documentNo, }) .Where(x => detailIds.Contains(x.Id)) .ExecuteCommandAsync(); } // æ ¡éªæ¯å¦æææç»é½å®æï¼æ´æ°è®¢åæç»ç¶æ if (allCompleted && newStatus == (int)OutOrderStatusEnum.åºåºå®æ) { await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() .SetColumns(x => new Dt_OutboundOrder { ReturnToMESStatus = 1, OrderStatus = newStatus }) .Where(x => x.OrderNo == orderNo) .ExecuteCommandAsync(); } else { // äºæ¬¡æ ¡éªæ¯å¦æææªåä¼ æç»é½å·²å®æ var dbOrderDetails = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>() .LeftJoin<Dt_OutboundOrder>((o, item) => o.OrderId == item.Id) .Where((o, item) => item.OrderNo == orderNo && item.ReturnToMESStatus != 1) .Select((o, item) => o) .ToListAsync(); var secAllCompleted = true; foreach (var detail in dbOrderDetails.Where(x => x.ReturnToMESStatus == 0).ToList()) { if (detail.OverOutQuantity < detail.NeedOutQuantity) { secAllCompleted = false; break; } } if (secAllCompleted) { await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() .SetColumns(it => new Dt_OutboundOrder { ReturnToMESStatus = 1, OrderStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(), }) .Where(x => x.OrderNo == orderNo) .ExecuteCommandAsync(); } } return (flowControl: true, value: null); } private async Task<WebResponseContent> HandleOutboundOrderToMESCompletion(Dt_OutboundOrder outboundOrder, string orderNo) { // åç½®åæ°æ ¡éªï¼ç©ºå¼ç´æ¥è¿åé误 ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs
@@ -139,15 +139,26 @@ } List<string> lockLocationCodes = locationCaches.Select(x => x.LocationCode).ToList(); //Dictionary<string, SqlSugar.OrderByType> orderBy = new Dictionary<string, OrderByType>() //{ // { nameof(Dt_LocationInfo.RoadwayNo),OrderByType.Asc }, // { nameof(Dt_LocationInfo.Layer),OrderByType.Asc }, // { nameof(Dt_LocationInfo.Column),OrderByType.Asc }, // { nameof(Dt_LocationInfo.Depth),OrderByType.Desc }, // { nameof(Dt_LocationInfo.Row),OrderByType.Asc } //}; Dictionary<string, SqlSugar.OrderByType> orderBy = new Dictionary<string, OrderByType>() { { nameof(Dt_LocationInfo.RoadwayNo),OrderByType.Asc }, //{ nameof(Dt_LocationInfo.RoadwayNo),OrderByType.Asc }, { nameof(Dt_LocationInfo.Layer),OrderByType.Asc }, { nameof(Dt_LocationInfo.Row),OrderByType.Asc }, { nameof(Dt_LocationInfo.Column),OrderByType.Asc }, { nameof(Dt_LocationInfo.Depth),OrderByType.Desc }, { nameof(Dt_LocationInfo.Row),OrderByType.Asc } }; var first = BaseDal.QueryFirst(x => x.LocationType == locationType && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode), orderBy);//æ¥è¯¢ç©ºè´§ä½ä¿¡æ¯å¹¶æé¤5åéå åé çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº if (first != null) @@ -157,7 +168,7 @@ { LocationStatus = (int)LocationStatusEnum.InStockLock, }).Where(x => x.Id == first.Id).ExecuteCommand(); } } return first; } @@ -217,7 +228,7 @@ { return Repository.QueryData(x => locationCodes.Contains(x.LocationCode)); } public List<LocationTypeDto> GetLocationTypes() { return _locationTypeRepository.Db.Queryable<Dt_LocationType>().Select(x => ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskStatusEnum.cs
@@ -66,6 +66,8 @@ [Description("AGVæ§è¡ä¸")] AGV_Executing = 310, [Description("AGVåè´§ä¸")] AGV_Pull = 315, /// <summary> /// AGVå¾ ç»§ç»æ§è¡ /// </summary> ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs
@@ -23,6 +23,7 @@ using System.Text; using System.Threading.Tasks; using WIDESEA_Common.CommonEnum; using WIDESEA_Common.TaskEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; @@ -44,6 +45,8 @@ Task<WebResponseContent> TaskCompleted(string taskNum); Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum); Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys, string outStation); Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews,string station=null); ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITask_HtyService.cs
@@ -15,4 +15,5 @@ public interface ITask_HtyService : IService<Dt_Task_Hty> { bool DeleteAndMoveIntoHty(Dt_Task task, OperateTypeEnum operateType); } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_PickingRecord.cs
@@ -8,11 +8,11 @@ namespace WIDESEA_Model.Models { /// <summary> /// æ£éè®°å½è¡¨ /// </summary> [SugarTable(nameof(Dt_PickingRecord), "æ£éè®°å½è¡¨")] public class Dt_PickingRecord : BaseEntity @@ -20,7 +20,7 @@ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } public int TaskNo { get; set; } public int TaskNo { get; set; } public string OrderNo { get; set; } public int OrderDetailId { get; set; } @@ -93,6 +93,8 @@ public decimal BarcodeMoveQty { get; set; } public int ReturnToMESStatus { get; set; } public string FeedBackMesDocumentNo { get; set; } } @@ -114,7 +116,7 @@ /// ååºæ°é /// </summary> public decimal ReturnQty { get; set; } public DateTime ReturnTime { get; set; } /// <summary> /// 0-å¾ ååº 1-å·²ååº @@ -126,7 +128,7 @@ /// æå è®°å½è¡¨ /// </summary> [SugarTable("Dt_SplitPackageRecord")] public class Dt_SplitPackageRecord: BaseEntity public class Dt_SplitPackageRecord : BaseEntity { [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } @@ -140,8 +142,8 @@ public int OutStockLockInfoId { get; set; } // å ³èçåºåºéå®ä¿¡æ¯ public string OriginalBarcode { get; set; } // åæ¡ç public string NewBarcode { get; set; } // æ°æ¡ç public string FactoryArea { get; set; } public string FactoryArea { get; set; } /// <summary> /// æåæ°éï¼æ°æ¡ç æ°éï¼ /// </summary> @@ -162,7 +164,7 @@ [SugarColumn(IsNullable = true)] public decimal? OriginalStockQuantity { get; set; } public decimal StockBeforeSplit { get; set; } public decimal StockBeforeSplit { get; set; } public decimal AssignBeforeSplit { get; set; } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/InterfaceLog.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,65 @@ using Newtonsoft.Json; using SqlSugar; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEA_Core.DB.Models; namespace WIDESEA_Model.Models.Outbound { /// <summary> /// æ¥å£æ¥å¿è®°å½è¡¨ /// </summary> [SugarTable("Dt_InterfaceLog")] public class Dt_InterfaceLog : BaseEntity { /// <summary> /// 主é®IDï¼èªå¢ï¼ /// </summary> [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] public long Id { get; set; } /// <summary> /// 订åå· /// </summary> [SugarColumn(ColumnName = "OrderNo", Length = 100, IsNullable = false)] [Required(ErrorMessage = "订åå·ä¸è½ä¸ºç©º")] public string OrderNo { get; set; } /// <summary> /// ææ¡£å· /// </summary> [SugarColumn(ColumnName = "DocumentNo", Length = 100, IsNullable = true)] public string? DocumentNo { get; set; } /// <summary> /// 订åç±»å /// </summary> [SugarColumn(ColumnName = "OrderType", Length = 50, IsNullable = true)] [Required(ErrorMessage = "订åç±»åä¸è½ä¸ºç©º")] public string OrderType { get; set; } /// <summary> /// JSONå 容 /// </summary> [SugarColumn(ColumnName = "Content", IsNullable = true, ColumnDataType = "nvarchar(max)")] [Required(ErrorMessage = "å 容ä¸è½ä¸ºç©º")] public string Content { get; set; } public int ReturnToMESStatus { get; set; } /// <summary> /// 软å 餿 å¿ /// </summary> [SugarColumn(ColumnName = "IsDeleted", IsNullable = false)] public bool IsDeleted { get; set; } = false; } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/NoStockOutModel.cs
@@ -1,5 +1,8 @@ using System; using Newtonsoft.Json; using SqlSugar; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -43,4 +46,5 @@ public List<string> BarCodeSubmit { get; set; } } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundBatchPickingService.cs
@@ -21,6 +21,7 @@ using WIDESEA_IBasicService; using WIDESEA_IOutboundService; using WIDESEA_IStockService; using WIDESEA_ITaskInfoService; using WIDESEA_Model.Models; using WIDESEA_Model.Models.Basic; using WIDESEA_Model.Models.Outbound; @@ -49,6 +50,7 @@ private readonly IDailySequenceService _dailySequenceService; private readonly IAllocateService _allocateService; private readonly IRepository<Dt_OutboundBatch> _outboundBatchRepository; private readonly ITask_HtyService _task_HtyService; private readonly ILogger<OutboundPickingService> _logger; private Dictionary<string, string> stations = new Dictionary<string, string> @@ -68,7 +70,7 @@ public OutboundBatchPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository) : base(BaseDal) IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, ITask_HtyService task_HtyService) : base(BaseDal) { _unitOfWorkManage = unitOfWorkManage; _stockInfoService = stockInfoService; @@ -86,6 +88,7 @@ _dailySequenceService = dailySequenceService; _allocateService = allocateService; _outboundBatchRepository = outboundBatchRepository; _task_HtyService = task_HtyService; } // <summary> @@ -1798,7 +1801,7 @@ // æ´æ°éå®è®°å½ç¶æä¸ºå·²ååº lockInfo.Status = (int)OutLockStockStatusEnum.å·²ååº; lockInfo.Operator = App.User.UserName; lockInfo.Operator = App.User.UserName; await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync(); @@ -1854,7 +1857,7 @@ // æ´æ°éå®è®°å½ç¶æä¸ºå·²ååº lockInfo.Status = (int)OutLockStockStatusEnum.å·²ååº; lockInfo.Operator = App.User.UserName; lockInfo.Operator = App.User.UserName; await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync(); @@ -1945,9 +1948,17 @@ PalletType = stockInfo.PalletType, WarehouseId = currentTask.WarehouseId }; try { await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync(); await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync(); } catch (Exception ex) { _logger.LogInformation($"å建ååºä»»å¡å¤±è´¥ - 订å: {orderNo}, æç: {palletCode}"); throw new Exception($"å建ååºä»»å¡å¤±è´¥ - 订å: {orderNo}, æç: {palletCode}"); } // åéESSå½ä»¤ await SendESSCommands(palletCode, currentTask.TargetAddress, returnTask); @@ -2223,7 +2234,7 @@ // åé æ°éå¨è®¢åæç»å±é¢ç»ä¸å¤ç var originalStatus = lockInfo.Status; lockInfo.Status = (int)OutLockStockStatusEnum.å·²ååº; lockInfo.Operator = App.User.UserName; lockInfo.Operator = App.User.UserName; await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync(); @@ -2550,7 +2561,7 @@ /// <summary> /// å¤çæªåæ£çéå®è®°å½ååº /// </summary> /// <summary> /// å¤çæçä¸çåºåè´§ç©ååº @@ -3478,11 +3489,16 @@ }; // ä¿åååºä»»å¡ await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync(); var insertcount = await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync(); if (insertcount <= 0) { throw new Exception("å建任å¡å¤±è´¥ï¼"); } var targetAddress = originalTask.TargetAddress; // å é¤åå§åºåºä»»å¡ _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.èªå¨å®æ); //_taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.èªå¨å®æ); _task_HtyService.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.人工å é¤); await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync(); ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs
@@ -32,6 +32,7 @@ using WIDESEA_IInboundService; using WIDESEA_IOutboundService; using WIDESEA_IStockService; using WIDESEA_ITaskInfoService; using WIDESEA_Model.Models; using WIDESEA_Model.Models.Basic; using WIDESEA_Model.Models.Check; @@ -63,6 +64,7 @@ private readonly IInboundOrderDetailService _inboundOrderDetailService; private readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository; private readonly IReCheckOrderService _reCheckOrderService; private readonly ITask_HtyService _task_HtyService; private readonly ILogger<OutboundPickingService> _logger; private Dictionary<string, string> stations = new Dictionary<string, string> @@ -82,7 +84,7 @@ public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_InboundOrder> inboundOrderRepository, IInboundOrderDetailService inboundOrderDetailService, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IReCheckOrderService reCheckOrderService) : base(BaseDal) IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_InboundOrder> inboundOrderRepository, IInboundOrderDetailService inboundOrderDetailService, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IReCheckOrderService reCheckOrderService, ITask_HtyService task_HtyService) : base(BaseDal) { _unitOfWorkManage = unitOfWorkManage; _stockInfoService = stockInfoService; @@ -103,6 +105,7 @@ _inboundOrderDetailService = inboundOrderDetailService; _warehouseAreaRepository = warehouseAreaRepository; _reCheckOrderService = reCheckOrderService; _task_HtyService = task_HtyService; } @@ -1685,13 +1688,20 @@ }; // ä¿åååºä»»å¡ await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync(); var insertcount = await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync(); if (insertcount <= 0) { throw new Exception("å建任å¡å¤±è´¥ï¼"); } var targetAddress = originalTask.TargetAddress; // å é¤åå§åºåºä»»å¡ _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.èªå¨å®æ); await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync(); // _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.èªå¨å®æ); var result = _task_HtyService.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.人工å é¤); if (!result) { await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync(); } // ç» ESS åéæµå¨ä¿¡å·ååå»ºä»»å¡ @@ -2752,15 +2762,15 @@ TaskNum = 0, Status = (int)OutLockStockStatusEnum.æ£é宿, Unit = outboundOrderDetail.Unit, SupplyCode = outboundOrderDetail.SupplyCode?? "æ ", SupplyCode = outboundOrderDetail.SupplyCode ?? "æ ", OrderType = outboundOrder.OrderType, CurrentBarcode = inboundOrderDetail.Barcode, IsSplitted = 1, Operator = App.User.UserName, lineNo= outboundOrderDetail.lineNo, lineNo = outboundOrderDetail.lineNo, WarehouseCode = outboundOrderDetail.WarehouseCode ?? "æ ", BarcodeQty=outboundOrderDetail.NoStockOutQty, BarcodeUnit =outboundOrderDetail.BarcodeUnit, BarcodeQty = outboundOrderDetail.NoStockOutQty, BarcodeUnit = outboundOrderDetail.BarcodeUnit, BatchNo = outboundOrderDetail.BatchNo }; _outStockLockInfoService.AddData(newLockInfo); @@ -2842,18 +2852,18 @@ var documentNo = UniqueValueGenerator.Generate(); var outfeedmodel = new FeedbackOutboundRequestModel { reqCode = Guid.NewGuid().ToString(), reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), business_type = outboundOrder.BusinessType, factoryArea = outboundOrder.FactoryArea, operationType = 1, Operator = App.User.UserName, orderNo = outboundOrder.UpperOrderNo, documentsNO = documentNo, status = outboundOrder.OrderStatus, details = new List<FeedbackOutboundDetailsModel>() }; { reqCode = Guid.NewGuid().ToString(), reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), business_type = outboundOrder.BusinessType, factoryArea = outboundOrder.FactoryArea, operationType = 1, Operator = App.User.UserName, orderNo = outboundOrder.UpperOrderNo, documentsNO = documentNo, status = outboundOrder.OrderStatus, details = new List<FeedbackOutboundDetailsModel>() }; foreach (var detail in outboundOrder.Details) { // è·å该æç»å¯¹åºçæ¡ç ä¿¡æ¯ï¼ä»éå®è®°å½ï¼ @@ -2863,34 +2873,34 @@ (x.Status == (int)OutLockStockStatusEnum.æ£é宿 || x.Status == (int)OutLockStockStatusEnum.å·²ååº)) .ToListAsync(); var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) .Select(group => new FeedbackOutboundDetailsModel { var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) .Select(group => new FeedbackOutboundDetailsModel { materialCode = group.Key.MaterielCode, lineNo = group.Key.lineNo, warehouseCode = group.Key.WarehouseCode, qty = group.Sum(x => x.PickedQty), currentDeliveryQty = group.Sum(x => x.PickedQty), unit = group.Key.BarcodeUnit, barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel { barcode = lockInfo.CurrentBarcode, supplyCode = lockInfo.SupplyCode, batchNo = lockInfo.BatchNo, unit = lockInfo.BarcodeUnit, qty = lockInfo.PickedQty }).ToList() }).ToList(); outfeedmodel.details.AddRange(groupdata); } var result = await _invokeMESService.FeedbackOutbound(outfeedmodel); if (result != null && result.code == 200) { await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() .SetColumns(x => x.ReturnToMESStatus == 1) .Where(x => x.OrderId == outboundOrder.Id) .ExecuteCommandAsync(); materialCode = group.Key.MaterielCode, lineNo = group.Key.lineNo, warehouseCode = group.Key.WarehouseCode, qty = group.Sum(x => x.PickedQty), currentDeliveryQty = group.Sum(x => x.PickedQty), unit = group.Key.BarcodeUnit, barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel { barcode = lockInfo.CurrentBarcode, supplyCode = lockInfo.SupplyCode, batchNo = lockInfo.BatchNo, unit = lockInfo.BarcodeUnit, qty = lockInfo.PickedQty }).ToList() }).ToList(); outfeedmodel.details.AddRange(groupdata); } var result = await _invokeMESService.FeedbackOutbound(outfeedmodel); if (result != null && result.code == 200) { await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() .SetColumns(x => x.ReturnToMESStatus == 1) .Where(x => x.OrderId == outboundOrder.Id) .ExecuteCommandAsync(); await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() .SetColumns(x => x.ReturnToMESStatus == 1) ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/WIDESEA_OutboundService.csproj
@@ -15,6 +15,7 @@ <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" /> <ProjectReference Include="..\WIDESEA_IRecordService\WIDESEA_IRecordService.csproj" /> <ProjectReference Include="..\WIDESEA_IStockService\WIDESEA_IStockService.csproj" /> <ProjectReference Include="..\WIDESEA_ITaskInfoService\WIDESEA_ITaskInfoService.csproj" /> </ItemGroup> </Project> ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -84,6 +84,7 @@ private readonly IRecordService _recordService; private readonly IAllocateService _allocateService; private readonly IInvokeMESService _invokeMESService; private readonly ITask_HtyService _task_HtyService; public IRepository<Dt_Task> Repository => BaseDal; private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new() @@ -103,7 +104,7 @@ public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService) : base(BaseDal) public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService) : base(BaseDal) { _mapper = mapper; _unitOfWorkManage = unitOfWorkManage; @@ -126,8 +127,21 @@ _allocateOrderDetailRepository = allocateOrderDetailRepository; _allocateOrderRepository = allocateOrderRepository; _materialUnitService = materialUnitService; _task_HtyService = task_HtyService; } public async Task TaskStatusChange(string taskNum,TaskStatusEnum taskStatusEnum) { if (int.TryParse(taskNum, out var newTaskNum)) { await Db.Updateable<Dt_Task>().SetColumns(it => new Dt_Task { TaskStatus = taskStatusEnum.ObjToInt() }) .Where(it => it.TaskNum == newTaskNum) .ExecuteCommandAsync(); } } /// <summary> /// @@ -276,8 +290,12 @@ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); // BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.人工å é¤); if (!result) { await Db.Deleteable(task).ExecuteCommandAsync(); } _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup); @@ -325,8 +343,8 @@ }).ToList(); allocatefeedmodel.Details = groupedData; var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel); if (result != null && result.code == 200) var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel); if (feedbackresult != null && feedbackresult.code == 200) { _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 }) .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); @@ -381,8 +399,8 @@ }).ToList(); allocatefeedmodel.Details = groupedData; var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel); if (result != null && result.code == 200) var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel); if (feedbackresult != null && feedbackresult.code == 200) { _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 }) .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); @@ -429,8 +447,8 @@ }).ToList(); feedmodel.details = groupedData; var result = await _invokeMESService.FeedbackInbound(feedmodel); if (result != null && result.code == 200) var feedbackresult = await _invokeMESService.FeedbackInbound(feedmodel); if (feedbackresult != null && feedbackresult.code == 200) { _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 }) .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); @@ -536,8 +554,12 @@ var outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().First(x => x.OrderNo == task.OrderNo); task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? WIDESEA_Core.Enums.OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); // BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? WIDESEA_Core.Enums.OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.人工å é¤); if (!result) { await Db.Deleteable(task).ExecuteCommandAsync(); } _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); @@ -650,9 +672,13 @@ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); // å é¤ä»»å¡è®°å½ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); BaseDal.DeleteData(task); //BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); //BaseDal.DeleteData(task); var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.人工å é¤); if (!result) { await Db.Deleteable(task).ExecuteCommandAsync(); } // è®°å½è´§ä½ç¶æåæ´ _locationStatusChangeRecordService.AddLocationStatusChangeRecord( locationInfo, @@ -1105,7 +1131,7 @@ //ä¸ç¨åä¼ } else { { if (outboundOrder != null && outboundOrder.IsBatch == 0) { var feedmodel = new FeedbackOutboundRequestModel @@ -1187,7 +1213,7 @@ } else if (outboundOrder != null && outboundOrder.IsBatch == 1) { await _invokeMESService.BatchOrderFeedbackToMes(new List<string>(){outboundOrder.OrderNo },2); await _invokeMESService.BatchOrderFeedbackToMes(new List<string>() { outboundOrder.OrderNo }, 2); } } @@ -1227,9 +1253,18 @@ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); //_stockRepository.Db.Deleteable(stockInfo).ExecuteCommand(); // BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.人工å é¤); if (!result) { await Db.Deleteable(task).ExecuteCommandAsync(); } var stockresult = _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); if (!stockresult) { _stockRepository.Db.Deleteable(stockInfo).ExecuteCommand(); } _stockService.StockInfoService.DeleteData(stockInfo); _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/Task_HtyService.cs
@@ -1,5 +1,10 @@ using WIDESEA_Core.BaseRepository; using AutoMapper; using Microsoft.Extensions.Logging; using System.Transactions; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Enums; using WIDESEA_ITaskInfoService; using WIDESEA_Model.Models; @@ -7,7 +12,58 @@ public class Task_HtyService : ServiceBase<Dt_Task_Hty, IRepository<Dt_Task_Hty>>, ITask_HtyService { public Task_HtyService(IRepository<Dt_Task_Hty> BaseDal) : base(BaseDal) private readonly ILogger<Task_HtyService> _logger; private readonly IMapper _mapper; // AutoMapperå®ä¾ public Task_HtyService(IRepository<Dt_Task_Hty> BaseDal, IMapper mapper, ILogger<Task_HtyService> logger) : base(BaseDal) { _mapper = mapper; _logger = logger; } public bool DeleteAndMoveIntoHty(Dt_Task task, OperateTypeEnum operateType) { // using var transaction = Db.Ado.UseTran(); try { var historyEntity = _mapper.Map<Dt_Task_Hty>(task); // 2. å¡«å åå²å®ä½æ ¸å¿å段 historyEntity.SourceId = task.TaskId; historyEntity.OperateType = App.User?.UserName != null ? OperateTypeEnum.èªå¨å®æ.ToString() : OperateTypeEnum.äººå·¥å®æ.ToString(); historyEntity.Creater = App.User?.UserName != null ? App.User.UserName : "System"; // è¦çä¿®æ¹äºº/ä¿®æ¹æ¶é´ï¼ä¼å 级é«äºæ å°ï¼ // historyEntity.Modifier = App.User?.UserId > 0 ? App.User?.UserName : "System"; // historyEntity.ModifyDate = DateTime.Now; // 3. æå ¥åå²è¡¨ï¼ç±»åå®å ¨ï¼æ åå°æ¼æ¥è¡¨åï¼ int insertCount = Db.Insertable(historyEntity).ExecuteCommand(); if (insertCount <= 0) { _logger.LogError($"ä»»å¡åå²è¡¨Dt_Task_Hty [{task.TaskNum}]æå ¥å¤±è´¥ï¼å½±åè¡æ°ä¸º0"); // transaction.RollbackTran(); return false; } // 4. å é¤åå®ä½ï¼ç±»åå®å ¨ï¼ int deleteCount = Db.Deleteable(task).ExecuteCommand(); if (deleteCount <= 0) { _logger.LogError("ä»»å¡ä¸å¡å®ä½[{0}]å é¤å¤±è´¥ï¼å½±åè¡æ°ä¸º0", task.TaskNum); // transaction.RollbackTran(); return false; } //transaction.CommitTran(); _logger.LogInformation("ä»»å¡å®ä½[{0}]å·²æåç§»å ¥åå²è¡¨[{1}]å¹¶å é¤åæ°æ®", task.TaskNum); return true; } catch (Exception ex) { // transaction.RollbackTran(); _logger.LogError(ex, "ä»»å¡å é¤å®ä½[{0}]å¹¶ç§»å ¥åå²è¡¨å¤±è´¥", task.TaskNum); return false; } } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ESSController.cs
@@ -287,8 +287,7 @@ /// </summary> private async Task HandleTaskSuspended(StatusCallbackRequest request) { _logger.LogWarning("ä»»å¡æèµ·: TaskCode={TaskCode}, ç³»ç»ä»»å¡ç ={SysTaskCode}, åå ={Message}", request.TaskCode, request.SysTaskCode, request.Message); _logger.LogWarning("ä»»å¡æèµ·: TaskCode={TaskCode}, ç³»ç»ä»»å¡ç ={SysTaskCode}, åå ={Message}",request.TaskCode, request.SysTaskCode, request.Message); // è¿éæ·»å æ¨çæèµ·å¤çé»è¾ await Task.CompletedTask; @@ -299,8 +298,7 @@ /// </summary> private async Task HandleTaskAllocated(StatusCallbackRequest request) { _logger.LogInformation("ä»»å¡åé : TaskCode={TaskCode}, Robot={Robot}", request.TaskCode, request.RobotCode); _logger.LogInformation("ä»»å¡åé : TaskCode={TaskCode}, Robot={Robot}",request.TaskCode, request.RobotCode); // è¿éæ·»å æ¨çä»»å¡åé å¤çé»è¾ await Task.CompletedTask; @@ -313,8 +311,9 @@ { if (request.Status == WIDESEA_DTO.Basic.TaskStatus.success) { _logger.LogInformation("åç®±å®æ: Container={Container}, Location={Location}", request.ContainerCode, request.LocationCode); _logger.LogInformation("åç®±å®æ: Container={Container}, Location={Location}", request.ContainerCode, request.LocationCode); await _taskService.TaskStatusChange(request.TaskCode, WIDESEA_Common.TaskEnum.TaskStatusEnum.AGV_Pull); } else { @@ -333,8 +332,8 @@ { if (request.Status == WIDESEA_DTO.Basic.TaskStatus.success) { _logger.LogInformation("æ¾ç®±å®æ: Container={Container}, Location={Location}", request.ContainerCode, request.LocationCode); _logger.LogInformation("æ¾ç®±å®æ: Container={Container}, Location={Location}", request.ContainerCode, request.LocationCode); await _taskService.TaskStatusChange(request.TaskCode, WIDESEA_Common.TaskEnum.TaskStatusEnum.AGV_Puting); } else { ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs
@@ -22,6 +22,7 @@ using WIDESEA_IInboundService; using WIDESEA_InboundService; using WIDESEA_IOutboundService; using WIDESEA_ITaskInfoService; using WIDESEA_Model.Models; using WIDESEA_OutboundService; @@ -45,8 +46,9 @@ private readonly IOutStockLockInfoService _outStockLockInfoService; private readonly IOutboundOrderDetailService _outboundOrderDetailService; private readonly IRepository<Dt_Task> _taskRepository; private readonly ITask_HtyService _task_HtyService; 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, IRepository<Dt_Task> taskRepository) : 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, ITask_HtyService task_HtyService) : base(service) { this.erpApiService = erpApiService; _invokeMESService = invokeMESService; @@ -59,13 +61,22 @@ _outStockLockInfoService = outStockLockInfoService; _outboundOrderDetailService = outboundOrderDetailService; _taskRepository = taskRepository; _task_HtyService = task_HtyService; } [HttpPost, Route("Test"), AllowAnonymous, MethodParamsValidate] public async Task<WebResponseContent> Test() { var originalTask = _taskRepository.Db.Queryable<Dt_Task>().First(); _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.èªå¨å®æ); var result = _task_HtyService.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.人工å é¤); if (result) { var sddd = "trueee"; } //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(); @@ -74,7 +85,7 @@ //var pdddurchaseToStockResult = await _materialUnitService.ConvertFromToStockAsync("100513-00303", "W013", 1); //var sddd = _locationInfoService.AssignLocation(); //var sddd = _locationInfoService.AssignLocation(1); //var code = sddd.LocationCode; //var ssss=await _dailySequenceService.GetNextSequenceAsync(); //var ddddssss = "WSLOT" + DateTime.Now.ToString("yyyyMMddHHmmss") + ssss.ToString().PadLeft(5, '0'); @@ -108,7 +119,7 @@ //await erpApiService.GetMaterialInfoAsync(new WIDESEA_DTO.Basic.MaterialRequest()); return WebResponseContent.Instance.OK(); return WebResponseContent.Instance.OK(result?1:0 ); } /// <summary> ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Filter/CustomProfile.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks; using WIDESEA_Common.OrderEnum; using WIDESEA_Core.Helper; using WIDESEA_Core.HttpContextUser; using WIDESEA_DTO; using WIDESEA_DTO.Inbound; using WIDESEA_DTO.Outbound; @@ -33,6 +34,10 @@ CreateMap<Dt_ReceiveOrderDetail, Dt_CheckOrder>().ForMember(a => a.ReceivedQuantity, b => b.MapFrom(x => x.ReceivedQuantity)).ForMember(a => a.MaterielCode, b => b.MapFrom(x => x.MaterielCode)).ForMember(a => a.CheckOrderStatus, b => b.MapFrom(x => CheckOrderStatusEnum.NotCheck.ObjToInt())); CreateMap<Dt_Task, WMSTaskDTO>(); CreateMap<Dt_Task, Dt_Task_Hty>() .ForMember(dest => dest.SourceId, opt => opt.Ignore()) // æå¨å¡«å ï¼å¿½ç¥æ å° .ForMember(dest => dest.OperateType, opt => opt.Ignore()); // æå¨å¡«å ï¼å¿½ç¥æ å° } } }