| | |
| | | let loadingInstance; |
| | | let loadingStatus = false; |
| | | if (process.env.NODE_ENV == 'development') { |
| | | axios.defaults.baseURL = window.webConfig.webApiBaseUrl; |
| | | axios.defaults.baseURL = 'http://127.0.0.1:9291/'; |
| | | // axios.defaults.baseURL = window.webConfig.webApiBaseUrl; |
| | | } |
| | | else if (process.env.NODE_ENV == 'debug') { |
| | | axios.defaults.baseURL = 'http://127.0.0.1:8098/'; |
| | |
| | | <template> |
| | | <vol-box v-model="groupPalletVisible" :title="'ç»çæä½ - åæ®å·ï¼' + currentDocNo" :height="1000" :width="1100" :padding="20" |
| | | :modal="true" @open="handleDialogOpen" @close="handleDialogClose"> |
| | | <vol-box v-model="show" :title="'ç»çæä½ - åæ®å·ï¼' + orderNo" :height="1000" :width="1100" :padding="20" :modal="true"> |
| | | <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-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" |
| | |
| | | |
| | | <!-- æçæ¡ç è¾å
¥ --> |
| | | <div class="input-wrapper custom-input-group compact-input"> |
| | | <div class="input-label">æç®±ç </div> |
| | | <div class="input-label">æçæ¡ç </div> |
| | | <el-input ref="trayInput" v-model="trayBarcode" placeholder="è¯·æ«ææè¾å
¥æç®±ç åæå车é®" clearable |
| | | :disabled="!form.locationType || !form.warehouseType" @keyup.enter.native="handleTraySubmit" |
| | | @clear="handleTrayClear" @input="handleTrayInput" class="custom-input" size="medium"> |
| | |
| | | </span> |
| | | </div> |
| | | |
| | | |
| | | <div class="table-container"> |
| | | <el-table :data="unpalletMaterials" stripe style="width: 100%" height="100%" size="small" v-loading="unpalletBarcodesLoading"> |
| | | |
| | | <div class="table-container"> |
| | | <el-table :data="unpalletMaterials" stripe style="width: 100%" height="100%" size="small" |
| | | v-loading="unpalletBarcodesLoading"> |
| | | <el-table-column type="index" label="åºå·" width="60" align="center"></el-table-column> |
| | | <el-table-column prop="barcode" label="æ¡ç " min-width="140" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="materielCode" label="ç©æç¼ç " min-width="150" show-overflow-tooltip></el-table-column> |
| | |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | |
| | | |
| | | </div> |
| | | |
| | | <!-- ç©æå表 - åºå®é«åº¦å¸¦æ»å¨æ¡ --> |
| | |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="handleCancel">åæ¶</el-button> |
| | | <el-button type="primary" @click="handleConfirm">确认</el-button> |
| | | </div> --> |
| | | <template #footer> |
| | | <el-button type="danger" size="small" @click="handleDialogClose()">å
³é</el-button> |
| | | </template> |
| | | </vol-box> |
| | | </template> |
| | | <script> |
| | | import http from '@/api/http.js'; |
| | | import VolBox from '@/components/basic/VolBox.vue'; |
| | | import VolForm from '@/components/basic/VolForm.vue'; |
| | | import VolTable from '@/components/basic/VolTable.vue'; |
| | | import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'; |
| | | import { ref, onMounted, onUnmounted } from 'vue' |
| | | import InboundOrder from '../../../views/inbound/inboundOrder.vue'; |
| | | import { th } from 'element-plus/es/locales.mjs'; |
| | | |
| | | export default { |
| | | name: 'BarcodeScanner', |
| | | components: { VolBox, VolForm, VolTable }, |
| | | props: { |
| | | docNo: { type: String, required: true, default: '' }, |
| | | visible: { type: Boolean, required: true, default: false } |
| | | }, |
| | | |
| | | components: { VolBox }, |
| | | data() { |
| | | return { |
| | | show: false, |
| | | orderNo: "", |
| | | palletVisible: this.visible, |
| | | trayBarcodeReg:/^[A-Z]\d{9}$/, |
| | | trayBarcodeReg: /^[A-Z]\d{9}$/, |
| | | trayBarcode: '', |
| | | barcode: '', |
| | | materials: [], |
| | |
| | | debugMode: false, |
| | | currentFocus: 'warehouse', |
| | | |
| | | unpalletBarcodes:[], |
| | | unpalletBarcodes: [], |
| | | unpalletBarcodesLoading: false, |
| | | unpalletMaterials: [], // æªç»çè¯¦ç»æ°æ®å表 |
| | | |
| | |
| | | trigger: 'change' |
| | | } |
| | | ], |
| | | trayBarcode:[ |
| | | trayBarcode: [ |
| | | { |
| | | pattern: this.trayBarcodeReg, |
| | | message: 'æçå·æ ¼å¼é误ï¼é为1个大å忝+9个æ°åï¼å¦A000008024ï¼', |
| | | trigger: 'blur' |
| | | } |
| | | } |
| | | ], |
| | | warehouseType: [ |
| | | { |
| | |
| | | } |
| | | } |
| | | }, |
| | | |
| | | computed: { |
| | | groupPalletVisible: { |
| | | get() { return this.visible; }, |
| | | set(newVal) { this.$emit('update:visible', newVal); } |
| | | }, |
| | | currentDocNo() { return this.docNo; }, |
| | | // å½åéæ©çä»åºåç§° |
| | | currentWarehouseName() { |
| | | const warehouse = this.warehouseTypes.find(item => item.warehouseType === this.form.warehouseType); |
| | |
| | | this.resetData(); |
| | | this.$nextTick(() => { |
| | | setTimeout(() => { |
| | | // this.focusTrayInput(); |
| | | this.initwarehouseTypes(); // åå§åä»åº |
| | | this.initLocationTypes(); // åå§åä»åºåºå |
| | | this.fetchStockStatistics(); // å è½½ç»è®¡æ°æ® |
| | | this.fetchUnpalletMaterialDetails(); |
| | | }, 300); |
| | |
| | | } |
| | | } |
| | | }, |
| | | 'form.warehouseType'(newVal) { |
| | | if (newVal) { |
| | | this.form.locationType = null; |
| | | } else { |
| | | this.locationTypes = []; |
| | | } |
| | | }, |
| | | |
| | | mounted() { |
| | | |
| | | // æ·»å å
¨å±é®ççå¬ |
| | | document.addEventListener('keypress', this.handleKeyPress); |
| | | |
| | | // 使ç¨setTimeoutç¡®ä¿DOMå®å
¨æ¸²æååèç¦ |
| | | setTimeout(() => { |
| | | // this.focusTrayInput(); |
| | | this.focusLocationSelect(); |
| | | }, 300); |
| | | }, |
| | | beforeDestroy() { |
| | | // æ¸
çäºä»¶çå¬ |
| | | document.removeEventListener('keypress', this.handleKeyPress); |
| | | this.clearAllTimers(); |
| | | }, |
| | | methods: { |
| | | /** |
| | | * èªå®ä¹ä»åºåºåéªè¯ |
| | | * å
许å¼ä¸º0ï¼å 为0æ¯åæ³çlocationType |
| | | */ |
| | | open() { |
| | | this.show = true; |
| | | this.initLocationTypes(); |
| | | this.initwarehouseTypes(); |
| | | this.fetchStockStatistics(); |
| | | this.fetchUnpalletMaterialDetails(); |
| | | }, |
| | | validateLocationType(rule, value, callback) { |
| | | // æ£æ¥å¼æ¯å¦ä¸ºnullãundefinedæç©ºå符串ï¼ä½å
许æ°å0 |
| | | if (!this.form.warehouseType) { |
| | | callback(new Error('请å
éæ©ä»åº')); |
| | | } else if (value === null || value === undefined || value === '') { |
| | |
| | | callback(); |
| | | } |
| | | }, |
| | | |
| | | |
| | | // æ ¹æ®æ¡ç å表è·åè¯¦ç»æ°æ® |
| | | async fetchUnpalletMaterialDetails() { |
| | | try { |
| | | // å°è¯è°ç¨æ¥å£è·åè¯¦ç»æ°æ® |
| | | // 注æï¼å¦æè¿ä¸ªæ¥å£ä¸åå¨ï¼å¯ä»¥æ³¨éæææ ¹æ®å®é
APIè°æ´ |
| | | const response = await http.post('/api/InboundOrder/UnPalletGroupBarcode?orderNo='+this.docNo, { |
| | | |
| | | }); |
| | | |
| | | console.log('æªç»çæ°æ®:', response.data); |
| | | |
| | | |
| | | const response = await http.post('/api/InboundOrder/UnPalletGroupBarcode?orderNo=' + this.docNo, {}); |
| | | if (response.status && Array.isArray(response.data)) { |
| | | this.unpalletMaterials = response.data; |
| | | this.unpalletBarcodes = response.data.map(item => item.barcode || ''); |
| | | this.totalStockCount = response.data.length; |
| | | } else { |
| | | // 妿æ¥å£è¿åæ ¼å¼ä¸åï¼å°è¯å
¶ä»æ¹å¼ |
| | | // 妿æ¥å£ä¸åå¨ï¼è¿éä¼è¿å
¥catchï¼è®¾ç½®ä¸ºç©ºæ°ç» |
| | | this.unpalletMaterials = []; |
| | | } |
| | | } catch (err) { |
| | | console.warn('è·åæªç»çè¯¦ç»æ°æ®æ¥å£å¯è½ä¸åå¨ï¼ä½¿ç¨æ¡ç å表æ¾ç¤ºï¼', err); |
| | | // 妿æ¥å£ä¸åå¨ï¼å°æ¡ç å表转æ¢ä¸ºç®åçæ¾ç¤ºæ ¼å¼ |
| | | // æè
ä¿æä¸ºç©ºï¼è®©ç¨æ·ç¥ééè¦éæ©ä»åºååºåæ¥æ¥çè¯¦ç»æ°æ® |
| | | this.unpalletMaterials = this.unpalletBarcodes.map(barcode => ({ |
| | | barcode: barcode, |
| | | materielCode: '-', |
| | |
| | | })); |
| | | } |
| | | }, |
| | | /** |
| | | * åå§åä»åºåºåæ°æ® |
| | | */ |
| | | async initLocationTypes() { |
| | | this.locationLoading = true; |
| | | this.error = ''; |
| | | |
| | | try { |
| | | const response = await http.post('/api/LocationInfo/GetLocationTypes'); |
| | | |
| | | if (response.status && Array.isArray(response.data)) { |
| | | this.locationTypes = response.data; |
| | | if (this.locationTypes.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.locationLoading = false; |
| | | const { data } = await this.http.post("api/LocationInfo/GetLocationTypes") |
| | | this.locationTypes = data |
| | | } catch (e) { |
| | | this.$message.error('è·ååºåç±»å失败') |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * åå§åä»åºæ°æ® |
| | | */ |
| | | 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; |
| | | const { data } = await this.http.post("api/Warehouse/GetwarehouseTypes") |
| | | this.warehouseTypes = data |
| | | } catch (e) { |
| | | this.$message.error('è·ååºåç±»å失败') |
| | | } |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * ä»åºåºååæ´å¤ç |
| | | */ |
| | | handleLocationChange(value) { |
| | | console.log('éæ©ä»åºåºå:', value, 'ç±»å:', typeof value, this.currentLocationDesc); |
| | | |
| | | // ç«å³æ¸
é¤éè¯¯ä¿¡æ¯ |
| | | this.error = ''; |
| | | |
| | | // æå¨è§¦å表åéªè¯æ´æ° |
| | | this.$nextTick(() => { |
| | | if (this.$refs.locationForm) { |
| | | // æ¸
é¤è¯¥å段çéªè¯ç¶æï¼ç¶åéæ°éªè¯ |
| | | this.$refs.locationForm.clearValidate('locationType'); |
| | | |
| | | // çæå»¶è¿åéæ°éªè¯ï¼ç¡®ä¿DOMå·²æ´æ° |
| | | setTimeout(() => { |
| | | this.$refs.locationForm.validateField('locationType', (errorMsg) => { |
| | | if (!errorMsg && (value === 0 || value)) { |
| | | console.log('ä»åºåºåéªè¯éè¿:', value); |
| | | // åºåéæ©åï¼èªå¨èç¦å°æçè¾å
¥æ¡ |
| | | this.focusLocationSelect(); |
| | | // å·æ°æªç»çæ°æ®ï¼æ ¹æ®éæ©çä»åºååºåè¿æ»¤ï¼ |
| | | } |
| | | }); |
| | | }, 100); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * ä»åºåæ´å¤ç |
| | | */ |
| | | 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() { |
| | |
| | | this.sumLoading = true; |
| | | this.sumError = ''; |
| | | try { |
| | | // è°ç¨å端ç»è®¡æ¥å£ï¼æ¿æ¢ä¸ºä½ çå®é
æ¥å£è·¯å¾ï¼ |
| | | const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + this.docNo, { |
| | | |
| | | }); |
| | | |
| | | // ç»å®æ°æ®ï¼å¹é
PalletSumQuantityDTO ç»æï¼ |
| | | const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + this.docNo, {}); |
| | | if (response.data) { |
| | | this.totalStockSum = response.data.stockSumQuantity || 0; // æ»åºåæ°é |
| | | this.totalStockCount = response.data.stockCount || 0; // æ»åºåè®°å½æ° |
| | | this.uniqueUnit = response.data.uniqueUnit || ''; // 计éåä½ |
| | | this.totalStockSum = response.data.stockSumQuantity || 0; |
| | | this.totalStockCount = response.data.stockCount || 0; |
| | | this.uniqueUnit = response.data.uniqueUnit || ''; |
| | | } |
| | | } catch (err) { |
| | | this.sumError = 'ç»è®¡å 载失败'; |
| | | this.totalStockSum = 0; |
| | | this.totalStockCount = 0; |
| | | console.error('åºåç»è®¡æ¥è¯¢å¼å¸¸ï¼', err); |
| | | } finally { |
| | | this.sumLoading = false; |
| | | } |
| | | }, |
| | | /** |
| | | * 表åéªè¯ |
| | | */ |
| | | |
| | | async validateForm() { |
| | | return new Promise((resolve) => { |
| | | if (!this.$refs.locationForm) { |
| | |
| | | this.error = ''; |
| | | resolve(true); |
| | | } else { |
| | | // æå¨æ£æ¥locationTypeï¼æ£ç¡®å¤çå¼ä¸º0çæ
åµ |
| | | 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 { |
| | | // 妿å¼åå¨ï¼å
æ¬0ï¼ï¼ä½éªè¯ä¸éè¿ï¼å¯è½æ¯å
¶ä»éªè¯é误 |
| | | this.error = 'è¯·æ£æ¥è¡¨å填忝妿£ç¡®'; |
| | | } |
| | | resolve(false); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | 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('.location-select:nth-child(2) .el-input__inner'); |
| | | if (selectEl) { |
| | | selectEl.focus(); |
| | | this.currentFocus = 'location'; |
| | | } |
| | | } |
| | | }, |
| | | // èç¦å°æçè¾å
¥æ¡ |
| | | focusTrayInput() { |
| | |
| | | inputEl.focus(); |
| | | this.currentFocus = 'material'; |
| | | this.scanTarget = 'material'; |
| | | |
| | | |
| | | inputEl.select(); |
| | | console.log('ç©æè¾å
¥æ¡å
容已éä¸'); |
| | | |
| | | inputEl.select(); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | // éç½®æææ°æ® |
| | | resetData() { |
| | | console.log('éç½®å¼¹æ¡æ°æ®'); |
| | |
| | | this.scanTimer = null; |
| | | } |
| | | }, |
| | | |
| | | // å¼¹æ¡æå¼æ¶éç½®æ°æ® |
| | | handleDialogOpen() { |
| | | console.log('å¼¹æ¡æå¼ï¼éç½®æ°æ®'); |
| | | this.resetData(); |
| | | // 使ç¨setTimeoutç¡®ä¿DOMå®å
¨æ¸²æååèç¦ |
| | | this.$nextTick(() => { |
| | | setTimeout(() => { |
| | | this.initwarehouseTypes(); |
| | | this.initLocationTypes(); // åå§åä»åºåºå |
| | | // ç¡®ä¿è¡¨åå¼ç¨åå¨ååèç¦ |
| | | if (this.$refs.locationForm) { |
| | | this.focusWarehouseSelect(); |
| | | } else { |
| | | // å¦æè¡¨åå¼ç¨è¿ä¸åå¨ï¼ç¨åéè¯ |
| | | setTimeout(() => { |
| | | this.focusWarehouseSelect(); |
| | | }, 500); |
| | | } |
| | | }, 300); |
| | | }); |
| | | }, |
| | | |
| | | // å¼¹æ¡å
³éæ¶éç½®æ°æ® |
| | | handleDialogClose() { |
| | | console.log('å¼¹æ¡å
³éï¼éç½®æ°æ®'); |
| | | this.show = false; |
| | | this.resetData(); |
| | | }, |
| | | |
| | | // åæ¶æé® |
| | | handleCancel() { |
| | | this.palletVisible = false; |
| | | }, |
| | | |
| | | // 确认æé® |
| | |
| | | |
| | | this.error = ''; |
| | | |
| | | if(!this.trayBarcodeReg.test(currentTrayBarcode)){ |
| | | ElMessage.warning({ |
| | | message: 'æçå·æ ¼å¼é误', |
| | | type: 'warning', |
| | | duration: 3000 |
| | | }) |
| | | if (!this.trayBarcodeReg.test(currentTrayBarcode)) { |
| | | // ElMessage.warning({ |
| | | // message: 'æçå·æ ¼å¼é误', |
| | | // type: 'warning', |
| | | // duration: 3000 |
| | | // }) |
| | | this.$message("æçå·æ ¼å¼é误"); |
| | | this.focusTrayInput(); |
| | | return; |
| | | } |
| | |
| | | // 设置æçæ¡ç åï¼èªå¨èç¦å°ç©æè¾å
¥æ¡ |
| | | this.focusBarcodeInput(); |
| | | |
| | | this.$message({ |
| | | message: `æçæ¡ç 已设置: ${currentTrayBarcode}`, |
| | | type: 'success', |
| | | duration: 2000 |
| | | }); |
| | | // this.$message({ |
| | | // message: `æçæ¡ç 已设置: ${currentTrayBarcode}`, |
| | | // type: 'success', |
| | | // duration: 2000 |
| | | // }); |
| | | this.$message.success(`æçæ¡ç 已设置: ${currentTrayBarcode}`); |
| | | }, |
| | | |
| | | // æ¸
餿ç |
| | |
| | | this.isManualInput = false; |
| | | this.isScanning = false; |
| | | }, |
| | | |
| | | |
| | | |
| | | // å¤çç©ææ¡ç æäº¤ |
| | | async handleBarcodeSubmit() { |
| | |
| | | this.error = ''; |
| | | this.loading = true; |
| | | |
| | | console.log(currentBarcode); |
| | | try { |
| | | // è°ç¨APIæ¥è¯¢ç©æä¿¡æ¯ |
| | | const materialData = await this.fetchMaterialData(currentBarcode); |
| | | if (!materialData || materialData.length === 0) { |
| | | |
| | | |
| | | return; |
| | | } |
| | | // æ£æ¥æ¯å¦å·²åå¨ç¸åç©æç¼ç çè®°å½ |
| | | const exists = this.materials.some(item => |
| | | item.barcode === this.trayBarcode |
| | | ); |
| | | console.log('API:', materialData) |
| | | if (exists) { |
| | | this.$message({ |
| | | message: '该æ¡ç å·²åå¨å½åæççå表ä¸', |
| | | type: 'warning', |
| | | duration: 2000 |
| | | |
| | | this.materials = []; |
| | | materialData.forEach(item => { |
| | | this.materials.push({ |
| | | ...item, |
| | | trayCode: this.trayBarcode, |
| | | locationType: this.form.locationType, |
| | | locationDesc: this.currentLocationDesc, |
| | | scanTime: this.formatTime(new Date()) |
| | | }); |
| | | |
| | | } else { |
| | | }); |
| | | this.orderNo = materialData[0].orderNo; |
| | | |
| | | materialData.forEach(item => { |
| | | this.fetchStockStatistics(); |
| | | // æ¸
ç©ºç©æè¾å
¥æ¡å¹¶ä¿æèç¦ |
| | | this.barcode = ''; |
| | | this.scanCode = ''; // æ¸
空æ«ç ç¼å |
| | | this.isScanning = false; |
| | | |
| | | // 妿ä¸åå¨ï¼æ·»å æ°ç©æ |
| | | this.materials.push({ |
| | | ...item, |
| | | trayCode: this.trayBarcode, |
| | | locationType: this.form.locationType, |
| | | locationDesc: this.currentLocationDesc, |
| | | scanTime: this.formatTime(new Date()) |
| | | }); |
| | | }); |
| | | |
| | | const removeIndex = this.unpalletMaterials.findIndex(item => item.barcode === currentBarcode); |
| | | if (removeIndex > -1) { |
| | | this.unpalletMaterials.splice(removeIndex, 1); // å 餿ªç»çå¯¹åºæ°æ® |
| | | this.unpalletBarcodes = this.unpalletMaterials.map(item => item.barcode || ''); // æ´æ°æ¡ç æ°ç» |
| | | this.totalStockCount = Math.max(0, this.totalStockCount - 1); |
| | | } |
| | | |
| | | this.$message({ |
| | | message: `æåæ·»å æ¡ç : ${currentBarcode}`, |
| | | type: 'success', |
| | | duration: 2000 |
| | | }); |
| | | |
| | | this.fetchStockStatistics(); |
| | | // æ¸
ç©ºç©æè¾å
¥æ¡å¹¶ä¿æèç¦ |
| | | this.barcode = ''; |
| | | this.scanCode = ''; // æ¸
空æ«ç ç¼å |
| | | this.isScanning = false; |
| | | |
| | | setTimeout(() => { |
| | | this.focusBarcodeInput(); |
| | | }, 100); |
| | | } |
| | | setTimeout(() => { |
| | | this.focusBarcodeInput(); |
| | | }, 100); |
| | | } catch (err) { |
| | | this.error = err.message || 'æ¥è¯¢æ¡ç ä¿¡æ¯å¤±è´¥ï¼è¯·éè¯'; |
| | | this.focusBarcodeInput(); |
| | | setTimeout(() => { |
| | | // éä¸è¾å
¥æ¡å
çé误å
容ï¼ç¡®ä¿focus宿忧è¡ï¼ |
| | | const inputEl = this.$refs.barcodeInput?.$el?.querySelector('input'); |
| | | if (inputEl) inputEl.select(); |
| | | }, 100); |
| | | // éä¸è¾å
¥æ¡å
çé误å
容ï¼ç¡®ä¿focus宿忧è¡ï¼ |
| | | const inputEl = this.$refs.barcodeInput?.$el?.querySelector('input'); |
| | | if (inputEl) inputEl.select(); |
| | | }, 100); |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | |
| | | // APIè¯·æ± - æ¿æ¢ä¸ºå®é
çAPIè°ç¨ |
| | | async fetchMaterialData(barcode) { |
| | | try { |
| | | const response = await http.post('/api/InboundOrder/BarcodeMaterielGroup', |
| | | const response = await http.post('/api/Inbound/GroupPallet', |
| | | { |
| | | palletCode: this.trayBarcode, |
| | | orderNo: this.docNo, |
| | | barcodes: barcode, |
| | | barcode: barcode, |
| | | locationTypeDesc: this.currentLocationDesc, |
| | | locationType: this.form.locationType, // æ·»å ä»åºåºåä¿¡æ¯ |
| | | warehouseType: this.form.warehouseType |
| | | } |
| | | ); |
| | | |
| | | |
| | | let materialData; |
| | | |
| | | if (typeof response.data === 'string') { |
| | |
| | | |
| | | } |
| | | } else { |
| | | // 妿è¿åçæ¯JSON对象ï¼ç´æ¥ä½¿ç¨ |
| | | materialData = response.data; |
| | | } |
| | | if (!response.status) { |
| | |
| | | |
| | | } catch (error) { |
| | | console.error('APIè°ç¨å¤±è´¥:', error); |
| | | |
| | | |
| | | } |
| | | }, |
| | | |
| | |
| | | } |
| | | |
| | | .unpallet-section.compact { |
| | | margin-bottom: 8px; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .unpallet-card { |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .unpallet-barcode-list { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 6px; |
| | | padding: 8px 0; |
| | | max-height: 180px; |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .unpallet-barcode-list>>>.el-tag { |
| | | cursor: pointer; |
| | | max-width: calc(33.333% - 4px); |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | @media (max-width: 768px) { |
| | | .unpallet-barcode-list>>>.el-tag { |
| | | max-width: calc(50% - 4px); |
| | | margin-bottom: 8px; |
| | | flex-shrink: 0; |
| | | } |
| | | } |
| | | |
| | | .unpallet-card { |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .unpallet-barcode-list { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 6px; |
| | | padding: 8px 0; |
| | | max-height: 180px; |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .unpallet-barcode-list>>>.el-tag { |
| | | cursor: pointer; |
| | | max-width: calc(33.333% - 4px); |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | @media (max-width: 768px) { |
| | | .unpallet-barcode-list>>>.el-tag { |
| | | max-width: calc(50% - 4px); |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import http from '@/api/http.js' |
| | | import { h, createVNode, render, reactive, ref } from 'vue'; |
| | | import { ElDialog, ElForm, ElFormItem, ElInput, ElButton, ElMessage, ElSelect, ElOption } from 'element-plus'; // å¼å
¥ElMessageï¼è§£å³æç¤ºæ ååº |
| | | import gridHeader from './extend/EmptyTrayInbound.vue' |
| | | import gridBody from '../inbound/extend/Pallet.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: gridHeader, |
| | | gridBody: '', |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { |
| | | view: [ |
| | | { |
| | | name: 'ç»ç', |
| | | type: 'primary', |
| | | value: 'ç»ç', |
| | | onClick: function () { // ä¿®å¤1ï¼ç§»é¤æ ç¨rowåæ°ï¼å æ¥å¿è°è¯ |
| | | console.log('ç»çæé®è¢«ç¹å»ï¼å¼å§æ ¡éª'); |
| | | const selectedRows = this.$refs.table.getSelected(); |
| | | // { |
| | | // name: 'ç»ç', |
| | | // type: 'primary', |
| | | // value: 'ç»ç', |
| | | // onClick: function () { // ä¿®å¤1ï¼ç§»é¤æ ç¨rowåæ°ï¼å æ¥å¿è°è¯ |
| | | // const selectedRows = this.$refs.table.getSelected(); |
| | | // // æ ¡éª1ï¼æ¯å¦éä¸è¡ |
| | | // if (selectedRows.length === 0) { |
| | | // console.log('æ ¡éªä¸éè¿ï¼æªéä¸ä»»ä½åæ®'); |
| | | // ElMessage.warning('è¯·éæ©ä¸æ¡åæ®'); |
| | | // return; |
| | | // } |
| | | // // æ ¡éª2ï¼æ¯å¦éä¸åè¡ |
| | | // if (selectedRows.length > 1) { |
| | | // console.log('æ ¡éªä¸éè¿ï¼éä¸å¤è¡åæ®'); |
| | | // ElMessage.warning('åªè½éæ©ä¸æ¡åæ®'); |
| | | // return; |
| | | // } |
| | | |
| | | // æ ¡éª1ï¼æ¯å¦éä¸è¡ |
| | | if (selectedRows.length === 0) { |
| | | console.log('æ ¡éªä¸éè¿ï¼æªéä¸ä»»ä½åæ®'); |
| | | ElMessage.warning('è¯·éæ©ä¸æ¡åæ®'); |
| | | return; |
| | | } |
| | | // æ ¡éª2ï¼æ¯å¦éä¸åè¡ |
| | | if (selectedRows.length > 1) { |
| | | console.log('æ ¡éªä¸éè¿ï¼éä¸å¤è¡åæ®'); |
| | | ElMessage.warning('åªè½éæ©ä¸æ¡åæ®'); |
| | | return; |
| | | } |
| | | // const targetRow = selectedRows[0]; |
| | | |
| | | const targetRow = selectedRows[0]; |
| | | |
| | | this.$emit('openPalletDialog', targetRow.inboundOrderNo); |
| | | } |
| | | }, |
| | | // this.$emit('openPalletDialog', targetRow.inboundOrderNo); |
| | | // } |
| | | // }, |
| | | { |
| | | name: 'æ¤éç»ç', |
| | | type: 'primary', |
| | |
| | | } |
| | | } |
| | | }, |
| | | // { |
| | | // name: '空æçå
¥åº', |
| | | // type: 'primary', |
| | | // value: '空æçå
¥åº', |
| | | |
| | | // onClick: function () { |
| | | // const mountNode = document.createElement('div'); |
| | | // document.body.appendChild(mountNode); |
| | | |
| | | // // ååºå¼è¡¨åæ°æ®ï¼æç®±ç ï¼å¿
å¡«ï¼æ«ç æª/æå¨è¾å
¥ï¼ |
| | | // const formData = reactive({ |
| | | // boxCode: '', |
| | | // warehouseCode: '' |
| | | // }); |
| | | |
| | | // const warehouses = ref([]); |
| | | // const isLoadingWarehouses = ref(false); |
| | | |
| | | // const getWarehouseList = async () => { |
| | | // isLoadingWarehouses.value = true; |
| | | // try { |
| | | // const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes'); |
| | | // if (status && Array.isArray(data)) { |
| | | // // æ ¼å¼åä»åºé项ï¼éé
ElSelectçlabel-valueæ ¼å¼ |
| | | // warehouses.value = data.map(item => ({ |
| | | // label: item.locationTypeDesc, |
| | | // value: item.locationType |
| | | // })); |
| | | // } 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); |
| | | // document.body.removeChild(mountNode); |
| | | // } |
| | | // } |
| | | // }, { |
| | | // default: () => h(ElForm, { |
| | | // model: formData, |
| | | // rules: { |
| | | // boxCode: [ |
| | | // { required: true, message: '请è¾å
¥æç®±ç ', trigger: ['blur', 'enter'] } |
| | | // ], |
| | | // warehouseCode: [ |
| | | // { required: true, message: 'è¯·éæ©åºå', trigger: ['change', 'blur'] } |
| | | // ] |
| | | // }, |
| | | // ref: 'batchInForm' |
| | | // }, [ |
| | | // //ä»åºæ°æ® |
| | | // 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', |
| | | // onClick: () => { |
| | | // render(null, mountNode); |
| | | // document.body.removeChild(mountNode); |
| | | // ElMessage.info('åæ¶å
¥åºä»»å¡'); |
| | | // } |
| | | // }, 'åæ¶'), |
| | | // h(ElButton, { |
| | | // type: 'primary', |
| | | // onClick: submitForm |
| | | // }, 'ç¡®å®') |
| | | // ]) |
| | | // ]) |
| | | // }); |
| | | |
| | | // vnode.appContext = this.$.appContext; |
| | | // render(vnode, mountNode); |
| | | // } |
| | | // } |
| | | ], box: [], detail: [] |
| | | }, |
| | | methods: { |
| | |
| | | this.$refs.gridHeader.open(); |
| | | } |
| | | } |
| | | |
| | | var GroupPalletBtn = this.buttons.find(x => x.value == "GroupPallet"); |
| | | if (GroupPalletBtn != null) { |
| | | GroupPalletBtn.onClick = () => { |
| | | // console.log(this.$refs) |
| | | this.$refs.gridBody.open(); |
| | | } |
| | | } |
| | | |
| | | this.columns.forEach(column => { |
| | | if (column.field === 'orderStatistics') { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridHeader from './extend/EmptyTrayInbound.vue' |
| | | import gridBody from './extend/Pallet.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: gridHeader, |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | var EmptyTrayInboundBtn = this.buttons.find(x => x.value == "EmptyTrayInbound"); |
| | | if (EmptyTrayInboundBtn != null) { |
| | | EmptyTrayInboundBtn.onClick = () => { |
| | | this.$refs.gridHeader.open(); |
| | | } |
| | | } |
| | | var GroupPalletBtn = this.buttons.find(x => x.value == "GroupPallet"); |
| | | if (GroupPalletBtn != null) { |
| | | GroupPalletBtn.onClick = () => { |
| | | // console.log(this.$refs) |
| | | this.$refs.gridBody.open(); |
| | | } |
| | | } |
| | | |
| | | this.columns.forEach(column => { |
| | | if (column.field === 'orderStatistics') { |
| | | column.formatter = (row) => { |
| | | // æ ¡éªdetailsæ¯å¦åå¨ä¸ææ°æ® |
| | | if (row.details && row.details.length > 0) { |
| | | //æmaterielCodeåç»ç»è®¡orderQuantityæ»å |
| | | const materielSumMap = row.details.reduce((acc, item) => { |
| | | const materielCode = item.materielCode || 'æªç¥ç©æ'; |
| | | const quantity = Number(item.orderQuantity) || 0; |
| | | acc[materielCode] = (acc[materielCode] || 0) + quantity; |
| | | return acc; |
| | | }, {}); |
| | | |
| | | //æ¯ä¸ªç©æé¡¹çæç¬ç«divï¼è·¨è¡æ¾ç¤º |
| | | const displayItems = Object.entries(materielSumMap).map(([code, total]) => { |
| | | return `<div style="line-height: 1.5; white-space: normal;">${code}ï¼${total}个</div>`; |
| | | }); |
| | | const displayContent = displayItems.join(''); |
| | | return `<div style="color: #F56C6C; white-space: normal; word-break: break-all;">${displayContent}</div>`; |
| | | } else { |
| | | return '<span style="color: #F56C6C">æ å
¥åºæç»</span>'; |
| | | } |
| | | }; |
| | | } |
| | | }); |
| | | }, |
| | | onInited() { |
| | | |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | // this.searchFormFields.orderType=[0] |
| | | let wheres = [{ |
| | | 'name': 'orderType', |
| | | 'value': '0', |
| | | 'displayType': 'text' |
| | | }]; |
| | | |
| | | |
| | | param.wheres.push(...wheres); |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | |
| | | <div class="login-text-small">WELCOME TO LOGIN</div> |
| | | <div class="item"> |
| | | <div class="input-icon el-icon-user"></div> |
| | | <input |
| | | type="text" |
| | | v-focus |
| | | v-model="userInfo.userName" |
| | | placeholder="请è¾å
¥è´¦å·" |
| | | /> |
| | | <input type="text" v-focus v-model="userInfo.userName" placeholder="请è¾å
¥è´¦å·" /> |
| | | </div> |
| | | <div class="item"> |
| | | <div class="input-icon el-icon-lock"></div> |
| | | <input |
| | | type="password" |
| | | v-focus |
| | | v-model="userInfo.password" |
| | | placeholder="请è¾å
¥å¯ç " |
| | | /> |
| | | <input type="password" v-focus v-model="userInfo.password" placeholder="请è¾å
¥å¯ç " /> |
| | | </div> |
| | | |
| | | <div class="item station-select-item"> |
| | | <div class="item station-select-item"> |
| | | <div class="input-icon el-icon-lock"></div> |
| | | <el-select |
| | | v-model="stationValue" |
| | | placeholder="éæ©ç«å°" |
| | | class="station-select" |
| | | @change="handleStationChange" |
| | | > |
| | | <el-option |
| | | v-for="item in stationOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | <el-select v-model="stationValue" placeholder="éæ©ç«å°" class="station-select" @change="handleStationChange"> |
| | | <el-option v-for="item in stationOptions" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </div> |
| | | |
| | | |
| | | |
| | | <div class="item"> |
| | | <div class="input-icon el-icon-mobile"></div> |
| | | <input |
| | | v-focus |
| | | type="text" |
| | | v-model="userInfo.verificationCode" |
| | | placeholder="è¾å
¥éªè¯ç " |
| | | /> |
| | | <input v-focus type="text" v-model="userInfo.verificationCode" placeholder="è¾å
¥éªè¯ç " /> |
| | | <div class="code" @click="getVierificationCode"> |
| | | <img v-show="codeImgSrc != ''" :src="codeImgSrc" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="loging-btn"> |
| | | <el-button |
| | | size="large" |
| | | :loading="loading" |
| | | color="#3a6cd1" |
| | | :dark="true" |
| | | @click="login" |
| | | long |
| | | > |
| | | <el-button size="large" :loading="loading" color="#3a6cd1" :dark="true" @click="login" long> |
| | | <span v-if="!loading">ç»å½</span> |
| | | <span v-else>æ£å¨ç»å½...</span> |
| | | </el-button> |
| | |
| | | const codeImgSrc = ref(""); |
| | | const value = ref(""); |
| | | const userInfo = reactive({ |
| | | userName: "", |
| | | password: "", |
| | | verificationCode: "", |
| | | userName: "admin", |
| | | password: "123456", |
| | | verificationCode: "1234", |
| | | UUID: undefined, |
| | | }); |
| | | const stationValue = ref(""); |
| | | const stationOptions = reactive([ |
| | | const stationValue = ref(""); |
| | | const stationOptions = reactive([ |
| | | { label: "ç«å°2", value: "2-1" }, |
| | | { label: "ç«å°3", value: "3-1" }, |
| | | ]); |
| | | // åå§åç«å°å¼ |
| | | // åå§åç«å°å¼ |
| | | onMounted(() => { |
| | | // 仿¬å°åå¨å è½½ä¿åçç«å°å¼ |
| | | const savedStation = stationManager.getStation(); |
| | |
| | | return $message.error("请è¾å
¥éªè¯ç "); |
| | | } |
| | | |
| | | // ç¡®ä¿ç«å°å¼å·²ä¿å |
| | | // ç¡®ä¿ç«å°å¼å·²ä¿å |
| | | if (stationValue.value) { |
| | | stationManager.saveStation(stationValue.value); |
| | | store.commit("setStation", stationValue.value); |
| | |
| | | userInfo, |
| | | loginPress, |
| | | openUrl, |
| | | stationOptions, |
| | | stationOptions, |
| | | stationValue, |
| | | handleStationChange, |
| | | }; |
| | |
| | | |
| | | &.station-select-item { |
| | | padding-left: 0; |
| | | |
| | | |
| | | .input-icon { |
| | | margin-left: 20px; |
| | | min-width: 20px; |
| | |
| | | border: none; |
| | | padding: 0; |
| | | background: transparent; |
| | | |
| | | |
| | | // ç§»é¤ææhoverãfocusææ |
| | | &:hover, &:focus, &.is-focus { |
| | | &:hover, |
| | | &:focus, |
| | | &.is-focus { |
| | | box-shadow: none !important; |
| | | outline: none !important; |
| | | border: none !important; |
| | |
| | | font-size: 16px; |
| | | color: #323233; |
| | | cursor: pointer; // æ·»å æéæ¾ç¤ºä¸ºå¯ç¹å» |
| | | |
| | | |
| | | &::placeholder { |
| | | color: #c0c4cc; |
| | | } |
| | |
| | | } |
| | | |
| | | // ç§»é¤æ´ä¸ªç»ä»¶ä¸çä»»ä½hoveråfocusæ ·å¼ |
| | | &:hover, &:focus, &.is-focus { |
| | | &:hover, |
| | | &:focus, |
| | | &.is-focus { |
| | | :deep(.el-input__wrapper) { |
| | | box-shadow: none !important; |
| | | outline: none !important; |
| | |
| | | border: 1px solid #ececec; |
| | | border-radius: 5px; |
| | | box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); |
| | | |
| | | |
| | | .el-select-dropdown__item { |
| | | height: 45px; |
| | | line-height: 45px; |
| | | font-size: 16px; |
| | | color: #323233; |
| | | padding: 0 20px; |
| | | |
| | | |
| | | &:hover { |
| | | background-color: #f5f7fa; |
| | | } |
| | | |
| | | |
| | | &.selected { |
| | | color: #3a6cd1; |
| | | font-weight: normal; |
| | | background-color: #f0f7ff; |
| | | } |
| | | } |
| | | |
| | | |
| | | // éèæ»å¨æ¡æè°æ´æ»å¨æ¡æ ·å¼ |
| | | &::-webkit-scrollbar { |
| | | width: 6px; |
| | | } |
| | | |
| | | |
| | | &::-webkit-scrollbar-track { |
| | | background: #f1f1f1; |
| | | border-radius: 3px; |
| | | } |
| | | |
| | | |
| | | &::-webkit-scrollbar-thumb { |
| | | background: #c1c1c1; |
| | | border-radius: 3px; |
| | |
| | | |
| | | // ç§»é¤ææinputçfocusåhoveræ ·å¼ |
| | | input { |
| | | &:hover, &:focus { |
| | | |
| | | &:hover, |
| | | &:focus { |
| | | border: none !important; |
| | | outline: none !important; |
| | | box-shadow: none !important; |
| | |
| | | |
| | | <style lang="less" scoped> |
| | | @media screen and (max-width: 700px) { |
| | | |
| | | .login-bg, |
| | | .account-info, |
| | | .app-link, |
| | |
| | | |
| | | <template> |
| | | <view-grid |
| | | ref="grid" |
| | | @openPalletDialog="handleOpenPalletDialog" |
| | | :columns="columns" |
| | | :detail="detail" |
| | | :editFormFields="editFormFields" |
| | | :editFormOptions="editFormOptions" |
| | | :searchFormFields="searchFormFields" |
| | | :searchFormOptions="searchFormOptions" |
| | | :table="table" |
| | | :extend="extend" |
| | | > |
| | | <view-grid ref="grid" @openPalletDialog="handleOpenPalletDialog" :columns="columns" :detail="detail" |
| | | :editFormFields="editFormFields" :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" |
| | | :searchFormOptions="searchFormOptions" :table="table" :extend="extend"> |
| | | </view-grid> |
| | | <!-- 2. ç»çå¼¹çªï¼ç¡®ä¿propsåäºä»¶ç»å®æ£ç¡® --> |
| | | <PalletDialog |
| | | v-model:visible="palletVisible" |
| | | :docNo="currentPalletDocNo" |
| | | @back-success="handlePalletBackSuccess" |
| | | ></PalletDialog> |
| | | |
| | | </template> |
| | | <script> |
| | | import extend from "@/extension/inbound/inboundOrder.js"; |
| | | import ViewGrid from '@/components/basic/ViewGrid/ViewGrid.vue'; |
| | | <script> |
| | | import extend from "@/extension/inbound/inboundOrder_copy.js"; |
| | | import { ref, defineComponent } from "vue"; |
| | | import PalletDialog from "@/extension/inbound/extend/Pallet.vue"; |
| | | export default defineComponent({ |
| | | components: { |
| | | // å
³é®ä¿®å¤2ï¼ç»ä»¶æ³¨åå䏿¨¡æ¿æ ç¾åéé
ï¼kebab-case对åºview-gridï¼ |
| | | viewGrid: ViewGrid, // 注å为kebab-caseï¼æ¨¡æ¿ç¨<view-grid> |
| | | PalletDialog // 注åç»çå¼¹çª |
| | | |
| | | }, |
| | | setup() { |
| | | const table = ref({ |
| | | key: "id", |
| | |
| | | type: "select", |
| | | dataKey: "inOrderType", |
| | | data: [], |
| | | hidden:true |
| | | hidden: true |
| | | }, |
| | | { |
| | | field: "inboundOrderNo", |
| | |
| | | width: 150, |
| | | align: "left", |
| | | bind: { key: "inOrderType", data: [] }, |
| | | hidden:true |
| | | hidden: true |
| | | }, |
| | | { |
| | | field: "businessType", |
| | |
| | | field: "returnToMESStatus", |
| | | title: "åä¼ MESç¶æ", |
| | | width: 120, |
| | | bind: { key: "createType", data:[{key:0, value:"æªåä¼ "},{key:1, value:"å·²åä¼ æå"},{key:2, value:"åä¼ å¤±è´¥"}]}, |
| | | bind: { key: "createType", data: [{ key: 0, value: "æªåä¼ " }, { key: 1, value: "å·²åä¼ æå" }, { key: 2, value: "åä¼ å¤±è´¥" }] }, |
| | | }, |
| | | { |
| | | field: "factoryArea", |
| | |
| | | sortName: "id", |
| | | key: "id", |
| | | }); |
| | | // 6. ç»çå¼¹çªèå¨ï¼ææåéå¿
é¡»è¿åï¼ |
| | | const palletVisible = ref(false); |
| | | const currentPalletDocNo = ref(""); |
| | | |
| | | const handleOpenPalletDialog = (docNo) => { |
| | | console.log('主ç»ä»¶æ¶å°ç»çäºä»¶ï¼åæ®å·ï¼', docNo); |
| | | currentPalletDocNo.value = docNo; |
| | | palletVisible.value = true; |
| | | }; |
| | | |
| | | const handlePalletBackSuccess = () => { |
| | | console.log('ç»çåä¼ æåï¼å·æ°è¡¨æ ¼'); |
| | | grid.value?.refresh(); // æ¤æ¶gridRefå·²æè½½ï¼å¯è°ç¨æ¹æ³ |
| | | }; |
| | | |
| | | return { |
| | | table, |
| | |
| | | searchFormOptions, |
| | | columns, |
| | | detail, |
| | | // ç»çå¼¹çªç¸å
³ |
| | | PalletDialog, // å¼¹çªç»ä»¶ï¼æ éè¿åï¼æ³¨åå³å¯ï¼ä½åééè¿åï¼ |
| | | palletVisible, |
| | | currentPalletDocNo, |
| | | handleOpenPalletDialog, |
| | | handlePalletBackSuccess |
| | | // // ç»çå¼¹çªç¸å
³ |
| | | // PalletDialog, // å¼¹çªç»ä»¶ï¼æ éè¿åï¼æ³¨åå³å¯ï¼ä½åééè¿åï¼ |
| | | // palletVisible, |
| | | // currentPalletDocNo, |
| | | // handleOpenPalletDialog, |
| | | // handlePalletBackSuccess |
| | | }; |
| | | }, |
| | | }); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.IO; |
| | | using System.Threading; |
| | | |
| | | namespace LogLibrary.Log |
| | | { |
| | | public static class FileUtil |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 追å å
å®¹å°æå®æä»¶ä¸ |
| | | /// </summary> |
| | | /// <param name="filePath"></param> |
| | | /// <param name="content"></param> |
| | | public static void WriteAppend(string filePath, string content) |
| | | { |
| | | WriteAppend(filePath, new string[] { content }); |
| | | } |
| | | |
| | | public static void WriteAppend(string filePath, string[] contents) |
| | | { |
| | | using (FileStream fs = new(filePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite)) |
| | | { |
| | | fs.Seek(fs.Length, SeekOrigin.Current); |
| | | |
| | | string content = string.Join(Environment.NewLine, contents) + Environment.NewLine; |
| | | |
| | | //byte[] data = System.Text.Encoding.GetEncoding("GB2312").GetBytes(content); |
| | | byte[] data = System.Text.Encoding.Default.GetBytes(content); |
| | | |
| | | |
| | | fs.Write(data, 0, data.Length); |
| | | |
| | | fs.Close(); |
| | | fs.Dispose(); |
| | | } |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | |
| | | namespace LogLibrary.Log |
| | | { |
| | | public unsafe interface ILog |
| | | { |
| | | bool* IsCryto { set; } |
| | | bool IsDebugEnabled { get; } |
| | | |
| | | bool IsErrorEnabled { get; } |
| | | |
| | | bool IsFatalEnabled { get; } |
| | | |
| | | bool IsInfoEnabled { get; } |
| | | |
| | | bool IsWarnEnabled { get; } |
| | | |
| | | void Debug(bool isWriteFile, object message); |
| | | |
| | | void Debug(bool isWriteFile, object message, Exception exception); |
| | | |
| | | void DebugFormat(bool isWriteFile, string format, object arg0); |
| | | |
| | | void DebugFormat(bool isWriteFile, string format, params object[] args); |
| | | |
| | | void DebugFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args); |
| | | |
| | | void DebugFormat(bool isWriteFile, string format, object arg0, object arg1); |
| | | |
| | | void DebugFormat(bool isWriteFile, string format, object arg0, object arg1, object arg2); |
| | | |
| | | void Error(bool isWriteFile, object message); |
| | | |
| | | void Error(bool isWriteFile, object message, Exception exception); |
| | | |
| | | void ErrorFormat(bool isWriteFile, string format, object arg0); |
| | | |
| | | void ErrorFormat(bool isWriteFile, string format, params object[] args); |
| | | |
| | | void ErrorFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args); |
| | | |
| | | void ErrorFormat(bool isWriteFile, string format, object arg0, object arg1); |
| | | |
| | | void ErrorFormat(bool isWriteFile, string format, object arg0, object arg1, object arg2); |
| | | |
| | | void Fatal(bool isWriteFile, object message); |
| | | |
| | | void Fatal(bool isWriteFile, object message, Exception exception); |
| | | |
| | | void FatalFormat(bool isWriteFile, string format, object arg0); |
| | | |
| | | void FatalFormat(bool isWriteFile, string format, params object[] args); |
| | | |
| | | void FatalFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args); |
| | | |
| | | void FatalFormat(bool isWriteFile, string format, object arg0, object arg1); |
| | | |
| | | void FatalFormat(bool isWriteFile, string format, object arg0, object arg1, object arg2); |
| | | |
| | | void Info(bool isWriteFile, object message); |
| | | |
| | | void Info(bool isWriteFile, object message, Exception exception); |
| | | |
| | | //void InfoFormat(bool isWriteFile, string format, object arg0); |
| | | |
| | | //void InfoFormat(bool isWriteFile, string format, params object[] args); |
| | | |
| | | //void InfoFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args); |
| | | |
| | | //void InfoFormat(bool isWriteFile, string format, object arg0, object arg1); |
| | | |
| | | void InfoFormat(bool isWriteFile, object arg0, object arg1, object arg2); |
| | | |
| | | void Warn(bool isWriteFile, object message); |
| | | |
| | | void Warn(bool isWriteFile, object message, Exception exception); |
| | | |
| | | void WarnFormat(bool isWriteFile, string format, object arg0); |
| | | |
| | | void WarnFormat(bool isWriteFile, string format, params object[] args); |
| | | |
| | | void WarnFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args); |
| | | |
| | | void WarnFormat(bool isWriteFile, string format, object arg0, object arg1); |
| | | |
| | | void WarnFormat(bool isWriteFile, string format, object arg0, object arg1, object arg2); |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace LogLibrary.Log |
| | | { |
| | | public interface ILogFactory |
| | | { |
| | | ILog GetLog(string name); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace LogLibrary.Log |
| | | { |
| | | public enum Level : int |
| | | { |
| | | Debug, |
| | | Info, |
| | | Warning, |
| | | Error |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Text.RegularExpressions; |
| | | |
| | | namespace LogLibrary.Log |
| | | { |
| | | |
| | | public unsafe class Log |
| | | { |
| | | private string m_Name; |
| | | private const string m_MessageTemplate = "{0}-{1}: {2}"; |
| | | |
| | | private const string m_Debug = "DEBUG"; |
| | | |
| | | private const string m_Error = "ERROR"; |
| | | |
| | | private const string m_Fatal = "FATAL"; |
| | | |
| | | private const string m_Info = "INFO"; |
| | | |
| | | private const string m_Warn = "WARN"; |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="Log"/> class. |
| | | /// </summary> |
| | | /// <param name="name">The name.</param> |
| | | public Log(string name) |
| | | { |
| | | m_Name = name; |
| | | } |
| | | public Log() |
| | | { |
| | | m_Name = "NaN"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Gets a value indicating whether this instance is debug enabled. |
| | | /// </summary> |
| | | /// <value> |
| | | /// <c>true</c> if this instance is debug enabled; otherwise, <c>false</c>. |
| | | /// </value> |
| | | public bool IsDebugEnabled |
| | | { |
| | | get { return true; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Gets a value indicating whether this instance is error enabled. |
| | | /// </summary> |
| | | /// <value> |
| | | /// <c>true</c> if this instance is error enabled; otherwise, <c>false</c>. |
| | | /// </value> |
| | | public bool IsErrorEnabled |
| | | { |
| | | get { return true; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Gets a value indicating whether this instance is fatal enabled. |
| | | /// </summary> |
| | | /// <value> |
| | | /// <c>true</c> if this instance is fatal enabled; otherwise, <c>false</c>. |
| | | /// </value> |
| | | public bool IsFatalEnabled |
| | | { |
| | | get { return true; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Gets a value indicating whether this instance is info enabled. |
| | | /// </summary> |
| | | /// <value> |
| | | /// <c>true</c> if this instance is info enabled; otherwise, <c>false</c>. |
| | | /// </value> |
| | | public bool IsInfoEnabled |
| | | { |
| | | get { return true; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Gets a value indicating whether this instance is warn enabled. |
| | | /// </summary> |
| | | /// <value> |
| | | /// <c>true</c> if this instance is warn enabled; otherwise, <c>false</c>. |
| | | /// </value> |
| | | public bool IsWarnEnabled |
| | | { |
| | | get { return true; } |
| | | } |
| | | |
| | | |
| | | |
| | | public string GetDataTimeLog(string log) |
| | | { |
| | | return string.Format("[{0}] >> {1}", DateTime.Now.ToString("yy-MM-dd HH:mm:ss"), log); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the debug message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | public void Debug(bool isWriteFile, object message) |
| | | { |
| | | string log = GetDataTimeLog(message.ToString()); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Debug, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the debug message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | /// <param name="exception">The exception.</param> |
| | | public void Debug(bool isWriteFile, object message, Exception exception) |
| | | { |
| | | string log = GetDataTimeLog(message + Environment.NewLine + exception.Message + exception.StackTrace); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Debug, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the debug message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | public void DebugFormat(bool isWriteFile, string format, object arg0) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Debug, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the debug message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | public void DebugFormat(bool isWriteFile, string format, params object[] args) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, args)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, string.Format(format, args)); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Debug, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the debug message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="provider">The provider.</param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | public void DebugFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, args)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, string.Format(provider, format, args)); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Debug, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the debug message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | public void DebugFormat(bool isWriteFile, string format, object arg0, object arg1) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg1)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Debug, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the debug message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | /// <param name="arg2">The arg2.</param> |
| | | public void DebugFormat(bool isWriteFile, string format, object arg0, object arg1, object arg2) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg1, arg2)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Debug, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Debug, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | public void Error(bool isWriteFile, object message) |
| | | { |
| | | string log = GetDataTimeLog(message.ToString()); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Error, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Error, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | /// <param name="exception">The exception.</param> |
| | | public void Error(bool isWriteFile, object message, Exception exception) |
| | | { |
| | | //string log = GetDataTimeLog(message + Environment.NewLine + exception.Message + exception.StackTrace); |
| | | string log = GetDataTimeLog(message + Environment.NewLine + exception.Message ); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Error, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Error, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | public void ErrorFormat(bool isWriteFile, string format, object arg0) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Error, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Error, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | public void ErrorFormat(bool isWriteFile, string format, params object[] args) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, args)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Error, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Error, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="provider">The provider.</param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | public void ErrorFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(provider, format, args)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Error, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Error, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | public void ErrorFormat(bool isWriteFile, string format, object arg0, object arg1) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg1)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Error, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Error, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | /// <param name="arg2">The arg2.</param> |
| | | public void ErrorFormat(bool isWriteFile, string format, object arg0, object arg1, object arg2) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg2)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Error, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Error, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the fatal error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | public void Fatal(bool isWriteFile, object message) |
| | | { |
| | | string log = GetDataTimeLog(message.ToString()); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the fatal error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | /// <param name="exception">The exception.</param> |
| | | public void Fatal(bool isWriteFile, object message, Exception exception) |
| | | { |
| | | string log = GetDataTimeLog(message + Environment.NewLine + exception.Message + exception.StackTrace); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the fatal error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | public void FatalFormat(bool isWriteFile, string format, object arg0) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the fatal error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | public void FatalFormat(bool isWriteFile, string format, params object[] args) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, args)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the fatal error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="provider">The provider.</param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | public void FatalFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(provider, format, args)); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the fatal error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | public void FatalFormat(bool isWriteFile, string format, object arg0, object arg1) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg1)); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the fatal error message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | /// <param name="arg2">The arg2.</param> |
| | | public void FatalFormat(bool isWriteFile, string format, object arg0, object arg1, object arg2) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg1, arg2)); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Fatal, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Fatal, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the info message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | public void Info(bool isWriteFile, object message) |
| | | { |
| | | string log = GetDataTimeLog(message.ToString()); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the info message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | /// <param name="exception">The exception.</param> |
| | | public void Info(bool isWriteFile, object message, Exception exception) |
| | | { |
| | | string log = GetDataTimeLog(message + Environment.NewLine + exception.Message + exception.StackTrace); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the info message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | public void InfoFormat(bool isWriteFile, string format, object arg0) |
| | | { |
| | | string log = GetDataTimeLog(string.Format("\n{0}\n{1}\n-----------------------------------------------------------\n\n", format, arg0)); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the info message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | //public void InfoFormat(bool isWriteFile, string format, params object[] args) |
| | | //{ |
| | | // string log = GetDataTimeLog(string.Format(format, args)); |
| | | // Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | // if (isWriteFile) |
| | | // { |
| | | // LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | | // } |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// Logs the info message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="provider">The provider.</param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | //public void InfoFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args) |
| | | //{ |
| | | // string log = GetDataTimeLog(string.Format(provider, format, args)); |
| | | // Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | // if (isWriteFile) |
| | | // { |
| | | // LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | | // } |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// Logs the info message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | //public void InfoFormat(bool isWriteFile, string format, object arg0, object arg1) |
| | | //{ |
| | | // string log = GetDataTimeLog(string.Format(format, arg0, arg1)); |
| | | // Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | // if (isWriteFile) |
| | | // { |
| | | // LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | | // } |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// Logs the info message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | /// <param name="arg2">The arg2.</param> |
| | | public void InfoFormat(bool isWriteFile, object arg0, object arg1, object arg2) |
| | | { |
| | | string func(string str, int len) |
| | | { |
| | | var strSLen = Regex.Replace(str, @"[^\x00-\xff]", "aa").Length; |
| | | var strLen = str.Length; |
| | | return str.PadLeft(len - strSLen + strLen); |
| | | } |
| | | string log = GetDataTimeLog(string.Format("[{0}]\t[{1}]\t{2}", arg0?.ToString(), arg1?.ToString(), arg2)); |
| | | //string log = GetDataTimeLog(string.Format("[{0}] [{1}] {2}", func(arg0?.ToString(), 13), func(arg1?.ToString(), 16), arg2)); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Info, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Info, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the warning message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | public void Warn(bool isWriteFile, object message) |
| | | { |
| | | string log = GetDataTimeLog(message.ToString()); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the warning message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="message">The message.</param> |
| | | /// <param name="exception">The exception.</param> |
| | | public void Warn(bool isWriteFile, object message, Exception exception) |
| | | { |
| | | string log = GetDataTimeLog(message + Environment.NewLine + exception.Message + exception.StackTrace); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the warning message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | public void WarnFormat(bool isWriteFile, string format, object arg0) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0)); |
| | | //Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the warning message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | public void WarnFormat(bool isWriteFile, string format, params object[] args) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, args)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the warning message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="provider">The provider.</param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="args">The args.</param> |
| | | public void WarnFormat(bool isWriteFile, IFormatProvider provider, string format, params object[] args) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(provider, format, args)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the warning message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | public void WarnFormat(bool isWriteFile, string format, object arg0, object arg1) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg1)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Logs the warning message. |
| | | /// </summary> |
| | | /// <param name="isWriteFile"></param> |
| | | /// <param name="format">The format.</param> |
| | | /// <param name="arg0">The arg0.</param> |
| | | /// <param name="arg1">The arg1.</param> |
| | | /// <param name="arg2">The arg2.</param> |
| | | public void WarnFormat(bool isWriteFile, string format, object arg0, object arg1, object arg2) |
| | | { |
| | | string log = GetDataTimeLog(string.Format(format, arg0, arg1, arg2)); |
| | | Console.WriteLine(m_MessageTemplate, m_Name, m_Warn, log); |
| | | if (isWriteFile) |
| | | { |
| | | LogUtil.WriteLogFile(m_Name, m_Warn, log); |
| | | } |
| | | } |
| | | |
| | | //public void Behavior(string logMsg, Level level) |
| | | //{ |
| | | // lock (this) |
| | | // { |
| | | // m_Name = "è¡ä¸º"; |
| | | // switch (level) |
| | | // { |
| | | // case Level.Debug: |
| | | // Debug(true, logMsg); |
| | | // break; |
| | | // case Level.Info: |
| | | // Info(true, logMsg); |
| | | // break; |
| | | // case Level.Warning: |
| | | // Warn(true, logMsg); |
| | | // break; |
| | | // case Level.Error: |
| | | // Error(true, logMsg); |
| | | // break; |
| | | // default: |
| | | // break; |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | //public void Interface(string logMsg, Level level) |
| | | //{ |
| | | // lock (this) |
| | | // { |
| | | // m_Name = "æ¥å£"; |
| | | // switch (level) |
| | | // { |
| | | // case Level.Debug: |
| | | // Debug(true, logMsg); |
| | | // break; |
| | | // case Level.Info: |
| | | // Info(true, logMsg); |
| | | // break; |
| | | // case Level.Warning: |
| | | // Warn(true, logMsg); |
| | | // break; |
| | | // case Level.Error: |
| | | // Error(true, logMsg); |
| | | // break; |
| | | // default: |
| | | // break; |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | //public void Hardware(string logMsg, Level level) |
| | | //{ |
| | | // lock (this) |
| | | // { |
| | | // m_Name = "硬件"; |
| | | // switch (level) |
| | | // { |
| | | // case Level.Debug: |
| | | // Debug(true, logMsg); |
| | | // break; |
| | | // case Level.Info: |
| | | // Info(true, logMsg); |
| | | // break; |
| | | // case Level.Warning: |
| | | // Warn(true, logMsg); |
| | | // break; |
| | | // case Level.Error: |
| | | // Error(true, logMsg); |
| | | // break; |
| | | // default: |
| | | // break; |
| | | // } |
| | | // } |
| | | //} |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | namespace LogLibrary.Log |
| | | { |
| | | public unsafe class LogFactory |
| | | { |
| | | public Log GetLog(string name) |
| | | { |
| | | return new Log(name); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Diagnostics; |
| | | using System.Threading; |
| | | |
| | | namespace LogLibrary.Log |
| | | { |
| | | internal unsafe class LogUtil |
| | | { |
| | | static ReaderWriterLockSlim lockSlim = new ReaderWriterLockSlim(); |
| | | |
| | | /// <summary> |
| | | /// æ ¼å¼å¼åLogä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="format"></param> |
| | | /// <param name="name"></param> |
| | | /// <param name="logType"></param> |
| | | /// <param name="log"></param> |
| | | /// <returns></returns> |
| | | private static string GetLogString(string name, string logType, string log) |
| | | { |
| | | return string.Format("[{0}]{1}-{2}: {3}", DateTime.Now.ToString("HH:mm:ss"), name, logType, log); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·å¾æ¥å¿è¦ä¿åçè·¯å¾ |
| | | /// </summary> |
| | | /// <param name="name"></param> |
| | | /// <param name="logType"></param> |
| | | /// <returns></returns> |
| | | private static string GetLogPath(string name, string logType) |
| | | { |
| | | string path = AppDomain.CurrentDomain.BaseDirectory + $"Logs/{DateTime.Now:yyyyMM}"; |
| | | if (!System.IO.Directory.Exists(path)) |
| | | { |
| | | System.IO.Directory.CreateDirectory(path); |
| | | } |
| | | |
| | | return System.IO.Path.Combine(path, string.Format("{0}_{1}_{2}.log", DateTime.Now.ToString("yyyy-MM-dd"), name, logType)); |
| | | } |
| | | |
| | | public static void WriteLogFile(string name, string logType, string log) |
| | | { |
| | | string logPath = GetLogPath(name, logType); |
| | | Trace.WriteLine(log); |
| | | lockSlim.EnterWriteLock();//æå¼åæä½é |
| | | try |
| | | { |
| | | FileUtil.WriteAppend(logPath, log); |
| | | } |
| | | finally |
| | | { |
| | | lockSlim.ExitWriteLock(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <Project Sdk="Microsoft.NET.Sdk"> |
| | | <PropertyGroup> |
| | | <TargetFramework>net6.0</TargetFramework> |
| | | <OutputType>Library</OutputType> |
| | | <GenerateAssemblyInfo>false</GenerateAssemblyInfo> |
| | | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| | | <Configurations>Debug;Release;Dev</Configurations> |
| | | <Platforms>AnyCPU;x86</Platforms> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> |
| | | <OutputPath>bin\x86\Debug\</OutputPath> |
| | | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| | | <DebugType>embedded</DebugType> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x86'"> |
| | | <OutputPath>bin\x86\Debug\</OutputPath> |
| | | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> |
| | | <OutputPath>bin\x86\Release\</OutputPath> |
| | | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| | | <DebugType>embedded</DebugType> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'"> |
| | | <DebugSymbols>true</DebugSymbols> |
| | | <OutputPath>bin\Dev\</OutputPath> |
| | | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| | | <DebugType>embedded</DebugType> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x86'"> |
| | | <DebugSymbols>true</DebugSymbols> |
| | | <OutputPath>bin\Dev\</OutputPath> |
| | | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|x86'"> |
| | | <DebugSymbols>true</DebugSymbols> |
| | | <OutputPath>bin\x86\Dev\</OutputPath> |
| | | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
| | | <DebugType>embedded</DebugType> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> |
| | | <DebugType>embedded</DebugType> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> |
| | | <DebugType>embedded</DebugType> |
| | | </PropertyGroup> |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System.Reflection; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Runtime.InteropServices; |
| | | |
| | | // æå
³ç¨åºéçä¸è¬ä¿¡æ¯ç±ä»¥ä¸ |
| | | // æ§å¶ãæ´æ¹è¿äºç¹æ§å¼å¯ä¿®æ¹ |
| | | // ä¸ç¨åºéå
³èçä¿¡æ¯ã |
| | | [assembly: AssemblyTitle("LogLibrary")] |
| | | [assembly: AssemblyDescription("")] |
| | | [assembly: AssemblyConfiguration("")] |
| | | [assembly: AssemblyCompany("")] |
| | | [assembly: AssemblyProduct("LogLibrary")] |
| | | [assembly: AssemblyCopyright("Copyright © 2020")] |
| | | [assembly: AssemblyTrademark("")] |
| | | [assembly: AssemblyCulture("")] |
| | | |
| | | // å° ComVisible 设置为 false ä¼ä½¿æ¤ç¨åºéä¸çç±»å |
| | | //对 COM ç»ä»¶ä¸å¯è§ã妿éè¦ä» COM è®¿é®æ¤ç¨åºéä¸çç±»å |
| | | //è¯·å°æ¤ç±»åç ComVisible ç¹æ§è®¾ç½®ä¸º trueã |
| | | [assembly: ComVisible(false)] |
| | | |
| | | // 妿æ¤é¡¹ç®å COM å
¬å¼ï¼åä¸å GUID ç¨äºç±»ååºç ID |
| | | [assembly: Guid("2e0d9770-ab36-4811-a0d0-05b98093b92d")] |
| | | |
| | | // ç¨åºéççæ¬ä¿¡æ¯ç±ä¸åå个å¼ç»æ: |
| | | // |
| | | // ä¸»çæ¬ |
| | | // æ¬¡çæ¬ |
| | | // çæå· |
| | | // ä¿®è®¢å· |
| | | // |
| | | //å¯ä»¥æå®ææè¿äºå¼ï¼ä¹å¯ä»¥ä½¿ç¨âçæå·âåâ修订å·âçé»è®¤å¼ |
| | | //éè¿ä½¿ç¨ "*"ï¼å¦ä¸æç¤º: |
| | | // [assembly: AssemblyVersion("1.0.*")] |
| | | [assembly: AssemblyVersion("1.0.0.0")] |
| | | [assembly: AssemblyFileVersion("1.0.0.0")] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using LogLibrary.Log; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Net.Http.Headers; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_Common; |
| | | |
| | | public class HttpsClient |
| | | { |
| | | private static readonly LogFactory LogFactory = new LogFactory(); |
| | | |
| | | // å°è£
ä¸ä¸ªç¨HttpClientåéGET请æ±çæ¹æ³æåæ° |
| | | public static async Task<string> GetAsync(string url, Dictionary<string, object> parameters) |
| | | { |
| | | try |
| | | { |
| | | // è®°å½è¯·æ±åæ° |
| | | LogRequestParameters(parameters, url); |
| | | |
| | | // å°åæ°æ¼æ¥å°URLä¸ |
| | | string queryString = string.Join("&", parameters.Select(x => $"{x.Key}={x.Value}")); |
| | | url += "?" + queryString; |
| | | |
| | | // å建HttpClientå®ä¾ |
| | | using (HttpClient client = new HttpClient()) |
| | | { |
| | | // åéGET请æ±å¹¶è·åååº |
| | | HttpResponseMessage response = await client.GetAsync(url); |
| | | |
| | | // ç¡®ä¿ååºæå |
| | | response.EnsureSuccessStatusCode(); |
| | | |
| | | // 读åååºå
容 |
| | | string responseBody = await response.Content.ReadAsStringAsync(); |
| | | |
| | | // è®°å½ååºåæ° |
| | | LogResponseParameters(responseBody, url); |
| | | |
| | | // è¿åååºå
容 |
| | | return responseBody; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogErrorParameters(ex.StackTrace, ex.Message, url); |
| | | return ex.Message; |
| | | } |
| | | } |
| | | |
| | | // ç¨äºè¿½è¸ªæ¯ä¸ªè¯·æ±çè°ç¨æ¬¡æ°åæåè¯·æ±æ¶é´ã |
| | | //private static readonly Dictionary<string, (int Count, DateTime LastRequestTime)> requestTracker = new(); |
| | | // å°è£
ä¸ä¸ªç¨HttpClientåéPost请æ±çæ¹æ³æåæ° |
| | | public static async Task<string> PostAsync(string url, Dictionary<string, object> parameters) |
| | | { |
| | | try |
| | | { |
| | | //// å建ä¸ä¸ªæ°çåå
¸ï¼æé¤ RequestTime å SessionId |
| | | //var filteredParameters = parameters.Where(p => p.Key != "RequestTime" && p.Key != "SessionId").ToDictionary(p => p.Key, p => p.Value); |
| | | |
| | | //string requestKey = $"{url}:{JsonConvert.SerializeObject(filteredParameters)}"; |
| | | //// æ£æ¥è¯·æ±æ¬¡æ°åæ¶é´éå¶ |
| | | //if (requestTracker.TryGetValue(requestKey, out var requestInfo)) |
| | | //{ |
| | | // if (requestInfo.Count >= 5 && DateTime.Now < requestInfo.LastRequestTime.AddMinutes(3)) |
| | | // { |
| | | // // å¦æè¯·æ±æ¬¡æ°è¶
è¿éå¶ä¸æªè¶
è¿10åéï¼æåºå¼å¸¸ |
| | | // throw new InvalidOperationException("è¯·æ±æ¬¡æ°å·²è¾¾å°éå¶ï¼è¯·ç¨ååè¯ã"); |
| | | // } |
| | | //} |
| | | |
| | | //// æ´æ°è¯·æ±è·è¸ªä¿¡æ¯ |
| | | //if (requestTracker.ContainsKey(requestKey)) |
| | | //{ |
| | | // requestTracker[requestKey] = (requestInfo.Count + 1, DateTime.Now); |
| | | //} |
| | | //else |
| | | //{ |
| | | // requestTracker[requestKey] = (1, DateTime.Now); |
| | | //} |
| | | |
| | | |
| | | // è®°å½è¯·æ±åæ° |
| | | LogRequestParameters(parameters, url); |
| | | |
| | | // å建HttpClientå®ä¾ |
| | | using (HttpClient client = new HttpClient()) |
| | | { |
| | | // å°åæ°è½¬æ¢ä¸ºFormUrlEncodedContent |
| | | string content = JsonConvert.SerializeObject(parameters); |
| | | |
| | | var request = new HttpRequestMessage(HttpMethod.Post, url); |
| | | |
| | | request.Content = new StringContent(content, Encoding.UTF8, "application/json"); |
| | | |
| | | HttpResponseMessage response = await client.SendAsync(request); |
| | | |
| | | // ç¡®ä¿ååºæå |
| | | response.EnsureSuccessStatusCode(); |
| | | |
| | | // 读åååºå
容 |
| | | string responseBody = await response.Content.ReadAsStringAsync(); |
| | | |
| | | // è®°å½ååºåæ° |
| | | LogResponseParameters(responseBody, url); |
| | | |
| | | // è¿åååºå
容 |
| | | return responseBody; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogErrorParameters(ex.StackTrace,ex.Message, url); |
| | | return ex.Message; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public static async Task<string> PostAsync(string url, string requestJson = null, string contentType = "application/json", Dictionary<string, string>? headers = null) |
| | | { |
| | | try |
| | | { |
| | | LogRequestParameters(requestJson, url); |
| | | |
| | | string result = string.Empty; |
| | | using (HttpContent httpContent = new StringContent(requestJson)) |
| | | { |
| | | httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | |
| | | if (headers != null) |
| | | { |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | } |
| | | result = await httpClient.PostAsync(url, httpContent).Result.Content.ReadAsStringAsync(); |
| | | } |
| | | LogResponseParameters(result, url); |
| | | |
| | | return result; |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogErrorParameters(ex.StackTrace, ex.Message, url); |
| | | Console.WriteLine(ex.Message); |
| | | } |
| | | return null; |
| | | } |
| | | private static void LogErrorParameters(string errordetail, string error, string url = "") |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("---------------------------------------------"); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("url:" + url + "å¼å¸¸è¯¦ç»ä¿¡æ¯: " + JsonConvert.SerializeObject(error)); |
| | | builder.Append("url:" + url + "å¼å¸¸ä¿¡æ¯: " + JsonConvert.SerializeObject(error)); |
| | | LogFactory.GetLog("APIæ¥å£å¼å¸¸").Error(true, builder); |
| | | } |
| | | private static void LogRequestParameters(Dictionary<string, object> parameters, string url = "") |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("---------------------------------------------"); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("url:" + url + "请æ±åæ°: " + JsonConvert.SerializeObject(parameters)); |
| | | LogFactory.GetLog("APIæ¥å£").Info(true, builder); |
| | | } |
| | | |
| | | private static void LogRequestParameters(string parameters, string url = "") |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("---------------------------------------------"); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("url:" + url + "请æ±åæ°: " + JsonConvert.SerializeObject(parameters)); |
| | | LogFactory.GetLog("APIæ¥å£").Info(true, builder); |
| | | } |
| | | |
| | | private static void LogResponseParameters(string responseBody, string url = "") |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("url:" + url + "ååºåæ°: " + responseBody); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("---------------------------------------------"); |
| | | builder.Append(Environment.NewLine); |
| | | LogFactory.GetLog("APIæ¥å£").Info(true, builder); |
| | | } |
| | | } |
| | |
| | | <None Remove="Location\**" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\LogLibrary\LogLibrary.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Attributes; |
| | | |
| | | namespace WIDESEA_DTO.Inbound |
| | | { |
| | | [ModelValidate] |
| | | public class GroupPalletDto |
| | | { |
| | | [PropertyValidate("æçç¼å·", NotNullAndEmpty = true)] |
| | | public string PalletCode { get; set; } |
| | | |
| | | [PropertyValidate("åºåå·æ¡ç ", NotNullAndEmpty = true)] |
| | | public string Barcode { get; set; } |
| | | |
| | | public string locationType { get; set; } |
| | | |
| | | public string WarehouseType { get; set; } |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.Inbound; |
| | | |
| | | namespace WIDESEA_IInboundService |
| | | { |
| | |
| | | IInboundOrderDetailService InboundOrderDetailService { get; } |
| | | |
| | | IInboundOrderService InbounOrderService { get; } |
| | | |
| | | /// <summary> |
| | | /// ç»ç |
| | | /// </summary> |
| | | /// <param name="palletDto"></param> |
| | | /// <returns></returns> |
| | | Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto); |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using LogLibrary.Log; |
| | | using MailKit; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Basic; |
| | | |
| | | namespace WIDESEA_InboundService |
| | | { |
| | | public class InboundService : IInboundService |
| | | { |
| | | LogFactory LogFactory = new LogFactory(); |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | public IInboundOrderDetailService InboundOrderDetailService { get; } |
| | | |
| | | public IInboundOrderService InbounOrderService { get; } |
| | | private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository; |
| | | private readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository; |
| | | private readonly IRepository<Dt_LocationType> _locationTypeRepository; |
| | | private readonly IRepository<Dt_StockInfo> _stockInfoRepository; |
| | | private readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository; |
| | | private readonly IRepository<Dt_Task> _taskRepository; |
| | | private IStockService _stockService; |
| | | |
| | | public InboundService(IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService) |
| | | public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | InboundOrderDetailService = inboundOrderDetailService; |
| | | InbounOrderService = inbounOrderService; |
| | | _inboundOrderRepository = inboundOrderRepository; |
| | | _warehouseAreaRepository = warehouseAreaRepository; |
| | | _locationTypeRepository = locationTypeRepository; |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _inboundOrderDetailRepository = inboundOrderDetailRepository; |
| | | _stockService = stockService; |
| | | _taskRepository = taskRepository; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | (bool, string, object?) result2 = ModelValidate.ValidateModelData(palletDto); |
| | | if (!result2.Item1) return content.Error(result2.Item2); |
| | | |
| | | var code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == palletDto.WarehouseType).Select(x => x.Code).First(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return content.Error($"ä»åºä¸æ²¡æè¯¥{palletDto.WarehouseType}ç¼å·ã"); |
| | | } |
| | | |
| | | List<Dt_InboundOrderDetail> details = new List<Dt_InboundOrderDetail>(); |
| | | Dt_InboundOrder inboundOrder = new Dt_InboundOrder(); |
| | | details = _inboundOrderDetailRepository.QueryData(x => x.OutBoxbarcodes == palletDto.Barcode && x.OrderDetailStatus == (int)InOrderStatusEnum.æªå¼å§); |
| | | if (details.Count <= 0) |
| | | { |
| | | details = _inboundOrderDetailRepository.QueryData(x => x.Barcode == palletDto.Barcode && x.OrderDetailStatus == (int)InOrderStatusEnum.æªå¼å§); |
| | | } |
| | | |
| | | if (details.Count() <= 0) |
| | | { |
| | | return content.Error("æªæ¾å°è¯¥æ¡ç åæ®ä¿¡æ¯è¯·ç¡®è®¤æ¯å¦å·²ç»ç»ç宿"); |
| | | } |
| | | inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Includes(x=>x.Details).Where(x => x.Id == details.First().OrderId).First(); |
| | | |
| | | if (inboundOrder == null) |
| | | { |
| | | return content.Error("æªæ¾å°è¯¥æ¡ç 主åä¿¡æ¯"); |
| | | } |
| | | Dt_StockInfo? stockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync(); |
| | | |
| | | List<string?> materielCodes = details.GroupBy(x => x.Barcode).Select(x => x.Key).ToList(); |
| | | |
| | | (bool, string, object?) result = CheckMaterielGroupParam(palletDto, materielCodes, inboundOrder, stockInfo); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None, LocationType = Convert.ToInt32(palletDto.locationType) }; |
| | | stockInfo.Details = new List<Dt_StockInfoDetail>(); |
| | | } |
| | | |
| | | foreach (var item in details) |
| | | { |
| | | stockInfo.Details.Add(new Dt_StockInfoDetail |
| | | { |
| | | StockId = stockInfo == null ? 0 : stockInfo.Id, |
| | | Barcode = item.Barcode, |
| | | MaterielCode = item.MaterielCode, |
| | | BatchNo = item.BatchNo, |
| | | Unit = item.Unit, |
| | | InboundOrderRowNo = item.lineNo, |
| | | SupplyCode = item.SupplyCode, |
| | | WarehouseCode = palletDto.WarehouseType, |
| | | StockQuantity = item.OrderQuantity, |
| | | BarcodeQty = item.BarcodeQty, |
| | | BarcodeUnit = item.BarcodeUnit, |
| | | FactoryArea = inboundOrder.FactoryArea, |
| | | Status = 0, |
| | | OrderNo = inboundOrder.InboundOrderNo, |
| | | BusinessType = inboundOrder.BusinessType, |
| | | |
| | | }); |
| | | |
| | | item.ReceiptQuantity = item.BarcodeQty; |
| | | item.OrderDetailStatus = (int)OrderDetailStatusEnum.Over; |
| | | item.WarehouseCode = palletDto.WarehouseType; |
| | | item.ReturnToMESStatus = 0; |
| | | } |
| | | |
| | | if (stockInfo.Id == 0) |
| | | { |
| | | stockInfo.PalletCode = palletDto.PalletCode; |
| | | stockInfo.StockStatus = (int)StockStatusEmun.ç»çæå; |
| | | } |
| | | stockInfo.PalletType = (int)PalletTypeEnum.None; |
| | | |
| | | List<int> updateDetailIds = details.Select(x => x.Id).ToList(); |
| | | if (inboundOrder.OrderStatus == (int)InOrderStatusEnum.æªå¼å§) |
| | | { |
| | | inboundOrder.OrderStatus = (int)InOrderStatusEnum.å
¥åºä¸; |
| | | } |
| | | inboundOrder.Operator = App.User.UserName; |
| | | content = MaterielGroupUpdateData(inboundOrder, details, stockInfo).Result; |
| | | if (content.Status) |
| | | { |
| | | Dt_StockInfo? NewstockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync(); |
| | | |
| | | return WebResponseContent.Instance.OK(data: NewstockInfo.Details); |
| | | } |
| | | else |
| | | { |
| | | content = WebResponseContent.Instance.Error(content.Message); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog($"ç»çä¿¡æ¯").Info(true, $"ãå¼å¸¸ãï¼ã{ex.Message}ã{Environment.NewLine}ã{ex.StackTrace}ã{Environment.NewLine}{Environment.NewLine}"); |
| | | return content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éªè¯ç»çæ°æ® |
| | | /// </summary> |
| | | /// <param name="materielGroupDTO">ç©æç»çDTO</param> |
| | | /// <param name="matSerialNumberDTOs">æ«ç åºåå·</param> |
| | | /// <param name="materielInfos">ç©æä¿¡æ¯</param> |
| | | /// <param name="materielCodes">ç©æç¼å·</param> |
| | | /// <param name="inboundOrder">å
¥åºåæ®</param> |
| | | /// <param name="stockInfo">ç»çä¿¡æ¯</param> |
| | | /// <returns></returns> |
| | | public (bool, string, object?) CheckMaterielGroupParam(GroupPalletDto materielGroupDTO, List<string> barcodeCodes, Dt_InboundOrder inboundOrder, Dt_StockInfo stockInfo) |
| | | { |
| | | (bool, string, object?) result = ModelValidate.ValidateModelData(materielGroupDTO); |
| | | if (!result.Item1) return result; |
| | | |
| | | if (_taskRepository.QueryFirst(x => x.PalletCode == materielGroupDTO.PalletCode) != null) |
| | | { |
| | | return (false, "该æçå·å·²æä»»å¡", materielGroupDTO); |
| | | } |
| | | |
| | | if (stockInfo != null && !string.IsNullOrEmpty(stockInfo.LocationCode) && stockInfo.StockStatus != (int)StockStatusEmun.ç»çæå) |
| | | { |
| | | return (false, "已䏿¶çæçä¸è½å次ç»ç", materielGroupDTO); |
| | | } |
| | | |
| | | if (_stockService.StockInfoDetailService.ExistBarcodes(barcodeCodes)) |
| | | { |
| | | return (false, $"{barcodeCodes[0]} æ¡ç å¨åºåä¸å·²åå¨", materielGroupDTO); |
| | | } |
| | | |
| | | if (inboundOrder == null) |
| | | { |
| | | return (false, "åæ®ä¸åå¨", materielGroupDTO); |
| | | } |
| | | |
| | | if (inboundOrder.Details == null || inboundOrder.Details.Count == 0) |
| | | { |
| | | return (false, "æ åæ®æç»ä¿¡æ¯", materielGroupDTO); |
| | | } |
| | | |
| | | if (inboundOrder.OrderStatus != (int)InOrderStatusEnum.æªå¼å§ && inboundOrder.OrderStatus != (int)InOrderStatusEnum.å
¥åºä¸) |
| | | { |
| | | return (false, "è¯¥åæ®ä¸å¯åç»ç", materielGroupDTO); |
| | | } |
| | | |
| | | List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details.Where(x => barcodeCodes.Contains(x.Barcode)).ToList(); |
| | | |
| | | if (inboundOrderDetails.GroupBy(x => x.Barcode).Count() != barcodeCodes.Count) |
| | | { |
| | | return (false, "æç©æä¸å¨åæ®å
", materielGroupDTO); |
| | | } |
| | | |
| | | return (true, "æå", materielGroupDTO); |
| | | } |
| | | |
| | | public async Task<WebResponseContent> MaterielGroupUpdateData(Dt_InboundOrder inboundOrder, List<Dt_InboundOrderDetail> inboundOrderDetails, Dt_StockInfo stockInfo) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | //await _inboundOrderRepository.Db.UpdateNav(inboundOrder).Include(x=>x.Details).ExecuteCommandAsync(); |
| | | _inboundOrderRepository.UpdateData(inboundOrder); |
| | | _inboundOrderDetailRepository.UpdateData(inboundOrderDetails); |
| | | _stockService.StockInfoService.AddMaterielGroup(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WIDESEA_IAllocateService", "WIDESEA_IAllocateService\WIDESEA_IAllocateService.csproj", "{A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LogLibrary", "LogLibrary\LogLibrary.csproj", "{A7C339A4-CC00-2872-6005-A272626BC5F1}" |
| | | EndProject |
| | | Global |
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| | | Debug|Any CPU = Debug|Any CPU |
| | |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {A6E822A3-5A09-4B18-BEE6-57CC7D7B8BEC}.Release|x86.Build.0 = Release|Any CPU |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Debug|x86.ActiveCfg = Debug|x86 |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Debug|x86.Build.0 = Debug|x86 |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Dev|Any CPU.ActiveCfg = Dev|Any CPU |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Dev|Any CPU.Build.0 = Dev|Any CPU |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Dev|x86.ActiveCfg = Dev|x86 |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Dev|x86.Build.0 = Dev|x86 |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Release|x86.ActiveCfg = Release|x86 |
| | | {A7C339A4-CC00-2872-6005-A272626BC5F1}.Release|x86.Build.0 = Release|x86 |
| | | EndGlobalSection |
| | | GlobalSection(SolutionProperties) = preSolution |
| | | HideSolutionNode = FALSE |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.CalcOut; |
| | | using WIDESEA_DTO.Inbound; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Outbound |
| | | { |
| | | [Route("api/[controller]")] |
| | | [ApiController] |
| | | public class InboundController : ControllerBase |
| | | { |
| | | private readonly WIDESEA_IInboundService.IInboundService Service; |
| | | public InboundController(WIDESEA_IInboundService.IInboundService inboundService) |
| | | { |
| | | Service = inboundService; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç»ç |
| | | /// </summary> |
| | | /// <param name="palletDto"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("GroupPallet"), AllowAnonymous] |
| | | public async Task<WebResponseContent> GroupPallet([FromBody]GroupPalletDto palletDto) |
| | | { |
| | | return await Service.GroupPallet(palletDto); |
| | | } |
| | | } |
| | | } |