ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue
@@ -12,13 +12,38 @@ > <div class="barcode-scanner-container"> <!-- ä»åºéæ© - ç´§åå¸å± --> <div class="location-section compact"> <el-form :model="form" :rules="rules" ref="locationForm" class="compact-form"> <el-form-item label="ä»åº" prop="warehouseType" class="location-select compact-item"> <el-select v-model="form.warehouseType" placeholder="è¯·éæ©ä»åº" clearable filterable @change="handleWarehouseChange" style="width: 100%" :loading="warehouseLoading" size="medium" > <el-option v-for="item in warehouseTypes" :key="item.warehouseType" :label="item.warehouseTypeDesc" :value="item.warehouseType" /> </el-select> </el-form-item> </el-form> </div> <!-- ä»åºåºåéæ© - ç´§åå¸å± --> <div class="location-section compact"> <el-form :model="form" :rules="rules" ref="locationForm" class="compact-form"> <el-form-item label="ä»åºåºå" prop="locationType" class="location-select compact-item"> <el-select v-model="form.locationType" placeholder="è¯·éæ©ä»åºåºå" placeholder="请å éæ©ä»åº" clearable filterable @change="handleLocationChange" @@ -40,6 +65,9 @@ <!-- æçä¿¡æ¯æ¾ç¤º - ç´§åå¸å± --> <div class="tray-info compact" v-if="trayBarcode"> <i class="el-icon-s-management"></i> å½åæç®±: {{ trayBarcode }} <span class="location-info" v-if="form.warehouseType"> | ä»åº: {{ currentWarehouseName }} </span> <span class="location-info" v-if="form.locationType"> | ä»åºåºå: {{ currentLocationDesc }} </span> @@ -52,7 +80,7 @@ <span><i class="el-icon-scanner"></i> æ«ç åºå</span> <span class="scan-status"> <span class="scan-indicator"></span> {{ form.locationType ? 'æ«ç 就绪' : '请å éæ©ä»åºåºå' }} {{ form.locationType && form.warehouseType ? 'æ«ç 就绪' : '请å éæ©ä»åºåä»åºåºå' }} </span> </div> @@ -64,7 +92,7 @@ v-model="trayBarcode" placeholder="è¯·æ«ææè¾å ¥æç®±ç åæå车é®" clearable :disabled="!form.locationType" :disabled="!form.locationType || !form.warehouseType" @keyup.enter.native="handleTraySubmit" @clear="handleTrayClear" @input="handleTrayInput" @@ -76,7 +104,7 @@ @click="handleTraySubmit" type="primary" icon="el-icon-position" :disabled="!form.locationType || !trayBarcode" :disabled="!form.locationType || !trayBarcode || !form.warehouseType" size="medium" > 确认 @@ -93,7 +121,7 @@ v-model="barcode" placeholder="è¯·æ«ææè¾å ¥ç©ææ¡ç åæå车é®" clearable :disabled="!form.locationType || !trayBarcode" :disabled="!form.locationType || !trayBarcode || !form.warehouseType" @keyup.enter.native="handleBarcodeSubmit" @clear="handleClear" @input="handleBarcodeInput" @@ -106,7 +134,7 @@ @click="handleBarcodeSubmit" type="primary" icon="el-icon-search" :disabled="!form.locationType || !trayBarcode || !barcode" :disabled="!form.locationType || !trayBarcode || !barcode || !from.warehouseType" size="medium" > {{ loading ? 'æ¥è¯¢ä¸...' : 'æ¥è¯¢' }} @@ -116,9 +144,10 @@ </div> <div class="input-tips compact-tips"> <p>æç¤ºï¼è¯·å éæ©ä»åºåºåï¼ç¶åè¾å ¥æç®±ç ï¼æåè¾å ¥ç©ææ¡ç </p> <p v-if="!form.locationType" class="warning-text">â ï¸ è¯·å éæ©ä»åºåºå</p> <p v-if="form.locationType && !trayBarcode" class="warning-text">â ï¸ è¯·å è¾å ¥æç®±ç </p> <p>æç¤ºï¼è¯·å éæ©ä»åº â éæ©ä»åºåºå â è¾å ¥æç®±ç â è¾å ¥ç©ææ¡ç </p> <p v-if="!form.warehouseType" class="warning-text">â ï¸ è¯·å éæ©ä»åº</p> <p v-if="!form.locationType && !form.warehouseType" class="warning-text">â ï¸ è¯·å éæ©ä»åºåºå</p> <p v-if="form.warehouseType && form.locationType && !trayBarcode" class="warning-text">â ï¸ è¯·å è¾å ¥æç®±ç </p> </div> </el-card> @@ -151,12 +180,14 @@ <el-tag type="primary" size="small">æªç»ç {{ totalStockCount }}</el-tag> <el-tag type="primary" size="small">æªå ¥åºæ°é {{ totalStockSum }}{{ uniqueUnit }}</el-tag> <el-tag v-if="trayBarcode" type="success" size="small">æç: {{ trayBarcode }}</el-tag> <el-tag v-if="form.warehouseType" type="info" size="small">ä»åº: {{ currentWarehouseName }}</el-tag> <el-tag v-if="form.locationType" type="info" size="small">åºå: {{ currentLocationDesc }}</el-tag> </span> </div> <div v-if="materials.length === 0" class="empty-state compact"> <i class="el-icon-document"></i> <p v-if="!form.warehouseType">请å éæ©ä»åº</p> <p v-if="!form.locationType">请å éæ©ä»åºåºå</p> <p v-else-if="!trayBarcode">请å è¾å ¥æç®±æ¡ç </p> <p v-else>ææ ç©ææ°æ®ï¼è¯·æ«ææè¾å ¥ç©ææ¡ç </p> @@ -177,7 +208,7 @@ <el-table-column prop="stockQuantity" label="æ°é" min-width="130" align="right"></el-table-column> <el-table-column prop="unit" label="åä½" width="80" align="center"></el-table-column> <el-table-column prop="supplyCode" label="ä¾åºå" min-width="130" show-overflow-tooltip></el-table-column> <el-table-column prop="warehouseCode" label="ä»åº" min-width="120" show-overflow-tooltip></el-table-column> <el-table-column prop="warehouseType" label="ä»åº" min-width="120" show-overflow-tooltip></el-table-column> </el-table> </div> </el-card> @@ -217,7 +248,7 @@ loading: false, error: '', debugMode: false, currentFocus: 'tray', currentFocus: 'warehouse', // æ«ç æªç¸å ³åé scanCode: '', @@ -234,11 +265,14 @@ uniqueUnit: '', sumLoading: false, sumError: '', // ä»åºç¸å ³åé warehouseTypes: [], warehouseLoading: false, // ä»åºåºåç¸å ³åé locationTypes: [], locationLoading: false, form: { warehouseType: null, locationType: null }, rules: { @@ -247,8 +281,14 @@ validator: this.validateLocationType, trigger: 'change' } ] } ], warehouseType: [ { massage:'è¯·éæ©ä»åº', trigger: 'change' } ] } } }, computed: { @@ -257,6 +297,11 @@ set(newVal) { this.$emit('update:visible', newVal); } }, currentDocNo() { return this.docNo; }, // å½åéæ©çä»åºåç§° currentWarehouseName() { const warehouse = this.warehouseTypes.find(item => item.warehouseType === this.form.warehouseType); return warehouse ? warehouse.warehouseTypeDesc : ''; }, // å½åéæ©çä»åºåºåæè¿° currentLocationDesc() { const location = this.locationTypes.find(item => item.locationType === this.form.locationType) @@ -274,7 +319,8 @@ this.$nextTick(() => { setTimeout(() => { // this.focusTrayInput(); this.initLocationTypes(); // åå§åä»åºåºå this.initwarehouseTypes(); // åå§åä»åº this.initLocationTypes(); // åå§åä»åºåºå this.fetchStockStatistics(); // å è½½ç»è®¡æ°æ® }, 300); }); @@ -298,6 +344,13 @@ } } }, 'form.warehouseType'(newVal) { if (newVal) { this.form.locationType = null; } else { this.locationTypes = []; } }, mounted() { @@ -322,10 +375,11 @@ */ validateLocationType(rule, value, callback) { // æ£æ¥å¼æ¯å¦ä¸ºnullãundefinedæç©ºå符串ï¼ä½å 许æ°å0 if (value === null || value === undefined || value === '') { if (!this.form.warehouseType) { callback(new Error('请å éæ©ä»åº')); } else if (value === null || value === undefined || value === '') { callback(new Error('è¯·éæ©ä»åºåºå')); } else { // å¼ä¸º0æå ¶ä»ææå¼é½éè¿éªè¯ callback(); } }, @@ -358,6 +412,36 @@ } }, /** * åå§åä»åºæ°æ® */ async initwarehouseTypes() { this.warehouseLoading = true; this.error = ''; try { const response = await http.post('/api/Warehouse/GetwarehouseTypes'); if (response.status && Array.isArray(response.data)) { this.warehouseTypes = response.data; if (this.warehouseTypes.length === 0) { this.error = 'æªè·åå°ä»åºæ°æ®'; } else { // 妿æé»è®¤åºåï¼å¯ä»¥å¨è¿é设置 // this.form.locationType = this.locationTypes[0].locationType; } } else { this.error = 'è·åä»åºæ°æ®å¤±è´¥'; } } catch (error) { console.error('è·åä»åºå¤±è´¥:', error); this.error = `è·åä»åºå¤±è´¥: ${error.message || 'ç½ç»é误'}`; } finally { this.warehouseLoading = false; } }, /** * ä»åºåºååæ´å¤ç */ @@ -379,14 +463,42 @@ if (!errorMsg && (value === 0 || value)) { console.log('ä»åºåºåéªè¯éè¿:', value); // åºåéæ©åï¼èªå¨èç¦å°æçè¾å ¥æ¡ this.focusTrayInput(); this.focusLocationSelect(); } }); }, 100); } }); }, // æ°å¢ï¼æ¥è¯¢å端åºåç»è®¡æ°æ®ï¼è°ç¨ä¹åç SumQuantity æ¥å£ï¼ /** * ä»åºåæ´å¤ç */ handleWarehouseChange(value) { console.log('éæ©ä»åº:', value, 'ç±»å:', typeof value, this.currentWarehouseName); // ç«å³æ¸ é¤éè¯¯ä¿¡æ¯ this.error = ''; // æå¨è§¦å表åéªè¯æ´æ° this.$nextTick(() => { if (this.$refs.locationForm) { // æ¸ é¤è¯¥å段çéªè¯ç¶æï¼ç¶åéæ°éªè¯ this.$refs.locationForm.clearValidate('warehouseType'); // çæå»¶è¿åéæ°éªè¯ï¼ç¡®ä¿DOMå·²æ´æ° setTimeout(() => { this.$refs.locationForm.validateField('warehouseType', (errorMsg) => { if (!errorMsg && (value === 0 || value)) { console.log('ä»åºéªè¯éè¿:', value); this.focusLocationSelect(); } }); }, 100); } }); }, async fetchStockStatistics() { // åæ®å·ä¸ºç©ºæ¶ä¸æ¥è¯¢ if (!this.docNo) { @@ -435,7 +547,10 @@ resolve(true); } else { // æå¨æ£æ¥locationTypeï¼æ£ç¡®å¤çå¼ä¸º0çæ åµ if (this.form.locationType === null || this.form.locationType === undefined || this.form.locationType === '') { if(!this.from.warehouseType){ this.error='请å éæ©ä»åº'; } else if(this.form.locationType === null || this.form.locationType === undefined || this.form.locationType === '') { this.error = '请å éæ©ä»åºåºå'; //this.$message.warning('请å éæ©ä»åºåºå'); } else { @@ -447,10 +562,19 @@ }); }); }, focusWarehouseSelect() { if (this.$refs.locationForm) { const selectEl = this.$el.querySelector('.location-select:first-child .el-input__inner'); if (selectEl) { selectEl.focus(); this.currentFocus = 'warehouse'; } } }, // èç¦å°ä»åºåºåéæ© focusLocationSelect() { if (this.$refs.locationForm) { const selectEl = this.$el.querySelector('.el-select .el-input__inner'); const selectEl = this.$el.querySelector('.location-select:nth-child(2) .el-input__inner'); if (selectEl) { selectEl.focus(); this.currentFocus = 'location'; @@ -492,14 +616,19 @@ this.lastKeyTime = null; this.isManualInput = false; this.isScanning = false; this.currentFocus = 'location'; this.currentFocus = 'warehouse'; this.scanTarget = 'tray'; this.clearAllTimers(); this.totalStockSum = 0; this.totalStockCount = 0; this.sumLoading = false; this.sumError = ''; this.form.locationType = null; this.form={ warehouseType:null, locationType:null } this.warehouseTypes=[]; this.locationTypes=[]; // æ¸ é¤è¡¨åéªè¯ç¶æ this.$nextTick(() => { if (this.$refs.locationForm) { @@ -527,14 +656,15 @@ // 使ç¨setTimeoutç¡®ä¿DOMå®å ¨æ¸²æååèç¦ this.$nextTick(() => { setTimeout(() => { this.initwarehouseTypes(); this.initLocationTypes(); // åå§åä»åºåºå // ç¡®ä¿è¡¨åå¼ç¨åå¨ååèç¦ if (this.$refs.locationForm) { this.focusLocationSelect(); this.focusWarehouseSelect(); } else { // å¦æè¡¨åå¼ç¨è¿ä¸åå¨ï¼ç¨åéè¯ setTimeout(() => { this.focusLocationSelect(); this.focusWarehouseSelect(); }, 500); } }, 300); @@ -567,6 +697,8 @@ } const result = { warehouseType:this.form.warehouseType, warehouseName:this.currentWarehouseName, locationType: this.form.locationType, locationDesc: this.currentLocationDesc, trayBarcode: this.trayBarcode, @@ -615,6 +747,10 @@ // å¤çæçæ¡ç æäº¤ async handleTraySubmit() { // å ç´æ¥æ£æ¥locationTypeï¼é¿å 表åéªè¯ç弿¥é®é¢ if (!this.form.warehouseType) { this.error = '请å éæ©ä»åº'; return; } if (!this.form.locationType) { this.error = '请å éæ©ä»åºåºå'; //this.$message.warning('请å éæ©ä»åºåºå'); @@ -755,7 +891,8 @@ orderNo: this.docNo, barcodes: barcode, locationTypeDesc: this.currentLocationDesc, locationType: this.form.locationType // æ·»å ä»åºåºåä¿¡æ¯ locationType: this.form.locationType, // æ·»å ä»åºåºåä¿¡æ¯ warehouseType:this.form.warehouseType } ); ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js
@@ -1,8 +1,8 @@ //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè éæ°é ç½®çæç代ç import http from '@/api/http.js' import { h,createVNode, render,reactive } from 'vue'; import { ElDialog , ElForm, ElFormItem, ElInput, ElButton, ElMessage } from 'element-plus'; // å¼å ¥ElMessageï¼è§£å³æç¤ºæ ååº import { h,createVNode, render,reactive,ref } from 'vue'; import { ElDialog , ElForm, ElFormItem, ElInput, ElButton, ElMessage ,ElSelect ,ElOption } from 'element-plus'; // å¼å ¥ElMessageï¼è§£å³æç¤ºæ ååº let extension = { components: { @@ -101,16 +101,93 @@ const mountNode = document.createElement('div'); document.body.appendChild(mountNode); // ååºå¼è¡¨åæ°æ®ï¼æç®±ç æ¹ä¸ºå¯éå¡«ï¼åå§ç©ºåç¬¦ä¸²ï¼ // ååºå¼è¡¨åæ°æ®ï¼æç®±ç ï¼å¿ å¡«ï¼æ«ç æª/æå¨è¾å ¥ï¼ const formData = reactive({ boxCode: '' // æç®±ç ï¼stringç±»åï¼å¯ç©ºï¼ boxCode: '', warehouseCode:'' }); const warehouses = ref([]); const isLoadingWarehouses = ref(false); const getWarehouseList = async () => { isLoadingWarehouses.value = true; try { const { data, status } = await http.post('/api/Warehouse/GetWarehouseTypes'); if (status && Array.isArray(data)) { // æ ¼å¼åä»åºé项ï¼éé ElSelectçlabel-valueæ ¼å¼ warehouses.value = data.map(item => ({ label: item.warehouseTypeDesc, value: item.warehouseType })); } else { ElMessage.error('è·åä»åºå表失败'); warehouses.value = []; } } catch (err) { ElMessage.error('ä»åºæ°æ®è¯·æ±å¼å¸¸ï¼è¯·ç¨åéè¯'); warehouses.value = []; } finally { isLoadingWarehouses.value = false; } }; // æäº¤è¡¨åçç»ä¸é»è¾ï¼ä¾å车触ååæé®ç¹å»å ±ç¨ï¼ const submitForm = async () => { const formRef = vnode.component.refs.batchInForm; try { // æ§è¡è¡¨åæ ¡éªï¼æç®±ç å¿ å¡«ï¼ await formRef.validate(); } catch (err) { ElMessage.warning('请è¾å ¥ææçæç®±ç '); return; } http.post('/api/InboundOrder/EmptyMaterielGroup', { palletCode: formData.boxCode.trim(), warehouseCode:formData.warehouseCode }).then(({ data, status, message }) => { if (status) { ElMessage.success(`å ¥åºæåï¼æç®±ç ï¼${formData.boxCode.trim()}`); this.refresh(); formData.boxCode = ''; setTimeout(() => { const inputRef = vnode.component.refs.boxCodeInput; inputRef?.focus(); }, 100); } else { ElMessage.error(message || data?.message || 'å ¥åºå¤±è´¥'); selectBoxCodeInput(); } }).catch(() => { ElMessage.error('请æ±å¤±è´¥ï¼è¯·ç¨åéè¯'); selectBoxCodeInput(); }); }; const selectBoxCodeInput = () => { setTimeout(() => { const inputRef = vnode.component.refs.boxCodeInput; if (inputRef) { const targetInput = inputRef.$el?.querySelector('input') || inputRef; targetInput?.focus(); targetInput?.select(); } }, 100); } const vnode = createVNode(ElDialog, { title: '空æçå ¥åº', width: '400px', modelValue: true, appendToBody: true, onOpened: async () => { await getWarehouseList(); const inputRef = vnode.component.refs.boxCodeInput; inputRef?.focus(); }, 'onUpdate:modelValue': (isVisible) => { if (!isVisible) { render(null, mountNode); @@ -121,25 +198,54 @@ default: () => h(ElForm, { model: formData, rules: { // æç®±ç æ ¡éªï¼ä» ä¿çå符串类åï¼ç§»é¤å¿ å¡«è¦æ±ï¼ç©ºå¼å¯éè¿ï¼ boxCode: [ { required: true, message: '请è¾å ¥æç®±ç ', trigger: 'blur' }, { type: 'string', message: 'æç®±ç å¿ é¡»ä¸ºå符串', trigger: 'blur' } { required: true, message: '请è¾å ¥æç®±ç ', trigger: ['blur', 'enter'] } ], warehouseCode:[ { required: true, message: 'è¯·éæ©ä»åº', trigger: ['change', 'blur'] } ] }, ref: 'batchInForm' }, [ // æç®±ç è¾å ¥é¡¹ï¼å¯éå¡«ï¼ h(ElFormItem, { label: 'æç®±ç ', prop: 'boxCode',required:true }, [ //ä»åºæ°æ® h(ElFormItem, { label: 'ä»åº', prop: 'warehouseCode', required: true }, [ h(ElSelect, { modelValue: formData.warehouseCode, 'onUpdate:modelValue': (val) => { formData.warehouseCode = val; }, placeholder: 'è¯·éæ©å ¥åºä»åº', filterable: true, // æ¯ææç´¢ä»åº loading: isLoadingWarehouses.value, // å è½½ç¶æ style: { width: '100%' } }, [ // 渲æä»åºä¸æé项 warehouses.value.map(item => h(ElOption, { label: item.label, value: item.value })) ]) ]), // æç®±ç è¾å ¥é¡¹ï¼æ¯æèç¦ãå车æäº¤ï¼ h(ElFormItem, { label: 'æç®±ç ', prop: 'boxCode', required: true }, [ h(ElInput, { type: 'text', modelValue: formData.boxCode, 'onUpdate:modelValue': (val) => { formData.boxCode = val; }, ref: 'boxCodeInput', placeholder: 'æ«ç è¾å ¥ææå¨è¾å ¥æç®±ç ', // çå¬å车äºä»¶ï¼æ«ç æªé»è®¤ä¼åéåè½¦ï¼ onKeydown: (e) => { if (e.key === 'Enter') { e.preventDefault(); submitForm(); } } }) ]), // åºé¨æé®åºï¼ä¿æä¸åï¼ // åºé¨æé®åº h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [ h(ElButton, { type: 'text', @@ -151,30 +257,7 @@ }, 'åæ¶'), h(ElButton, { type: 'primary', onClick: async () => { const formRef = vnode.component.refs.batchInForm; try { await formRef.validate(); // 空å¼å¯éè¿æ ¡éª } catch (err) { return; } // å ¥åºæ¥å£æäº¤ï¼æç®±ç 为空æ¶ä¼ é空å符串ï¼åç«¯éæ¯æè¯¥å段å¯é http.post('/api/InboundOrder/EmptyMaterielGroup', { palletCode: formData.boxCode // å¯ç©ºï¼ç¨æ·è¾å ¥æç©ºå符串 }).then(({ data, status, message }) => { if (status) { ElMessage.success(`å ¥åºæå${formData.boxCode ? 'ï¼æç®±ç ï¼' + formData.boxCode : ''}`); this.refresh(); render(null, mountNode); document.body.removeChild(mountNode); } else { ElMessage.error(message || data?.message || 'å ¥åºå¤±è´¥'); } }).catch(() => { ElMessage.error('请æ±å¤±è´¥ï¼è¯·ç¨åéè¯'); }); } onClick: submitForm }, 'ç¡®å®') ]) ]) @@ -184,7 +267,7 @@ render(vnode, mountNode); } } ], box: [], detail: [] }, //æ©å±çæé® ], box: [], detail: [] }, methods: { //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ onInit() { ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_BasicService/WarehouseService.cs
@@ -116,6 +116,15 @@ return WebResponseContent.Instance.OK(); } public List<WarehouseDTO> GetWarehouseTypes() { return _warehouseArearepository.Db.Queryable<Dt_WarehouseArea>().Select(x => new WarehouseDTO { WarehouseType = x.Code, WarehouseTypeDesc = $"{x.Code}-{x.Name}" }).ToList(); } } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Basic/WarehouseDTO.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,14 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WIDESEA_DTO.Basic { public class WarehouseDTO { public string WarehouseType { get; set; } public string WarehouseTypeDesc { get; set; } } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/MaterielGroupDTO.cs
@@ -35,6 +35,8 @@ public string locationType { get; set; } public string WarehouseType { get; set; } public string locationTypeDesc { get; set; } } @@ -44,6 +46,6 @@ [PropertyValidate("æçç¼å·", NotNullAndEmpty = true)] public string PalletCode { get; set; } public string WarehouseCode { get; set; } } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IBasicService/IWarehouseService.cs
@@ -16,5 +16,7 @@ IRepository<Dt_Warehouse> Repository { get; } Task<WebResponseContent> ReceiveWarehouseArea(List<WarehouseAreaDto> models); List<WarehouseDTO> GetWarehouseTypes(); } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -37,9 +37,10 @@ private readonly IRepository<Dt_StockInfoDetail> _stockDetailRepository; private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository; private readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository; private readonly IRepository<Dt_StockInfo> _stockRepository; public IRepository<Dt_InboundOrder> Repository => BaseDal; public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository) : base(BaseDal) public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository,IRepository<Dt_StockInfo> stockRepository) : base(BaseDal) { _mapper = mapper; _unitOfWorkManage = unitOfWorkManage; @@ -51,6 +52,7 @@ _stockDetailRepository = stockDetailRepository; _inboundOrderRepository = inboundOrderRepository; _warehouseAreaRepository = warehouseAreaRepository; _stockRepository = stockRepository; } public async Task<WebResponseContent> ReceiveInboundOrder(List<Dt_InboundOrder> models, int operateType) @@ -320,6 +322,14 @@ (bool, string, object?) result2 = ModelValidate.ValidateModelData(materielGroupDTO); if (!result2.Item1) return content = WebResponseContent.Instance.Error(result2.Item2); // materielGroupDTO.WarehouseCode var code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == materielGroupDTO.WarehouseType).Select(x=>x.Code).First(); if(string.IsNullOrEmpty(code)) { return content = WebResponseContent.Instance.Error($"ä»åºä¸æ²¡æè¯¥{materielGroupDTO.WarehouseType}ç¼å·ã"); } Dt_InboundOrder inboundOrder = GetInboundOrder(materielGroupDTO.OrderNo); var dbinboundOrderDetails = _inboundOrderDetailService.GetByBarcode(materielGroupDTO.Barcodes); @@ -343,9 +353,7 @@ stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None,LocationType=materielGroupDTO.locationType.ObjToInt() }; stockInfo.Details = new List<Dt_StockInfoDetail>(); } var warehouseareas = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().ToList(); var warehousearea = warehouseareas.FirstOrDefault(x => x.Name == materielGroupDTO.locationTypeDesc && x.FactoryArea == inboundOrder.FactoryArea); foreach (var item in dbinboundOrderDetails) { stockInfo.Details.Add(new Dt_StockInfoDetail @@ -357,7 +365,7 @@ Unit = item.Unit, InboundOrderRowNo = item.lineNo, SupplyCode = item.SupplyCode, WarehouseCode = warehousearea!=null? warehousearea.Code: item.WarehouseCode, WarehouseCode = materielGroupDTO.WarehouseType, StockQuantity = item.OrderQuantity, Status = 0, OrderNo = inboundOrder.InboundOrderNo, @@ -367,7 +375,7 @@ item.ReceiptQuantity = item.BarcodeQty; item.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); item.WarehouseCode = warehousearea != null ? warehousearea.Code : ""; item.WarehouseCode = materielGroupDTO.WarehouseType; } if (stockInfo.Id == 0) @@ -415,6 +423,15 @@ (bool, string, object?) result2 = ModelValidate.ValidateModelData(materielGroupDTO); if (!result2.Item1) return content = WebResponseContent.Instance.Error(result2.Item2); var code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == materielGroupDTO.WarehouseCode).Select(x => x.Code).First(); if (string.IsNullOrEmpty(code)) { return content = WebResponseContent.Instance.Error($"ä»åºä¸æ²¡æè¯¥{materielGroupDTO.WarehouseCode}ç¼å·ã"); } if(_stockRepository.QueryFirst(x=>x.PalletCode == materielGroupDTO.PalletCode)!=null){ return WebResponseContent.Instance.Error("该æçå·²ç»ç»è¿ç"); } Dt_StockInfo? stockInfo = _stockService.StockInfoService.GetStockByPalletCode(materielGroupDTO.PalletCode); if (stockInfo != null && !string.IsNullOrEmpty(stockInfo.LocationCode) && stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt()) ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/WarehouseController.cs
@@ -48,6 +48,11 @@ else return WebResponseContent.Instance.Error(content.Message); } [HttpPost, Route("GetWarehouseTypes"), AllowAnonymous, MethodParamsValidate] public WebResponseContent GetWarehouseTypes() { var lists = Service.GetWarehouseTypes(); return WebResponseContent.Instance.OK("", lists); } } }