| | |
| | | type: 'danger', |
| | | onClick: function () { |
| | | } |
| | | },{ |
| | | name: "çç¹æ¨¡æ¿å¯¼å
¥", |
| | | icon: '', |
| | | class: '', |
| | | value: 'BatchOutboundByExcel', |
| | | type: 'danger', |
| | | onClick: function () { |
| | | } |
| | | },{ |
| | | name: "è¶çº¿å°è´¦", |
| | | icon: '', |
| | | class: '', |
| | | value: 'GlueLineLedgerSummary', |
| | | type: 'warning', |
| | | onClick: function () { |
| | | } |
| | | } |
| | | ] |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <!-- é®ç½©å± --> |
| | | <div class="mask-layer" v-if="loading"></div> |
| | | |
| | | <vol-box v-model="show" title="æ¹éExcelçç¹åºåº" :width="800" :height="500"> |
| | | <template #content> |
| | | <el-form ref="form" :model="form" label-width="90px" class="mt-10"> |
| | | <!-- åºåºåºåï¼åä½ ç´æ¥åºåºå®å
¨ä¸æ ·ï¼ --> |
| | | <el-form-item label="åºåºåºå:"> |
| | | <el-select v-model="station" placeholder="è¯·éæ©åºåºåºå" style="width: 100%"> |
| | | <el-option |
| | | v-for="item in stations" |
| | | :key="item.key" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <!-- Excelä¸ä¼ --> |
| | | <el-form-item label="Excelæä»¶:" prop="file"> |
| | | <el-upload |
| | | ref="upload" |
| | | :auto-upload="false" |
| | | :limit="1" |
| | | accept=".xlsx" |
| | | :file-list="fileList" |
| | | @change="handleFileChange" |
| | | > |
| | | <el-button type="primary" :disabled="loading">éæ©Excelæä»¶</el-button> |
| | | <template #tip> |
| | | <div class="text-gray-500 text-xs mt-1"> |
| | | ä»
æ¯æ .xlsx<br> |
| | | 第ä¸åï¼ä»åºå· 第äºåï¼ç©æç¼ç |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | | |
| | | <!-- ç»æ --> |
| | | <el-form-item label="å¤çç»æ:"> |
| | | <div class="result-box p-3 border rounded bg-gray-50 h-32 overflow-auto"> |
| | | <div v-if="resultText" class="text-sm whitespace-pre-line">{{ resultText }}</div> |
| | | <div v-else class="text-gray-400 text-sm">è¯·éæ©æä»¶å¹¶æ§è¡æ¹éåºåº</div> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button size="small" plain @click="resetForm">éç½®</el-button> |
| | | <el-button size="small" type="danger" plain @click="batchImport" :loading="loading"> |
| | | <i class="el-icon-check"></i> 确认æ¹éåºåº |
| | | </el-button> |
| | | <el-button size="small" type="primary" plain @click="show = false"> |
| | | <i class="el-icon-close"></i> å
³é |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </vol-box> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolBox from '@/components/basic/VolBox.vue' |
| | | import { stationManager } from "@/../src/uitils/stationManager"; |
| | | |
| | | export default { |
| | | components: { VolBox }, |
| | | props: { |
| | | value: { type: Boolean, default: false } |
| | | }, |
| | | data() { |
| | | return { |
| | | show: false, |
| | | loading: false, |
| | | station: stationManager.getStation(), // 仿¬å°ç¼åè·åç«å° |
| | | stations: [ |
| | | { label: "ç«å°2", value: "2-1" }, |
| | | { label: "ç«å°3", value: "3-1" }, |
| | | ], |
| | | fileList: [], |
| | | resultText: '', |
| | | form: {} |
| | | } |
| | | }, |
| | | methods: { |
| | | open() { |
| | | this.show = true |
| | | this.station = stationManager.getStation() // æ¯æ¬¡æå¼éæ°è·å |
| | | this.resetForm() |
| | | }, |
| | | handleFileChange(file) { |
| | | this.fileList = [file.raw] |
| | | }, |
| | | async batchImport() { |
| | | // éªè¯ç«å° |
| | | if (!this.station) { |
| | | this.$message.warning("è¯·éæ©åºåºåºå") |
| | | return |
| | | } |
| | | if (this.fileList.length === 0) { |
| | | this.$message.warning("è¯·éæ©Excelæä»¶") |
| | | return |
| | | } |
| | | |
| | | this.loading = true |
| | | this.resultText = "æ£å¨å¤ç..." |
| | | |
| | | try { |
| | | const formData = new FormData() |
| | | formData.append('file', this.fileList[0]) |
| | | formData.append('outStation', this.station) // æäº¤ç«å°ï¼ |
| | | |
| | | const res = await this.http.post( |
| | | '/api/Task/BatchOutboundByExcel', |
| | | formData, |
| | | { headers: { 'Content-Type': 'multipart/form-data' } } |
| | | ) |
| | | |
| | | if (res.status) { |
| | | const d = res.data |
| | | this.resultText = `æ»æ¡æ°ï¼${d.æ»æ¡æ°}\næåï¼${d.æåæ¡æ°}\n失败ï¼${d.å¤±è´¥æ¡æ°}` |
| | | if (d.失败æç»?.length) this.resultText += `\n\n失败ï¼\n${d.失败æç».join('\n')}` |
| | | this.$message.success("æ¹é宿") |
| | | } else { |
| | | this.resultText = "失败ï¼" + res.message |
| | | this.$message.error(res.message) |
| | | } |
| | | } catch (err) { |
| | | this.resultText = "å¼å¸¸ï¼" + err.message |
| | | this.$message.error("æ¹é失败ï¼" + err.message) |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | | }, |
| | | resetForm() { |
| | | this.fileList = [] |
| | | this.resultText = '' |
| | | this.$refs.upload?.clearFiles() |
| | | } |
| | | }, |
| | | watch: { |
| | | show(val) { |
| | | if (!val) this.resetForm() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .dialog-footer { text-align: right; } |
| | | .text-gray-500 { color: #909399; font-size: 12px; } |
| | | .result-box { white-space: pre-line; line-height: 1.5; } |
| | | |
| | | /* é®ç½©å± åä½ é¡µé¢å®å
¨ä¸æ · */ |
| | | .mask-layer { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100vw; |
| | | height: 100vh; |
| | | background: rgba(0,0,0,0.5); |
| | | z-index: 9999; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | .mask-layer::after { |
| | | content: ""; |
| | | width: 40px; |
| | | height: 40px; |
| | | border: 4px solid #fff; |
| | | border-top: 4px solid #409eff; |
| | | border-radius: 50%; |
| | | animation: spin 1s linear infinite; |
| | | } |
| | | @keyframes spin { |
| | | 0% { transform: rotate(0deg); } |
| | | 100% { transform: rotate(360deg); } |
| | | } |
| | | </style> |
| | |
| | | </el-input-number> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- ===================== æ°å¢ï¼ä¾åºåç¼ç ï¼å®æ¶æç´¢ä¸æï¼ ===================== --> |
| | | <el-form ref="form" :model="form" label-width="90px"> |
| | | <el-form-item label="ä¾åºåç¼ç :"> |
| | | <el-select |
| | | v-model="supplierCode" |
| | | filterable |
| | | remote |
| | | reserve-keyword |
| | | placeholder="请è¾å
¥/éæ©ä¾åºåç¼ç " |
| | | :remote-method="remoteSearchSupplier" |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="item in supplierList" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- ======================================================================== --> |
| | | |
| | | </template> |
| | | <template #footer> |
| | | <div> |
| | | <!-- æ·»å loadingç¶æådisabled屿§ --> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | |
| | | show: false, |
| | | locationTypes: [], |
| | | locationType: "", |
| | | // æ°å¢æäº¤ç¶ææ è¯ |
| | | isSubmitting: false |
| | | isSubmitting: false, |
| | | // ================= æ°å¢ ================= |
| | | supplierCode: '', // ä¾åºåç¼ç ç»å® |
| | | supplierList: [] // 䏿å表 |
| | | // ======================================= |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | this.getData(); |
| | | }, |
| | | submit() { |
| | | // 1. éªè¯å¿
填项 |
| | | if (!this.locationType) { |
| | | this.$message.warning('è¯·éæ©åºåºåºå'); |
| | | return; |
| | | } |
| | | |
| | | // 2. 设置æäº¤ç¶æä¸ºtrueï¼ç¦ç¨æé® |
| | | this.isSubmitting = true; |
| | | |
| | | this.$emit('parentCall', ($vue) => { |
| | | this.http.post(`/api/Task/PalletOutboundTask?num=${this.num}&locationType=${this.locationType}`, {}, 'æ°æ®å¤çä¸...') |
| | | // ===================== æ¹é æ¥å£ï¼å¸¦ä¸ supplierCode ===================== |
| | | this.http.post( |
| | | `/api/Task/PalletOutboundTask?num=${this.num}&locationType=${this.locationType}&SupplierCode=${this.supplierCode || ''}`, |
| | | {}, 'æ°æ®å¤çä¸...') |
| | | // ==================================================================== |
| | | .then((x) => { |
| | | if (!x.status) { |
| | | this.$message.error(x.message) |
| | |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | // æè·è¯·æ±å¼å¸¸ï¼æç¤ºç¨æ· |
| | | this.$message.error('请æ±å¤±è´¥ï¼è¯·ç¨åéè¯'); |
| | | console.error('æäº¤å¤±è´¥:', error); |
| | | }) |
| | | .finally(() => { |
| | | // 3. 请æ±å®æï¼æå/失败ï¼åéç½®æäº¤ç¶æ |
| | | this.isSubmitting = false; |
| | | }); |
| | | }) |
| | |
| | | this.locationTypes = x.data; |
| | | }) |
| | | }, |
| | | |
| | | remoteSearchSupplier(keyword) { |
| | | if (!keyword) { |
| | | this.supplierList = []; |
| | | return; |
| | | } |
| | | // è°ç¨åç«¯å®æ¶æç´¢æ¥å£ |
| | | this.http.get(`/api/Task/SearchSupplierCode?keyword=${keyword}`) |
| | | .then(res => { |
| | | if (res.status) { |
| | | this.supplierList = res.data || []; |
| | | } |
| | | }) |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridHeader from "./extend/GlueLineLedgerSummary.vue"; |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: gridHeader, |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | this.summary = true; |
| | | var GlueLineLedgerSummaryBtn = this.buttons.find( |
| | | (x) => x.value == "GlueLineLedgerSummary" |
| | | ); |
| | | if (GlueLineLedgerSummaryBtn != null) { |
| | | GlueLineLedgerSummaryBtn.onClick = () => { |
| | | this.$refs.gridHeader.open(); |
| | | }; |
| | | } |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼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; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <!-- é®ç½©å± --> |
| | | <div class="mask-layer" v-if="loading"></div> |
| | | |
| | | <vol-box v-model="show" title="æ¹éExcelçç¹åºåº" :width="800" :height="500"> |
| | | <template #content> |
| | | <el-form ref="form" :model="form" label-width="90px" class="mt-10"> |
| | | <!-- åºåºåºåï¼åä½ ç´æ¥åºåºå®å
¨ä¸æ ·ï¼ --> |
| | | <el-form-item label="åºåºåºå:"> |
| | | <el-select v-model="station" placeholder="è¯·éæ©åºåºåºå" style="width: 100%"> |
| | | <el-option |
| | | v-for="item in stations" |
| | | :key="item.key" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <!-- Excelä¸ä¼ --> |
| | | <el-form-item label="Excelæä»¶:" prop="file"> |
| | | <el-upload |
| | | ref="upload" |
| | | :auto-upload="false" |
| | | :limit="1" |
| | | accept=".xlsx" |
| | | :file-list="fileList" |
| | | @change="handleFileChange" |
| | | > |
| | | <el-button type="primary" :disabled="loading">éæ©Excelæä»¶</el-button> |
| | | <template #tip> |
| | | <div class="text-gray-500 text-xs mt-1"> |
| | | ä»
æ¯æ .xlsx<br> |
| | | 第å
«åï¼ä»åºå· 第äºåï¼ç©æç¼ç |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | | |
| | | <!-- ç»æ --> |
| | | <el-form-item label="å¤çç»æ:"> |
| | | <div class="result-box p-3 border rounded bg-gray-50 h-32 overflow-auto"> |
| | | <div v-if="resultText" class="text-sm whitespace-pre-line">{{ resultText }}</div> |
| | | <div v-else class="text-gray-400 text-sm">è¯·éæ©æä»¶å¹¶æ§è¡æ¹éåºåº</div> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button size="small" plain @click="resetForm">éç½®</el-button> |
| | | <el-button size="small" type="danger" plain @click="batchImport" :loading="loading"> |
| | | <i class="el-icon-check"></i> 确认æ¹éåºåº |
| | | </el-button> |
| | | <el-button size="small" type="primary" plain @click="show = false"> |
| | | <i class="el-icon-close"></i> å
³é |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </vol-box> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolBox from '@/components/basic/VolBox.vue' |
| | | import { stationManager } from "@/../src/uitils/stationManager"; |
| | | |
| | | export default { |
| | | components: { VolBox }, |
| | | props: { |
| | | value: { type: Boolean, default: false } |
| | | }, |
| | | data() { |
| | | return { |
| | | show: false, |
| | | loading: false, |
| | | station: stationManager.getStation(), // 仿¬å°ç¼åè·åç«å° |
| | | stations: [ |
| | | { label: "ç«å°2", value: "2-1" }, |
| | | { label: "ç«å°3", value: "3-1" }, |
| | | ], |
| | | fileList: [], |
| | | resultText: '', |
| | | form: {} |
| | | } |
| | | }, |
| | | methods: { |
| | | open() { |
| | | this.show = true |
| | | this.station = stationManager.getStation() // æ¯æ¬¡æå¼éæ°è·å |
| | | this.resetForm() |
| | | }, |
| | | handleFileChange(file) { |
| | | this.fileList = [file.raw] |
| | | }, |
| | | async batchImport() { |
| | | // éªè¯ç«å° |
| | | if (!this.station) { |
| | | this.$message.warning("è¯·éæ©åºåºåºå") |
| | | return |
| | | } |
| | | if (this.fileList.length === 0) { |
| | | this.$message.warning("è¯·éæ©Excelæä»¶") |
| | | return |
| | | } |
| | | |
| | | this.loading = true |
| | | this.resultText = "æ£å¨å¤ç..." |
| | | |
| | | try { |
| | | const formData = new FormData() |
| | | formData.append('file', this.fileList[0]) |
| | | formData.append('outStation', this.station) // æäº¤ç«å°ï¼ |
| | | |
| | | const res = await this.http.post( |
| | | '/api/Task/BatchOutboundByExcel', |
| | | formData, |
| | | { headers: { 'Content-Type': 'multipart/form-data' } } |
| | | ) |
| | | |
| | | if (res.status) { |
| | | const d = res.data |
| | | this.resultText = `满足ä»åºå·åæå·æ»æ¡æ°ï¼${d.total}\næååºåºæ»æ¡æ°ï¼${d.success}\n失败ï¼${d.fail}` |
| | | if (d.failMsg?.length) this.resultText += `\n\n失败ï¼\n${d.failMsg.join('\n')}` |
| | | this.$message.success("æ¹é宿") |
| | | } else { |
| | | this.resultText = "失败ï¼" + res.message |
| | | this.$message.error(res.message) |
| | | } |
| | | } catch (err) { |
| | | this.resultText = "å¼å¸¸ï¼" + err.message |
| | | this.$message.error("æ¹é失败ï¼" + err.message) |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | | }, |
| | | resetForm() { |
| | | this.fileList = [] |
| | | this.resultText = '' |
| | | this.$refs.upload?.clearFiles() |
| | | } |
| | | }, |
| | | watch: { |
| | | show(val) { |
| | | if (!val) this.resetForm() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .dialog-footer { text-align: right; } |
| | | .text-gray-500 { color: #909399; font-size: 12px; } |
| | | .result-box { white-space: pre-line; line-height: 1.5; } |
| | | |
| | | /* é®ç½©å± åä½ é¡µé¢å®å
¨ä¸æ · */ |
| | | .mask-layer { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100vw; |
| | | height: 100vh; |
| | | background: rgba(0,0,0,0.5); |
| | | z-index: 9999; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | .mask-layer::after { |
| | | content: ""; |
| | | width: 40px; |
| | | height: 40px; |
| | | border: 4px solid #fff; |
| | | border-top: 4px solid #409eff; |
| | | border-radius: 50%; |
| | | animation: spin 1s linear infinite; |
| | | } |
| | | @keyframes spin { |
| | | 0% { transform: rotate(0deg); } |
| | | 100% { transform: rotate(360deg); } |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <vol-box v-model="show" title="è¶çº¿å°è´¦æ±æ»" :width="1200" :height="750"> |
| | | <template #content> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="100px" class="form-container"> |
| | | <div style="display: flex;flex-wrap:wrap;align-items: center;gap: 10px;margin-bottom:10px;"> |
| | | <el-form-item label="ä¾åºåç¼ç :" prop="supplyCode" style="margin-bottom: 0;flex:1;"> |
| | | <el-input |
| | | v-model="form.supplyCode" |
| | | placeholder="请è¾å
¥ä¾åºåç¼ç " |
| | | clearable |
| | | @keyup.enter="getSummary" |
| | | ref="supplyInput" |
| | | :disabled="loading" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <!-- ð¥ ä¿®å¤åçæ¥æéæ©ï¼åä½ æªå¾æ ·å¼å®å
¨ä¸è´ --> |
| | | <el-form-item label="ååºæ¥æ:" style="margin-bottom: 0;"> |
| | | <div style="display: flex; align-items: center; gap: 4px;"> |
| | | <el-date-picker |
| | | v-model="form.startDate" |
| | | type="date" |
| | | placeholder="yyyy-MM-dd" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 140px;" |
| | | :disabled="loading" |
| | | /> |
| | | <span>è³</span> |
| | | <el-date-picker |
| | | v-model="form.endDate" |
| | | type="date" |
| | | placeholder="yyyy-MM-dd" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 140px;" |
| | | :disabled="loading" |
| | | /> |
| | | </div> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="ç¶æ:" style="margin-bottom: 0;width:180px;"> |
| | | <el-select v-model="form.status" placeholder="å
¨é¨" clearable :disabled="loading"> |
| | | <el-option label="å
¨é¨" value="" /> |
| | | <el-option label="å
¨é¨å½è¿" value="å
¨é¨å½è¿" /> |
| | | <el-option label="é¨åå½è¿" value="é¨åå½è¿" /> |
| | | <el-option label="æªå½è¿" value="æªå½è¿" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item style="margin-bottom: 0;"> |
| | | <el-button type="primary" @click="getSummary" :loading="loading"> |
| | | æ¥è¯¢æ±æ» |
| | | </el-button> |
| | | <el-button @click="resetForm">éç½®</el-button> |
| | | </el-form-item> |
| | | </div> |
| | | </el-form> |
| | | |
| | | <div class="table-container"> |
| | | <el-table |
| | | v-loading="loading" |
| | | :data="tableData" |
| | | border |
| | | stripe |
| | | style="width:100%;" |
| | | show-summary |
| | | :summary-method="getSummaries" |
| | | > |
| | | <el-table-column label="ä¾åºåç¼ç " prop="supplyCode" width="160" align="center" /> |
| | | <el-table-column label="ååºæ¥æ" prop="borrowTime" width="180" align="center" /> |
| | | <el-table-column label="ååºæ°é" prop="unreturnedQuantity" width="130" align="center" /> |
| | | <el-table-column label="å·²å½è¿æ°é" prop="returnedQty" width="130" align="center" /> |
| | | <el-table-column label="å¾
å½è¿æ°é" prop="pendingReturnQty" width="130" align="center" /> |
| | | <el-table-column label="ç¶æ" prop="status" min-width="120"/> |
| | | </el-table> |
| | | |
| | | <div v-if="!loading && tableData.length === 0" class="text-center py-10"> |
| | | ææ æ°æ® |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer text-right"> |
| | | <el-button type="success" icon="el-icon-download" @click="exportExcel"> |
| | | 导åºExcel |
| | | </el-button> |
| | | <el-button @click="show = false">å
³é</el-button> |
| | | </div> |
| | | </template> |
| | | </vol-box> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolBox from '@/components/basic/VolBox.vue' |
| | | |
| | | export default { |
| | | components: { VolBox }, |
| | | props: { |
| | | value: { type: Boolean, default: false } |
| | | }, |
| | | data() { |
| | | const validateSupply = (rule, value, callback) => { |
| | | if (!value) return callback(new Error('请è¾å
¥ä¾åºåç¼ç ')) |
| | | callback() |
| | | } |
| | | return { |
| | | show: false, |
| | | loading: false, |
| | | form: { |
| | | supplyCode: '', |
| | | startDate: '', |
| | | endDate: '', |
| | | status: '' |
| | | }, |
| | | tableData: [], |
| | | rules: { |
| | | supplyCode: [{ validator: validateSupply, trigger: 'blur' }] |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | open() { |
| | | this.show = true |
| | | this.$nextTick(() => this.$refs.supplyInput.focus()) |
| | | }, |
| | | |
| | | setRowStatus(row) { |
| | | const pending = Number(row.pendingReturnQty || 0) |
| | | if (pending === 0) { |
| | | row.status = 'å
¨é¨å½è¿' |
| | | } else if (row.returnedQty > 0) { |
| | | row.status = 'é¨åå½è¿' |
| | | } else { |
| | | row.status = 'æªå½è¿' |
| | | } |
| | | }, |
| | | |
| | | getSummaries(param) { |
| | | const sums = ['å计', '', 0, 0, 0, ''] |
| | | this.tableData.forEach(item => { |
| | | sums[2] += Number(item.unreturnedQuantity || 0) |
| | | sums[3] += Number(item.returnedQty || 0) |
| | | sums[4] += Number(item.pendingReturnQty || 0) |
| | | }) |
| | | return sums |
| | | }, |
| | | |
| | | exportExcel() { |
| | | if (this.tableData.length === 0) { |
| | | this.$message.warning('ææ æ°æ®å¯å¯¼åº') |
| | | return |
| | | } |
| | | |
| | | // 计ç®å计 |
| | | let totalUnreturn = 0 |
| | | let totalReturn = 0 |
| | | let totalPending = 0 |
| | | |
| | | this.tableData.forEach(item => { |
| | | totalUnreturn += Number(item.unreturnedQuantity || 0) |
| | | totalReturn += Number(item.returnedQty || 0) |
| | | totalPending += Number(item.pendingReturnQty || 0) |
| | | }) |
| | | |
| | | // 表头 |
| | | const headers = 'ä¾åºåç¼ç ,ååºæ¥æ,ååºæ°é,å·²å½è¿æ°é,å¾
å½è¿æ°é,ç¶æ\n' |
| | | let csv = headers |
| | | |
| | | // æ¼æ¥æ°æ® |
| | | this.tableData.forEach(item => { |
| | | csv += `${item.supplyCode},${item.borrowTime},${item.unreturnedQuantity},${item.returnedQty},${item.pendingReturnQty},${item.status}\n` |
| | | }) |
| | | |
| | | // æ¼æ¥åè®¡è¡ |
| | | csv += `å计,,${totalUnreturn},${totalReturn},${totalPending},\n` |
| | | |
| | | // ä¸è½½ |
| | | const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' }) |
| | | const link = document.createElement('a') |
| | | link.href = URL.createObjectURL(blob) |
| | | link.download = 'è¶çº¿å°è´¦æ±æ».csv' |
| | | link.click() |
| | | this.$message.success('å¯¼åºæå') |
| | | }, |
| | | |
| | | async getSummary() { |
| | | await this.$refs.form.validate() |
| | | let supplyCode = this.form.supplyCode.trim() |
| | | this.loading = true |
| | | try { |
| | | const res = await this.http.post( |
| | | "/api/PlasticContainerLedger/GlueLineLedgerSummary?supplyCode=" + supplyCode |
| | | ) |
| | | if (res.status && res.code === 0) { |
| | | let list = res.data || [] |
| | | list.forEach(item => this.setRowStatus(item)) |
| | | |
| | | // æ¥æçé |
| | | if (this.form.startDate && this.form.endDate) { |
| | | list = list.filter(item => { |
| | | return item.borrowTime >= this.form.startDate && item.borrowTime <= this.form.endDate |
| | | }) |
| | | } else if (this.form.startDate) { |
| | | list = list.filter(item => item.borrowTime >= this.form.startDate) |
| | | } else if (this.form.endDate) { |
| | | list = list.filter(item => item.borrowTime <= this.form.endDate) |
| | | } |
| | | |
| | | if (this.form.status) { |
| | | list = list.filter(item => item.status === this.form.status) |
| | | } |
| | | |
| | | this.tableData = list |
| | | this.$message.success("æ¥è¯¢æå") |
| | | } |
| | | } catch (error) { |
| | | this.$message.error("请æ±å¤±è´¥") |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | | }, |
| | | |
| | | resetForm() { |
| | | this.form = { |
| | | supplyCode: '', |
| | | startDate: '', |
| | | endDate: '', |
| | | status: '' |
| | | } |
| | | this.tableData = [] |
| | | this.$refs.form.clearValidate() |
| | | } |
| | | }, |
| | | watch: { |
| | | value(val) { this.show = val }, |
| | | show(val) { if (!val) setTimeout(() => this.resetForm(), 200) } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .table-container { height: 450px; } |
| | | .py-10 { text-align: center; padding: 30px 0; color: #999; } |
| | | .dialog-footer { text-align: right; padding: 10px 0; } |
| | | </style> |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | |
| | | import { createVNode, render, h, reactive } from 'vue'; |
| | | import { ElDialog, ElForm, ElFormItem, ElSelect, ElOption, ElButton, ElMessage, ElLoading } from 'element-plus'; |
| | | import gridHeader from './extend/CrossAreaRelocationDialog.vue' |
| | | import gridBody from './extend/BatchOutboundByExcel.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: gridHeader, |
| | | gridBody: '', |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | let BatchOutboundByExcelBtn = this.buttons.find(x => x.value === 'BatchOutboundByExcel'); |
| | | if (BatchOutboundByExcelBtn) { |
| | | // éåæé®ç¹å»äºä»¶ |
| | | BatchOutboundByExcelBtn.onClick = function () { |
| | | this.$refs.gridBody.open(); |
| | | }; |
| | | } |
| | | // let InOrder = this.buttons.find(x => x.value == 'StockOutbound'); |
| | | // if (InOrder) { |
| | | // InOrder.onClick = function () { |
| | |
| | | name: 'recheckOutPicking', |
| | | component: () => import('@/views/outbound/recheckOutPicking.vue'), |
| | | meta: { title: 'æ£é确认', keepAlive: false } |
| | | } |
| | | }, { |
| | | path: '/PlasticContainerLedger', |
| | | name: 'Dt_PlasticContainerLedger', |
| | | component: () => import('@/views/stock/Dt_PlasticContainerLedger.vue') |
| | | } |
| | | ] |
| | | |
| | | export default viewgird |
| | |
| | | type: "select", |
| | | width: 120, |
| | | align: "left", |
| | | edit: { type: "" }, |
| | | |
| | | required: true, |
| | | }, |
| | | { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view-grid |
| | | ref="grid" |
| | | :columns="columns" |
| | | :editFormFields="editFormFields" |
| | | :editFormOptions="editFormOptions" |
| | | :searchFormFields="searchFormFields" |
| | | :searchFormOptions="searchFormOptions" |
| | | :table="table" |
| | | :extend="extend"> |
| | | </view-grid> |
| | | </template> |
| | | |
| | | <script> |
| | | import extend from "@/extension/stock/Dt_PlasticContainerLedger.js"; |
| | | import { ref, defineComponent } from "vue"; |
| | | |
| | | export default defineComponent({ |
| | | setup() { |
| | | const table = ref({ |
| | | key: "id", |
| | | footer: "Foots", |
| | | cnName: "è¶ç®±å°è´¦", |
| | | name: "plasticContainerLedger", |
| | | url: "/PlasticContainerLedger/", |
| | | sortName: "createDate", |
| | | }); |
| | | |
| | | // ç¼è¾å段 |
| | | const editFormFields = ref({ |
| | | supplyCode: "", |
| | | palletCode: "", |
| | | remark: "", |
| | | }); |
| | | |
| | | const editFormOptions = ref([ |
| | | [ |
| | | { field: "supplyCode", title: "ä¾åºåç¼å·", type: "string" }, |
| | | { field: "palletCode", title: "æçç¼å·", type: "string" }, |
| | | ], |
| | | [ |
| | | { field: "remark", title: "夿³¨", type: "textarea", span: 24 } |
| | | ] |
| | | ]); |
| | | |
| | | // æç´¢æ¡ä»¶ |
| | | const searchFormFields = ref({ |
| | | supplyCode: "", |
| | | palletCode: "", |
| | | createDate: "", |
| | | }); |
| | | |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "ä¾åºåç¼å·", field: "supplyCode", type: "like" }, |
| | | { title: "æçç¼å·", field: "palletCode", type: "like" }, |
| | | { title: "ååºæ¶é´", field: "createDate", type: "datetime" }, |
| | | ] |
| | | ]); |
| | | |
| | | // è¡¨æ ¼å å®å
¨å¯¹åº Dt_PlasticContainerLedger |
| | | const columns = ref([ |
| | | { field: "id", title: "ID", type: "int", width: 70, align: "left", hidden: true }, |
| | | { field: "supplyCode", title: "ä¾åºåç¼å·", type: "string", width: 140, align: "left" }, |
| | | { field: "palletCode", title: "æçç¼å·", type: "string", width: 150, align: "left" }, |
| | | { field: "remark", title: "夿³¨", type: "string", width: 220, align: "left" }, |
| | | { field: "creater", title: "å建人", type: "string", width: 100, align: "left" }, |
| | | { field: "createDate", title: "ååºæ¶é´", type: "datetime", width: 180, align: "left" }, |
| | | ]); |
| | | |
| | | return { |
| | | table, |
| | | extend, |
| | | editFormFields, |
| | | editFormOptions, |
| | | searchFormFields, |
| | | searchFormOptions, |
| | | columns |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | |
| | | [Navigate(NavigateType.OneToMany, nameof(Dt_StockInfoDetail.StockId), nameof(StockId))] |
| | | public List<Dt_StockInfoDetail> Details { get; set; } |
| | | } |
| | | |
| | | public class ExcelInventoryOutboundDto |
| | | { |
| | | /// <summary> |
| | | /// åå¨å°ç¹ |
| | | /// </summary> |
| | | public string WarehouseCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æå· |
| | | /// </summary> |
| | | public string MaterialCode { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IStockService |
| | | { |
| | | public interface IPlasticContainerLedgerService : IService<Dt_PlasticContainerLedger> |
| | | { |
| | | IRepository<Dt_PlasticContainerLedger> Repository { get; } |
| | | |
| | | WebResponseContent GlueLineLedgerSummary(string supplyCode); |
| | | } |
| | | } |
| | |
| | | *----------------------------------------------------------------*/ |
| | | #endregion << ç æ¬ 注 é >> |
| | | |
| | | using Microsoft.AspNetCore.Http; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | |
| | | Task<WebResponseContent> RequestInboundTask(string palletCode, string stationCode); |
| | | |
| | | Task<WebResponseContent> PalletOutboundTask(int num, int locationType); |
| | | Task<WebResponseContent> PalletOutboundTask(int num, int locationType,string? supplierCode = null); |
| | | |
| | | Task<WebResponseContent> TaskCompleted(string taskNum); |
| | | |
| | |
| | | Task<WebResponseContent> AreaOutbound(List<StockViewDTO> stockViews); |
| | | |
| | | Task<WebResponseContent> CrossAreaOutbound(List<StockViewDTO> stockViews, int targetLocationType); |
| | | |
| | | Task<WebResponseContent> BatchOutboundByExcel(IFormFile file, string outStation); |
| | | |
| | | Task<WebResponseContent> SearchSupplierCode(string keyword); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_Model.Models.Allocate |
| | | { |
| | | [SugarTable(nameof(Stuedent), "è°æ¨å")] |
| | | public class Stuedent |
| | | { |
| | | /// <summary> |
| | | /// 主é®IDï¼èªå¢ï¼ |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºID |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºID")] |
| | | public int WarehouseId { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.DB.Models; |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | [SugarTable(nameof(Dt_PlasticContainerLedger), "è¶ç®±å°è´¦")] |
| | | public class Dt_PlasticContainerLedger : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºåç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ä¾åºåç¼å·")] |
| | | public string SupplyCode { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æçç¼å·")] |
| | | public string PalletCode { get; set; } |
| | | } |
| | | } |
| | |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ååºä¾åºå |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ååºä¾åºå")] |
| | | public string SupplyCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ååºæ¶é´ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ååºæ¶é´")] |
| | | public DateTime BorrowTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåæç» |
| | | /// </summary> |
| | | [Navigate(NavigateType.OneToMany, nameof(Dt_StockInfoDetail.StockId), nameof(Id))] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_StockService |
| | | { |
| | | public class PlasticContainerLedgerService : ServiceBase<Dt_PlasticContainerLedger, IRepository<Dt_PlasticContainerLedger>>, IPlasticContainerLedgerService |
| | | { |
| | | private readonly IRepository<Dt_StockInfo> _stockRepository; |
| | | public PlasticContainerLedgerService(IRepository<Dt_PlasticContainerLedger> BaseDal, IRepository<Dt_StockInfo> stockRepository) : base(BaseDal) |
| | | { |
| | | _stockRepository = stockRepository; |
| | | } |
| | | |
| | | public IRepository<Dt_PlasticContainerLedger> Repository => BaseDal; |
| | | |
| | | public WebResponseContent GlueLineLedgerSummary(string supplyCode) |
| | | { |
| | | |
| | | supplyCode = supplyCode?.Trim() ?? ""; |
| | | |
| | | var now = DateTime.Now; |
| | | |
| | | |
| | | var borrowGroup = BaseDal.Db.Queryable<Dt_PlasticContainerLedger>() |
| | | .Where(x => x.SupplyCode == supplyCode) |
| | | .GroupBy(x => new { x.SupplyCode, x.CreateDate.Date }) |
| | | .Select(x => new |
| | | { |
| | | x.SupplyCode, |
| | | CreateDate = x.CreateDate.Date, |
| | | BorrowQty = SqlFunc.AggregateCount(x.Id) |
| | | }) |
| | | .ToList(); |
| | | |
| | | |
| | | var returnedGroup = _stockRepository.Db.Queryable<Dt_StockInfo>() |
| | | .Where(x => x.SupplyCode == supplyCode && !string.IsNullOrEmpty(x.Remark)) |
| | | .GroupBy(x => new { x.SupplyCode, x.BorrowTime.Date }) |
| | | .Select(x => new |
| | | { |
| | | x.SupplyCode, |
| | | CreateDate = x.BorrowTime.Date, |
| | | ReturnedQty = SqlFunc.AggregateCount(x.Id) |
| | | }) |
| | | .ToList(); |
| | | |
| | | var result = new List<GlueLineLedgerSummaryDTO>(); |
| | | |
| | | |
| | | foreach (var item in borrowGroup) |
| | | { |
| | | result.Add(new GlueLineLedgerSummaryDTO |
| | | { |
| | | SupplyCode = item.SupplyCode, |
| | | BorrowTime = item.CreateDate.ToString("yyyy-MM-dd"), |
| | | UnreturnedQuantity = item.BorrowQty, |
| | | ReturnedQty = 0, |
| | | PendingReturnQty = item.BorrowQty |
| | | }); |
| | | } |
| | | |
| | | |
| | | foreach (var item in returnedGroup) |
| | | { |
| | | result.Add(new GlueLineLedgerSummaryDTO |
| | | { |
| | | SupplyCode = item.SupplyCode, |
| | | BorrowTime = item.CreateDate.ToString("yyyy-MM-dd"), |
| | | UnreturnedQuantity = item.ReturnedQty, |
| | | ReturnedQty = item.ReturnedQty, |
| | | PendingReturnQty = 0 |
| | | }); |
| | | } |
| | | |
| | | var filterResult = result |
| | | .Where(x => |
| | | { |
| | | DateTime borrowTime = DateTime.Parse(x.BorrowTime); |
| | | |
| | | if (x.PendingReturnQty > 0) |
| | | return true; |
| | | |
| | | if (borrowTime >= now.AddMonths(-1)) |
| | | return true; |
| | | |
| | | return false; |
| | | }) |
| | | .ToList(); |
| | | |
| | | return WebResponseContent.Instance.OK(data: filterResult); |
| | | } |
| | | |
| | | |
| | | public class GlueLineLedgerSummaryDTO{ |
| | | public string SupplyCode { get; set; } |
| | | |
| | | public int UnreturnedQuantity { get; set; } |
| | | |
| | | public int ReturnedQty { get; set; } |
| | | public int PendingReturnQty { get; set; } |
| | | public string BorrowTime { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | public readonly IRepository<Dt_LocationType> _locationTypeRepository; |
| | | public readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository; |
| | | private readonly IRepository<Dt_OutStockLockInfo> _outboundLockInfoRepository; |
| | | private readonly IRepository<Dt_PlasticContainerLedger> _plasticContainerLedger; |
| | | public IRepository<Dt_Task> Repository => BaseDal; |
| | | |
| | | private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new() |
| | |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); |
| | | |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository) : base(BaseDal) |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_PlasticContainerLedger> plasticContainerLedger) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _locationTypeRepository = locationTypeRepository; |
| | | _warehouseAreaRepository = warehouseAreaRepository; |
| | | _outboundLockInfoRepository = outboundLockInfoRepository; |
| | | _plasticContainerLedger = plasticContainerLedger; |
| | | } |
| | | |
| | | public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum) |
| | |
| | | } |
| | | _logger.LogInformation($"TaskService TaskCompleted: {JsonConvert.SerializeObject(task)} , {task.TaskType} "); |
| | | |
| | | |
| | | var taskType = (TaskTypeEnum)task.TaskType; |
| | | bool isInboundTask = taskType is |
| | | TaskTypeEnum.Inbound |
| | | or TaskTypeEnum.InEmpty |
| | | or TaskTypeEnum.InInventory |
| | | or TaskTypeEnum.InPick |
| | | or TaskTypeEnum.InQuality |
| | | or TaskTypeEnum.ProductionReturn |
| | | or TaskTypeEnum.MesMatReturn |
| | | or TaskTypeEnum.InAllocate |
| | | or TaskTypeEnum.AllocateInWarehouse; |
| | | |
| | | if (isInboundTask && !string.IsNullOrEmpty(task.PalletCode)) |
| | | { |
| | | string palletCode = task.PalletCode; |
| | | |
| | | // 1. 弿¥æ¥è¯¢æç对åºçååºå°è´¦ï¼æ£ç¡®åæ³ï¼ |
| | | var ledger = await _plasticContainerLedger.Db.Queryable<Dt_PlasticContainerLedger>() |
| | | .FirstAsync(x => x.PalletCode == palletCode); |
| | | |
| | | if (ledger != null) |
| | | { |
| | | // 2. å é¤å°è´¦ï¼å·²å½è¿ï¼ |
| | | await _plasticContainerLedger.DeleteDataAsync(ledger); |
| | | |
| | | // 3. æ¥è¯¢åºå |
| | | var stock = await _stockService.StockInfoService.Repository |
| | | .QueryFirstAsync(x => x.PalletCode == palletCode); |
| | | |
| | | if (stock != null) |
| | | { |
| | | // 4. æ¼æ¥å¤æ³¨ |
| | | string borrowTime = ledger.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | string returnTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | string remark = $"{borrowTime} ååºï¼{returnTime} è¿å"; |
| | | |
| | | stock.Remark = string.IsNullOrEmpty(stock.Remark) |
| | | ? remark |
| | | : $"{stock.Remark}ï¼{remark}"; |
| | | |
| | | stock.SupplyCode = ledger.SupplyCode; |
| | | stock.BorrowTime = ledger.CreateDate; |
| | | await _stockService.StockInfoService.Repository.UpdateDataAsync(stock); |
| | | } |
| | | } |
| | | } |
| | | |
| | | MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted"); |
| | | if (methodInfo != null) |
| | | { |
| | |
| | | using MailKit.Search; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using SqlSugar; |
| | | using System; |
| | |
| | | using WIDESEA_Model.Models.Check; |
| | | using WIDESEA_Model.Models.Outbound; |
| | | |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | |
| | | /// </summary> |
| | | /// <param name="inTask"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> PalletOutboundTask(int num, int locationType) |
| | | // æ¹æ³å¢å äº string? SupplierCode å¯éåæ° |
| | | public async Task<WebResponseContent> PalletOutboundTask(int num, int locationType, string? supplierCode = null) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dictionary<string, SqlSugar.OrderByType> orderByDict = new Dictionary<string, SqlSugar.OrderByType>() |
| | | { |
| | | { nameof(Dt_LocationInfo.Layer), SqlSugar.OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Row), SqlSugar.OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Column), SqlSugar.OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Depth), SqlSugar.OrderByType.Desc }, |
| | | }; |
| | | { |
| | | { nameof(Dt_LocationInfo.Layer), SqlSugar.OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Row), SqlSugar.OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Column), SqlSugar.OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Depth), SqlSugar.OrderByType.Desc }, |
| | | }; |
| | | |
| | | var query = _stockRepository.Db.Queryable<Dt_StockInfo>() |
| | | .Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() |
| | |
| | | .WhereIF(locationType != 0, x => x.LocationType == locationType) |
| | | .LeftJoin<Dt_LocationInfo>((s, l) => s.LocationCode == l.LocationCode); |
| | | |
| | | if (query.Count() == 0) |
| | | if (!await query.AnyAsync()) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ç©ºæçåºå"); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | query = query.OrderBy(sortSql); |
| | | query.OrderBy(sortSql); |
| | | } |
| | | } |
| | | |
| | | var stockInfos = await query.Take(num).ToListAsync(); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | Dt_PlasticContainerLedger? todayLedger = null; |
| | | var today = DateTime.Now.Date; |
| | | var tomorrow = today.AddDays(1); |
| | | |
| | | if (!string.IsNullOrWhiteSpace(supplierCode)) |
| | | { |
| | | todayLedger = await _stockRepository.Db.Queryable<Dt_PlasticContainerLedger>() |
| | | .Where(x => x.SupplyCode == supplierCode) |
| | | .Where(x => x.CreateDate >= today && x.CreateDate < tomorrow) |
| | | .FirstAsync(); |
| | | } |
| | | |
| | | string allTaskNums = string.Empty; |
| | | |
| | | foreach (var stockInfo in stockInfos) |
| | | { |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | Dt_LocationInfo locationInfo = await _locationInfoService.Repository.QueryFirstAsync(x => x.LocationCode == stockInfo.LocationCode); |
| | | if (locationInfo == null) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ç©ºæçåºå对åºçè´§ä½ä¿¡æ¯"); |
| | | } |
| | | |
| | |
| | | TaskType = TaskTypeEnum.OutEmpty.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | |
| | | }; |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | |
| | | int taskId = BaseDal.AddData(task); |
| | | int taskId = await BaseDal.AddDataAsync(task); |
| | | task.TaskId = taskId; |
| | | allTaskNums += task.TaskNum + ","; |
| | | |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | _stockService.StockInfoService.UpdateData(stockInfo); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord( |
| | | locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum); |
| | | } |
| | | |
| | | if (!string.IsNullOrWhiteSpace(supplierCode)) |
| | | { |
| | | var ledgerList = new List<Dt_PlasticContainerLedger>(); |
| | | |
| | | foreach (var stock in stockInfos) |
| | | { |
| | | ledgerList.Add(new Dt_PlasticContainerLedger |
| | | { |
| | | SupplyCode = supplierCode, |
| | | PalletCode = stock.PalletCode, |
| | | CreateDate = DateTime.Now, |
| | | Creater = App.User?.ToString() |
| | | }); |
| | | } |
| | | _plasticContainerLedger.AddData(ledgerList); |
| | | } |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK("空æåºåºæå!"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 宿¶æç´¢ä¾åºåç¼ç ï¼æ¯æè¾å
¥ r èªå¨å¹é
ï¼ä¸ææ¡ç¨ï¼ |
| | | /// </summary> |
| | | /// <param name="keyword">è¾å
¥çå
³é®è¯ï¼å¦ rï¼</param> |
| | | /// <returns>å¹é
çä¾åºåç¼ç å表</returns> |
| | | public async Task<WebResponseContent> SearchSupplierCode(string keyword) |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrWhiteSpace(keyword)) |
| | | return WebResponseContent.Instance.OK("没æå¹é
å°è¯¥ä¾åºåç¼å·"); |
| | | |
| | | var list = await _stockRepository.Db.Queryable<Dt_SupplierInfo>() |
| | | .Where(x => x.SupplierShortName.StartsWith(keyword)) |
| | | .OrderBy(x => x.SupplierShortName) |
| | | .Take(20) |
| | | .Select(x => x.SupplierShortName) |
| | | .ToListAsync(); |
| | | |
| | | return WebResponseContent.Instance.OK(data:list); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡æ°æ®å¤ç |
| | |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> TakeOutbound(List<StockViewDTO> stockViews, string outStation) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | var content = new WebResponseContent(); |
| | | var errorMessages = new List<string>(); |
| | | |
| | | try |
| | | { |
| | | var allFactoryAreas = stockViews.SelectMany(sv => sv.Details) |
| | | .Select(x => x.FactoryArea) |
| | | .GroupBy(x => x) |
| | | .ToList(); |
| | | if (allFactoryAreas.Count >= 2) |
| | | if (stockViews == null || !stockViews.Any()) |
| | | { |
| | | return content.Error($"è¯·éæ©åä¸ååºåºåçåºåè¿è¡çç¹ï¼å½åæ¶å{allFactoryAreas.Count}个ä¸åçååº"); |
| | | content.Error("æªè·åå°åºåæ°æ®"); |
| | | content.Data = new { total = 0, success = 0, fail = 0, failMsg = errorMessages }; |
| | | return content; |
| | | } |
| | | List<int> ids = stockViews.Select(x => x.StockId).ToList(); |
| | | //è·ååºå |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => ids.Contains(x.Id)).Includes(x => x.Details).ToList(); |
| | | if (stockInfos.Count != stockViews.Count) |
| | | |
| | | var ids = stockViews.Select(x => x.StockId).ToList(); |
| | | var stockInfos = _stockRepository.Db.Queryable<Dt_StockInfo>() |
| | | .Where(x => ids.Contains(x.Id)) |
| | | .Includes(x => x.Details) |
| | | .ToList(); |
| | | |
| | | var locCodes = stockInfos.Select(x => x.LocationCode).ToList(); |
| | | var locationInfos = _locationInfoService.Db.Queryable<Dt_LocationInfo>() |
| | | .Where(x => locCodes.Contains(x.LocationCode)) |
| | | .ToList(); |
| | | |
| | | var finalSuccessStocks = new List<Dt_StockInfo>(); |
| | | var finalSuccessLocations = new List<Dt_LocationInfo>(); |
| | | |
| | | foreach (var stock in stockInfos) |
| | | { |
| | | StockViewDTO? stockViewDTO = stockViews.FirstOrDefault(x => !stockInfos.Select(x => x.PalletCode).ToList().Contains(x.PalletCode)); |
| | | return content.Error($"æªæ¾å°{stockViewDTO?.PalletCode}åºå"); |
| | | } |
| | | //è·åè´§ä½ |
| | | List<string> locStrs = stockInfos.Select(x => x.LocationCode).ToList(); |
| | | List<Dt_LocationInfo> locationInfos =_locationInfoService.Db.Queryable<Dt_LocationInfo>().Where(x => locStrs.Contains(x.LocationCode)).ToList(); |
| | | if (stockInfos.Count != locationInfos.Count) |
| | | { |
| | | string? locStr = locStrs.FirstOrDefault(x => !locationInfos.Select(x => x.LocationCode).ToList().Contains(x)); |
| | | return content.Error($"æªæ¾å°{locStr}è´§ä½æ°æ®"); |
| | | } |
| | | Dt_TakeStockOrder takeStockOrder = new Dt_TakeStockOrder() |
| | | { |
| | | WarehouseId = stockInfos.FirstOrDefault().WarehouseId, |
| | | TakeStockStatus = TakeStockStatusEnum.çç¹ä¸.ObjToInt(), |
| | | OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.PDCodeRule)), |
| | | AllPalletCode = string.Join(",", stockInfos.Select(item => item.PalletCode).Where(palletCode => !string.IsNullOrEmpty(palletCode))), |
| | | Remark = outStation |
| | | |
| | | }; |
| | | foreach (var item in stockInfos) |
| | | { |
| | | if (item.Details.Count <= 0) |
| | | try |
| | | { |
| | | return content.Error($"æªæ¾å°{item.PalletCode}åºåæç»æ°æ®"); |
| | | if (stock.Details == null || !stock.Details.Any()) |
| | | { |
| | | errorMessages.Add($"æçã{stock.PalletCode}ãï¼æ åºåæç»"); |
| | | continue; |
| | | } |
| | | |
| | | var loc = locationInfos.FirstOrDefault(x => x.LocationCode == stock.LocationCode); |
| | | if (loc == null) |
| | | { |
| | | errorMessages.Add($"æçã{stock.PalletCode}ãï¼åºä½ä¸åå¨"); |
| | | continue; |
| | | } |
| | | |
| | | if (loc.EnableStatus != EnableStatusEnum.Normal.ObjToInt() || |
| | | loc.LocationStatus != LocationStatusEnum.InStock.ObjToInt() || |
| | | stock.StockStatus != StockStatusEmun.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | errorMessages.Add($"æçã{stock.PalletCode}ãï¼ç¶æä¸å
许åºåº"); |
| | | continue; |
| | | } |
| | | |
| | | finalSuccessStocks.Add(stock); |
| | | finalSuccessLocations.Add(loc); |
| | | } |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode); |
| | | if (locationInfo == null || (locationInfo.EnableStatus == EnableStatusEnum.Disable.ObjToInt() || locationInfo.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) || locationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt() || item.StockStatus != StockStatusEmun.å
¥åºå®æ.ObjToInt()) |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error($"{item.PalletCode}è´§ä½æåºåç¶æä¸æ»¡è¶³åºåºæ¡ä»¶"); |
| | | } |
| | | errorMessages.Add($"æçã{stock.PalletCode}ãå¼å¸¸ï¼{ex.Message}"); |
| | | continue; |
| | | } |
| | | } |
| | | List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutInventory,outStation); |
| | | if (tasks == null || tasks.Count <= 0) |
| | | |
| | | if (finalSuccessStocks.Any()) |
| | | { |
| | | return content.Error($"çæä»»å¡å¤±è´¥"); |
| | | var takeStockOrder = new Dt_TakeStockOrder |
| | | { |
| | | WarehouseId = finalSuccessStocks.First().WarehouseId, |
| | | TakeStockStatus = TakeStockStatusEnum.çç¹ä¸.ObjToInt(), |
| | | OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.PDCodeRule)), |
| | | AllPalletCode = string.Join(",", finalSuccessStocks.Select(x => x.PalletCode)), |
| | | Remark = outStation |
| | | }; |
| | | |
| | | var tasks = GetTasks(finalSuccessStocks, TaskTypeEnum.OutInventory, outStation); |
| | | if (tasks == null || tasks.Count <= 0) |
| | | { |
| | | errorMessages.Add("ä»»å¡çæå¤±è´¥"); |
| | | } |
| | | else |
| | | { |
| | | finalSuccessStocks.ForEach(x => x.StockStatus = StockStatusEmun.çç¹åºåºéå®.ObjToInt()); |
| | | finalSuccessLocations.ForEach(x => x.LocationStatus = LocationStatusEnum.Lock.ObjToInt()); |
| | | tasks.ForEach(x => x.OrderNo = takeStockOrder.OrderNo); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockRepository.UpdateData(finalSuccessStocks); |
| | | _takeStockOrder.AddData(takeStockOrder); |
| | | BaseDal.AddData(tasks); |
| | | _locationInfoService.UpdateData(finalSuccessLocations); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | } |
| | | stockInfos.ForEach(x => |
| | | { |
| | | x.StockStatus = StockStatusEmun.çç¹åºåºéå®.ObjToInt(); |
| | | }); |
| | | tasks.ForEach(x => |
| | | { |
| | | x.OrderNo = takeStockOrder.OrderNo; |
| | | }); |
| | | locationInfos.ForEach(x => |
| | | { |
| | | x.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | }); |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.UpdateData(stockInfos); |
| | | _takeStockOrder.AddData(takeStockOrder); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(tasks); |
| | | _locationInfoService.UpdateData(locationInfos); |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK(); |
| | | //TaskModel esstask = new TaskModel() |
| | | //{ |
| | | // taskType = "carry", |
| | | // taskGroupCode = "", |
| | | // groupPriority = 0, |
| | | // tasks = new List<TasksType>() |
| | | //}; |
| | | |
| | | //foreach (var task in tasks) |
| | | //{ |
| | | // esstask. |
| | | // tasks.Add(new TasksType |
| | | // { |
| | | // taskCode = task.TaskNum.ToString(), |
| | | // taskPriority = 0, |
| | | // taskDescribe = new TaskDescribeType |
| | | // { |
| | | // containerCode = task.PalletCode, |
| | | // containerType = "CT_KUBOT_STANDARD", |
| | | // fromLocationCode = task.SourceAddress ?? "", |
| | | // toStationCode = "", |
| | | // toLocationCode = task.TargetAddress, |
| | | // deadline = 0, |
| | | // storageTag = "" |
| | | // } |
| | | // } |
| | | // ); |
| | | //} |
| | | //var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | //_logger.LogInformation("å建任å¡PalletOutboundTask è¿å: " + result); |
| | | //if (result) |
| | | //{ |
| | | // return WebResponseContent.Instance.OK(); |
| | | //} |
| | | //else |
| | | //{ |
| | | // return WebResponseContent.Instance.Error("ä¸åæºå¨äººä»»å¡å¤±è´¥ï¼"); |
| | | //} |
| | | //content.OK(); |
| | | content.OK($"å¤çå®æï¼æåã{finalSuccessStocks.Count}ãæ¡ï¼å¤±è´¥ã{errorMessages.Count}ãæ¡"); |
| | | content.Data = new |
| | | { |
| | | total = stockInfos.Count, |
| | | success = finalSuccessStocks.Count, |
| | | fail = errorMessages.Count, |
| | | failMsg = errorMessages |
| | | }; |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return await Task.FromResult(WebResponseContent.Instance.Error(ex.Message)); |
| | | content.Error($"ç³»ç»å¼å¸¸ï¼{ex.Message}"); |
| | | content.Data = new |
| | | { |
| | | total = stockViews?.Count ?? 0, |
| | | success = 0, |
| | | fail = 1, |
| | | failMsg = new List<string> { ex.Message } |
| | | }; |
| | | return content; |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> BatchOutboundByExcel(IFormFile file, string outStation) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | List<StockViewDTO> successStockViews = new List<StockViewDTO>(); |
| | | List<string> noStockMaterialCodes = new List<string>(); |
| | | |
| | | try |
| | | { |
| | | if (file == null || file.Length == 0) |
| | | return content.Error("ä¸ä¼ 失败ï¼è¯·éæ©éè¦å¯¼å
¥çExcelæä»¶"); |
| | | |
| | | var ext = Path.GetExtension(file.FileName).ToLower(); |
| | | if (ext != ".xls" && ext != ".xlsx") |
| | | return content.Error("ä¸ä¼ 失败ï¼ä»
æ¯æ .xls å .xlsx æ ¼å¼çExcelæä»¶ï¼è¯·éæ°ä¸ä¼ "); |
| | | |
| | | try |
| | | { |
| | | using var stream = file.OpenReadStream(); |
| | | var excelList = ReadExcel(stream); |
| | | |
| | | if (!excelList.Any()) |
| | | return content.Error("导å
¥å¤±è´¥ï¼Excelæä»¶ä¸æªè¯»åå°ä»»ä½æææ°æ®"); |
| | | |
| | | foreach (var item in excelList) |
| | | { |
| | | var matchedStocks = _stockRepository.Db.Queryable<Dt_StockInfo>() |
| | | .Includes(x => x.Details) |
| | | .Where(x => |
| | | x.Details.Any(d => |
| | | d.WarehouseCode == item.WarehouseCode |
| | | && d.MaterielCode == item.MaterialCode |
| | | ) |
| | | ) |
| | | .ToList(); |
| | | |
| | | if (matchedStocks.Any()) |
| | | { |
| | | successStockViews.AddRange(matchedStocks.Select(s => new StockViewDTO |
| | | { |
| | | StockId = s.Id |
| | | })); |
| | | } |
| | | else |
| | | { |
| | | noStockMaterialCodes.Add(item.MaterialCode); |
| | | } |
| | | } |
| | | |
| | | // æ§è¡åºåº |
| | | if (successStockViews.Any()) |
| | | { |
| | | var result = await TakeOutbound(successStockViews, outStation); |
| | | return result; |
| | | } |
| | | |
| | | // æ ä»»ä½å¯åºåºæ°æ® |
| | | var msg = "æªæ¥è¯¢å°ä»»ä½å¯åºåºåºå"; |
| | | if (noStockMaterialCodes.Any()) |
| | | { |
| | | msg += $"ï¼æ åºåæå·ï¼{string.Join("ã", noStockMaterialCodes)}"; |
| | | } |
| | | return content.Error(msg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error($"Excelè§£æå¤±è´¥ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content.Error($"æ¹éåºåºå¤±è´¥ï¼ç³»ç»å¼å¸¸ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// åæ®çææ¹æ³ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static List<ExcelInventoryOutboundDto> ReadExcel(Stream stream) |
| | | { |
| | | var list = new List<ExcelInventoryOutboundDto>(); |
| | | |
| | | using (var package = new ExcelPackage(stream)) |
| | | { |
| | | var sheet = package.Workbook.Worksheets.FirstOrDefault(); |
| | | if (sheet == null) return list; |
| | | |
| | | // æ£ç¡®è·åè¡æ° |
| | | int rowCount = sheet.Dimension?.End.Row ?? 0; |
| | | |
| | | // 第2è¡å¼å§è¯» |
| | | for (int row = 2; row <= rowCount; row++) |
| | | { |
| | | string location = sheet.Cells[row, 8].Value?.ToString()?.Trim() ?? ""; |
| | | string materialCode = sheet.Cells[row, 2].Value?.ToString()?.Trim() ?? ""; |
| | | |
| | | if (string.IsNullOrEmpty(location) || string.IsNullOrEmpty(materialCode)) |
| | | continue; |
| | | |
| | | list.Add(new ExcelInventoryOutboundDto |
| | | { |
| | | WarehouseCode = location, |
| | | MaterialCode = materialCode |
| | | }); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_StockService; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Stock |
| | | { |
| | | [ApiController] |
| | | [Route("api/[controller]")] |
| | | [Authorize] |
| | | public class PlasticContainerLedgerController : ApiBaseController<IPlasticContainerLedgerService,Dt_PlasticContainerLedger> |
| | | { |
| | | private readonly IPlasticContainerLedgerService _service; |
| | | |
| | | public PlasticContainerLedgerController(IPlasticContainerLedgerService service) : base(service) |
| | | { |
| | | _service = service; |
| | | } |
| | | |
| | | [HttpPost, Route("GlueLineLedgerSummary"), AllowAnonymous] |
| | | public WebResponseContent GlueLineLedgerSummary(string supplyCode) |
| | | { |
| | | return _service.GlueLineLedgerSummary(supplyCode); |
| | | } |
| | | } |
| | | } |
| | |
| | | using MailKit.Search; |
| | | using Magicodes.ExporterAndImporter.Excel.Utility; |
| | | using MailKit.Search; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | |
| | | } |
| | | |
| | | [HttpPost, Route("PalletOutboundTask"), AllowAnonymous, MethodParamsValidate] |
| | | public async Task<WebResponseContent> PalletOutboundTask(int num, int locationType) |
| | | public async Task<WebResponseContent> PalletOutboundTask(int num, int locationType, string? supplierCode = null) |
| | | { |
| | | return await Service.PalletOutboundTask(num, locationType); |
| | | return await Service.PalletOutboundTask(num, locationType, supplierCode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºå宿¶æç´¢ |
| | | /// </summary> |
| | | /// <param name="keyword"></param> |
| | | /// <returns></returns> |
| | | [HttpGet("SearchSupplierCode")] |
| | | public async Task<WebResponseContent> SearchSupplierCode(string keyword) |
| | | { |
| | | return await Service.SearchSupplierCode(keyword); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çæåºåºä»»å¡ |
| | |
| | | { |
| | | return await Service.CrossAreaOutbound(stockViews,targetLocationType); |
| | | } |
| | | |
| | | [HttpPost("BatchOutboundByExcel")] |
| | | public async Task<WebResponseContent> BatchOutboundByExcel(IFormFile file, string outStation) |
| | | { |
| | | return await Service.BatchOutboundByExcel(file, outStation); |
| | | } |
| | | } |
| | | } |