20240528修改:
bug41、42、43修改
领用单(分发单),调拨单,流程优化
| | |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // 忮坼å
¥ |
| | | export function transferImport(data) { |
| | | return request({ |
| | | url: '/pc/l/wh/form/transfer/import', |
| | | method: 'post', |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å表 |
| | | export function transferList(params) { |
| | | return request({ |
| | |
| | | operatorName: [{required: true, message: '请填åé¢å人', trigger: 'blur'}], |
| | | tel: [{required: true, message: '请填åèç³»çµè¯', trigger: 'blur'}], |
| | | createTime: [{required: true, message: 'è¯·éæ©ååæ¶é´', trigger: 'change'}], |
| | | // å¢å äºååçä¸é´æµç¨ï¼è¥åæåºå·æ¤æµç¨ï¼ä¸è½½åååï¼ä¸ä¼ åååï¼å注æprocureDoc |
| | | procureDoc: [{required: true, message: '请ä¸ä¼ å®¡æ¹æç»', trigger: 'change'}], |
| | | baseCategoryIds: [{required: true, message: 'è¯·éæ©', trigger: 'change'}], |
| | | baseGoodsTemplateId: [{required: true, message: 'è¯·éæ©', trigger: 'change'},{validator: checkGoodsTemplateId, trigger: ['blur', 'change']}], |
| | |
| | | .catch((err) => { |
| | | this.loading = false |
| | | console.log('create err', err); |
| | | this.$message.error('ä¿å失败'); |
| | | //this.$message.error('ä¿å失败'); |
| | | }); |
| | | } else { |
| | | this.$message.error('æ ¡éªæªéè¿ï¼è¯·æ£æ¥ã'); |
| | |
| | | <div class="card-header-left"> |
| | | <span>åååå·ï¼</span> |
| | | <span class="value">{{ item.businessFormCode }}</span> |
| | | |
| | | <span style="padding-left: 30px">ååç¶æï¼</span> |
| | | <span style="color: red" v-if="item.states === 0" class="value">æªåå</span> |
| | | <span v-if="item.states === 2" class="value">å·²åå</span> |
| | | </div> |
| | | <div class="card-header-right"> |
| | | <!-- 导åºåå --> |
| | | <el-button v-if="item.states === 0" name="ä¸è½½" site="form" type="primary" size="mini" @click="handleDetail(item)"> |
| | | ä¸è½½ |
| | | </el-button> |
| | | |
| | | <el-button v-if="item.states === 0" name="ä¸ä¼ " site="form" type="primary" size="mini" @click="handleUploadPage(item)"> |
| | | ä¸ä¼ |
| | | </el-button> |
| | | |
| | | <el-button name="æ¥ç详æ
" site="form" type="primary" size="mini" @click="handleDetail(item)"> |
| | | æ¥ç详æ
|
| | | </el-button> |
| | |
| | | <div class="box"><span class="span-two">é¨é¨ï¼</span>{{ item.inWarehouseName }}</div> |
| | | <div class="box"><span class="span-two">åå人ï¼</span>{{ item.outOperatorName }}</div> |
| | | <div class="box"> |
| | | <span class="span-two">ååæ¶é´ï¼</span>{{ item.createTime | formatTime }} |
| | | <span class="span-two">ååæ¶é´ï¼</span>{{ item.inTime | formatTime }} |
| | | </div> |
| | | </div> |
| | | <div class="card-end"> |
| | |
| | | </el-row> |
| | | </el-card> |
| | | </el-container> |
| | | |
| | | <!-- ä¸ä¼ åååæä»¶--> |
| | | <uploadPage |
| | | v-if="uploadPageSetting.show" |
| | | :setting="uploadPageSetting" |
| | | ref="uploadRef" |
| | | @close="uploadPageSetting.show = false" |
| | | @search="refreshData" |
| | | ></uploadPage> |
| | | |
| | | <!--æ·»å /ç¼è¾å¼¹çª--> |
| | | <edit |
| | | v-if="editSetting.show" |
| | |
| | | import myImport from '@/views/components/myImport'; |
| | | import edit from './edit'; |
| | | import detail from './detail'; |
| | | import uploadPage from './uploadPage'; |
| | | import listPage from '@/views/mixins/listPage'; |
| | | import {getUserDetail} from "@/utils/auth"; |
| | | |
| | | export default { |
| | | name: 'index', |
| | | mixins: [listPage], |
| | | components: {MyButton, myImport, edit, detail}, |
| | | components: {MyButton, myImport, edit, detail,uploadPage}, |
| | | data() { |
| | | return { |
| | | loading: false, |
New file |
| | |
| | | <template> |
| | | <win-md class="stock-detail" title="导å
¥åååæä»¶" @close="close" :width="'800px'" :loading="loading"> |
| | | |
| | | <upload ref="uploadRef" :values="fileList" :settings="uploadSettings" @on-change="uploadChange"></upload> |
| | | |
| | | |
| | | <el-button name="ç¡®å®åå" style="float: right;margin-right: 50px;margin-top: 20px" site="form" type="primary" size="mini" @click="distribute()"> |
| | | ç¡®å®åå |
| | | </el-button> |
| | | |
| | | </win-md> |
| | | </template> |
| | | <script> |
| | | import winMd from '@/components/win/win-md'; |
| | | import * as DateFormatter from '@/utils/DateFormatter'; |
| | | import {getDownUrl, getUploadUrl} from '@/utils/base'; |
| | | import Viewer from 'viewerjs'; |
| | | import 'viewerjs/dist/viewer.css'; |
| | | import de from "element-ui/src/locale/lang/de"; |
| | | import upload from '@/components/upload/index'; |
| | | let viewer = null; |
| | | |
| | | |
| | | import {transferAdd, transferImport} from '@/api/stock/transfer'; |
| | | |
| | | export default { |
| | | computed: { |
| | | de() { |
| | | return de |
| | | } |
| | | }, |
| | | components: {winMd,upload}, |
| | | props: { |
| | | setting: { |
| | | type: Object, |
| | | default: () => { |
| | | }, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | procureDoc:"", |
| | | |
| | | uploadSettings: { |
| | | title: 'ä¸ä¼ ', |
| | | max: 20, // æå¤§å¤§å°ï¼åä½M |
| | | num: 10, // æ¯æä¸ä¼ å¾çä¸ªæ° |
| | | tip: '', // æç¤º é»è®¤ï¼`åªè½ä¸ä¼ ${this.defaultSettings.num}个${this.defaultSettings.accept}æä»¶ï¼ä¸ä¸è¶
è¿${this.defaultSettings.max}kb` |
| | | uploadUrl: getUploadUrl(), // ä¸ä¼ è·¯å¾ |
| | | multiple: true, // æ¯å¦æ¯ææ¹éä¸ä¼ |
| | | disabled: false, // æ¯å¦ç¦ç¨ |
| | | }, |
| | | |
| | | |
| | | loading: true, |
| | | fileList: [], |
| | | detail: { |
| | | baseCategoryName: '', |
| | | businessFormCode: '', |
| | | goodsTemplateName: '', |
| | | procureDoc: '', |
| | | agencyId: '', |
| | | agencyName: '', |
| | | states: '', |
| | | createName: '', |
| | | time: '', |
| | | procureGoods: [{}, {}], |
| | | fileKey: Math.random(), |
| | | }, |
| | | }; |
| | | }, |
| | | filters: { |
| | | formatTime(time) { |
| | | if (!time) return '-'; |
| | | return DateFormatter.LongToDateTime(time); |
| | | }, |
| | | formatPrice(price) { |
| | | return price / 100 |
| | | } |
| | | }, |
| | | created() { |
| | | this.loading = false |
| | | this.fileList = [] |
| | | }, |
| | | methods: { |
| | | initPreviewImg() { |
| | | if (viewer != null) { |
| | | viewer.destroy(); |
| | | } |
| | | const ViewerDom = document.querySelector('#uploadPreviewImages'); |
| | | viewer = new Viewer(ViewerDom, {}); |
| | | }, |
| | | handlePreview(file) { |
| | | if (!this.checkImg(file.name)) { |
| | | return false; |
| | | } |
| | | let index = 0; |
| | | for (let i = 0; i < this.fileList.length; i++) { |
| | | const f = this.fileList[i]; |
| | | if (this.checkImg(f.name)) { |
| | | if (file.id == f.id) { |
| | | break; |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | // this.fileList.forEach((f, i) => { |
| | | // if (file.uid == f.uid) { |
| | | // index = i |
| | | // } |
| | | // }) |
| | | // document.querySelector('#uploadPreviewImages').children[0].click() |
| | | viewer.view(index); |
| | | }, |
| | | checkImg(name) { |
| | | const suffix = name.substring(name.lastIndexOf('.'), name.length); |
| | | const imgArray = ['.jpg', '.jpeg', '.png', '.bmp']; |
| | | if (imgArray.indexOf(suffix) < 0) { |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | getUrl(path) { |
| | | if (path.substr(0, 7).toLowerCase() == 'http://' || path.substr(0, 8).toLowerCase() == 'https://') { |
| | | return path; |
| | | } else { |
| | | return getDownUrl() + path; |
| | | } |
| | | }, |
| | | close() { |
| | | this.$emit('close'); |
| | | }, |
| | | |
| | | // ä¸ä¼ |
| | | uploadChange() { |
| | | let arr = this.$refs.uploadRef.fileList; |
| | | let procureDoc = JSON.stringify(arr); |
| | | console.log(procureDoc) |
| | | this.procureDoc = procureDoc; |
| | | |
| | | let pro = this.setting.id |
| | | console.log(pro) |
| | | }, |
| | | /** |
| | | * ç¡®å®åå |
| | | */ |
| | | distribute(){ |
| | | let id = this.setting.id |
| | | let procureDoc = this.procureDoc |
| | | if(id == null || procureDoc === ''){ |
| | | this.$message.error('请ä¸ä¼ å¾çï¼'); |
| | | return |
| | | } |
| | | let opTime = DateFormatter.formatDate(new Date(), 'yyyyMMddhhmmss'); |
| | | |
| | | transferImport({"idStr":id,"procureDoc":procureDoc,"opTime":opTime,"type":"1"}) |
| | | .then((res) => { |
| | | this.loading = false |
| | | this.$message.success('ä¿åæåï¼'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }) |
| | | .catch((err) => { |
| | | this.loading = false |
| | | console.log('edit err', err); |
| | | this.$message.error('ä¿å失败'); |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | @import url(../../../../styles/store.scss); |
| | | |
| | | .card3 { |
| | | padding: 10px; |
| | | margin-top: 10px; |
| | | border-radius: 2px; |
| | | background: #ffffff; |
| | | } |
| | | </style> |
| | |
| | | orgId: '', |
| | | show: false, |
| | | }, |
| | | uploadPageSetting: { |
| | | title: 'ä¸ä¼ 页é¢', |
| | | id: '', |
| | | orgId: '', |
| | | show: false, |
| | | }, |
| | | detailSetting: { |
| | | title: '详æ
', |
| | | id: '', |
| | |
| | | this.detailSetting.title = '详æ
'; |
| | | this.detailSetting.show = true; |
| | | }, |
| | | // 导å
¥ |
| | | handleUploadPage(row) { |
| | | this.uploadPageSetting.id = row.id; |
| | | this.uploadPageSetting.title = '导å
¥'; |
| | | this.uploadPageSetting.show = true; |
| | | }, |
| | | // å页 |
| | | handleSizeChange(pageSize) { |
| | | this.pageSize = pageSize; |
| | |
| | | rules: { |
| | | outAgencyId: [{ required: true, message: 'è¯·éæ©', trigger: 'change' }], |
| | | createTime: [{ required: true, message: 'è¯·éæ©', trigger: 'change' }], |
| | | procureDoc: [{ required: true, message: '请ä¸ä¼ è°æ¨æç»', trigger: 'change' }], |
| | | // procureDoc: [{ required: true, message: '请ä¸ä¼ è°æ¨æç»', trigger: 'change' }], |
| | | baseCategoryIds: [{ required: true, message: 'è¯·éæ©', trigger: 'change' }], |
| | | baseGoodsTemplateId: [{ required: true, message: 'è¯·éæ©', trigger: 'change' },{ validator: checkGoodsTemplateId, trigger: ['blur', 'change'] }], |
| | | modelsIds: [{ required: true, message: 'è¯·éæ©', trigger: 'change' }], |
| | |
| | | <div class="card-header-left"> |
| | | <span>è°æ¨åå·ï¼</span> |
| | | <span class="value">{{ item.businessFormCode }}</span> |
| | | <div v-if="item.states == 0" class="states states-warning">å¾
åºåº</div> |
| | | <div v-if="item.states == 0 && item.procureDoc !=null" class="states states-warning">å¾
åºåº</div> |
| | | <div v-if="item.states == 0 && item.procureDoc ==null" class="states states-warning">å¾
æäº¤</div> |
| | | <div v-if="item.states == 1" class="states states-warning">å¾
æ¥æ¶</div> |
| | | <div v-if="item.states == 2" class="states states-success">å·²æ¥æ¶</div> |
| | | <div v-if="item.states == 4" class="states states-info">å·²æ¤é</div> |
| | |
| | | @click="handleIncome(item)" |
| | | >å
¥åº</el-button |
| | | > |
| | | |
| | | <el-button v-if="item.states == 0 && item.procureDoc ==null" site="form" type="primary" size="mini" |
| | | @click="handleExport('transferExport',`è°æ¨å-${item.businessFormCode}`, {id:item.id,type:0})" |
| | | >ä¸è½½ |
| | | </el-button |
| | | > |
| | | |
| | | <el-button |
| | | v-if="item.states == 0 && item.procureDoc ==null" |
| | | site="form" |
| | | type="primary" |
| | | size="mini" |
| | | @click="handleUploadPage(item)" |
| | | >ä¸ä¼ </el-button |
| | | > |
| | | |
| | | <el-button |
| | | v-if="item.states == 0" |
| | | site="form" |
| | |
| | | </el-row> |
| | | </el-card> |
| | | </el-container> |
| | | |
| | | <!-- ä¸ä¼ åååæä»¶--> |
| | | <uploadPage |
| | | v-if="uploadPageSetting.show" |
| | | :setting="uploadPageSetting" |
| | | ref="uploadRef" |
| | | @close="uploadPageSetting.show = false" |
| | | @search="refreshData" |
| | | ></uploadPage> |
| | | |
| | | <!--æ·»å /ç¼è¾å¼¹çª--> |
| | | <edit |
| | | v-if="editSetting.show" |
| | |
| | | import listPage from '@/views/mixins/listPage'; |
| | | import transfer from '@/views/mixins/transfer'; |
| | | import SettingIplatform from '@/utils/settingIplatform'; |
| | | import uploadPage from './uploadPage'; |
| | | import * as dataExport from "@/api/exportExcel"; |
| | | import {downLoad} from "@/utils/base"; |
| | | |
| | | export default { |
| | | name: 'index', |
| | | mixins: [listPage, transfer], |
| | | components: { MyButton, myImport, edit, detail }, |
| | | components: { MyButton, myImport, edit, detail,uploadPage }, |
| | | data() { |
| | | return { |
| | | loading: false, |
| | |
| | | }); |
| | | }); |
| | | }, |
| | | // 导å
¥ |
| | | handleUploadPage(row) { |
| | | this.uploadPageSetting.id = row.id; |
| | | this.uploadPageSetting.title = '导å
¥'; |
| | | this.uploadPageSetting.show = true; |
| | | }, |
| | | /** |
| | | * 导åºè°æ¨å
¥åºå |
| | | * @param api |
| | | * @param fileName |
| | | * @param params |
| | | */ |
| | | handleExport(api, fileName, params) { |
| | | let loading = this.$loading({ |
| | | lock: true, |
| | | text: '导åºä¸ï¼è¯·ç¨å...', |
| | | spinner: 'el-icon-loading', |
| | | background: 'rgba(0, 0, 0, 0.7)', |
| | | }); |
| | | // å¤ææ»æ¡æ°æ¯å¦å¤§äºæå¤§æ¯ææ¡æ° |
| | | dataExport[api](params) |
| | | .then((res) => { |
| | | console.log(res) |
| | | downLoad(res) |
| | | this.$message.success('å¯¼åºæåï¼'); |
| | | loading.close(); |
| | | }) |
| | | .catch(() => { |
| | | loading.close(); |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
New file |
| | |
| | | <template> |
| | | <win-md class="stock-detail" title="ä¸ä¼ è°æ¨æç»" @close="close" :width="'800px'" :loading="loading"> |
| | | |
| | | <upload ref="uploadRef" :values="fileList" :settings="uploadSettings" @on-change="uploadChange"></upload> |
| | | |
| | | |
| | | <el-button name="ä¸ä¼ è°æ¨æç»" style="float: right;margin-right: 50px;margin-top: 20px" site="form" type="primary" size="mini" @click="allocationProcedures()"> |
| | | ä¸ä¼ è°æ¨æç» |
| | | </el-button> |
| | | |
| | | </win-md> |
| | | </template> |
| | | <script> |
| | | import winMd from '@/components/win/win-md'; |
| | | import * as DateFormatter from '@/utils/DateFormatter'; |
| | | import {getDownUrl, getUploadUrl} from '@/utils/base'; |
| | | import Viewer from 'viewerjs'; |
| | | import 'viewerjs/dist/viewer.css'; |
| | | import de from "element-ui/src/locale/lang/de"; |
| | | import upload from '@/components/upload/index'; |
| | | let viewer = null; |
| | | |
| | | |
| | | import {transferAdd, transferImport} from '@/api/stock/transfer'; |
| | | |
| | | export default { |
| | | computed: { |
| | | de() { |
| | | return de |
| | | } |
| | | }, |
| | | components: {winMd,upload}, |
| | | props: { |
| | | setting: { |
| | | type: Object, |
| | | default: () => { |
| | | }, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | procureDoc:"", |
| | | |
| | | uploadSettings: { |
| | | title: 'ä¸ä¼ ', |
| | | max: 20, // æå¤§å¤§å°ï¼åä½M |
| | | num: 2, // æ¯æä¸ä¼ å¾çä¸ªæ° |
| | | tip: '', // æç¤º é»è®¤ï¼`åªè½ä¸ä¼ ${this.defaultSettings.num}个${this.defaultSettings.accept}æä»¶ï¼ä¸ä¸è¶
è¿${this.defaultSettings.max}kb` |
| | | uploadUrl: getUploadUrl(), // ä¸ä¼ è·¯å¾ |
| | | multiple: true, // æ¯å¦æ¯ææ¹éä¸ä¼ |
| | | disabled: false, // æ¯å¦ç¦ç¨ |
| | | }, |
| | | |
| | | |
| | | loading: true, |
| | | fileList: [], |
| | | detail: { |
| | | baseCategoryName: '', |
| | | businessFormCode: '', |
| | | goodsTemplateName: '', |
| | | procureDoc: '', |
| | | agencyId: '', |
| | | agencyName: '', |
| | | states: '', |
| | | createName: '', |
| | | time: '', |
| | | procureGoods: [{}, {}], |
| | | fileKey: Math.random(), |
| | | }, |
| | | }; |
| | | }, |
| | | filters: { |
| | | formatTime(time) { |
| | | if (!time) return '-'; |
| | | return DateFormatter.LongToDateTime(time); |
| | | }, |
| | | formatPrice(price) { |
| | | return price / 100 |
| | | } |
| | | }, |
| | | created() { |
| | | this.loading = false |
| | | this.fileList = [] |
| | | }, |
| | | methods: { |
| | | initPreviewImg() { |
| | | if (viewer != null) { |
| | | viewer.destroy(); |
| | | } |
| | | const ViewerDom = document.querySelector('#uploadPreviewImages'); |
| | | viewer = new Viewer(ViewerDom, {}); |
| | | }, |
| | | handlePreview(file) { |
| | | if (!this.checkImg(file.name)) { |
| | | return false; |
| | | } |
| | | let index = 0; |
| | | for (let i = 0; i < this.fileList.length; i++) { |
| | | const f = this.fileList[i]; |
| | | if (this.checkImg(f.name)) { |
| | | if (file.id == f.id) { |
| | | break; |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | // this.fileList.forEach((f, i) => { |
| | | // if (file.uid == f.uid) { |
| | | // index = i |
| | | // } |
| | | // }) |
| | | // document.querySelector('#uploadPreviewImages').children[0].click() |
| | | viewer.view(index); |
| | | }, |
| | | checkImg(name) { |
| | | const suffix = name.substring(name.lastIndexOf('.'), name.length); |
| | | const imgArray = ['.jpg', '.jpeg', '.png', '.bmp']; |
| | | if (imgArray.indexOf(suffix) < 0) { |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | getUrl(path) { |
| | | if (path.substr(0, 7).toLowerCase() == 'http://' || path.substr(0, 8).toLowerCase() == 'https://') { |
| | | return path; |
| | | } else { |
| | | return getDownUrl() + path; |
| | | } |
| | | }, |
| | | close() { |
| | | this.$emit('close'); |
| | | }, |
| | | |
| | | // ä¸ä¼ |
| | | uploadChange() { |
| | | let arr = this.$refs.uploadRef.fileList; |
| | | let procureDoc = JSON.stringify(arr); |
| | | console.log(procureDoc) |
| | | this.procureDoc = procureDoc; |
| | | |
| | | let pro = this.setting.id |
| | | console.log(pro) |
| | | }, |
| | | /** |
| | | * ç¡®å®åå |
| | | */ |
| | | allocationProcedures(){ |
| | | let id = this.setting.id |
| | | let procureDoc = this.procureDoc |
| | | if(id == null || procureDoc === ''){ |
| | | this.$message.error('请ä¸ä¼ å¾çï¼'); |
| | | return |
| | | } |
| | | //let opTime = DateFormatter.formatDate(new Date(), 'yyyyMMddhhmmss'); |
| | | |
| | | transferImport({"idStr":id,"procureDoc":procureDoc,"type":"0"}) |
| | | .then((res) => { |
| | | this.loading = false |
| | | this.$message.success('ä¿åæåï¼'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }) |
| | | .catch((err) => { |
| | | this.loading = false |
| | | console.log('edit err', err); |
| | | this.$message.error('ä¿å失败'); |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | }, |
| | | }; |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | @import url(../../../../styles/store.scss); |
| | | |
| | | .card3 { |
| | | padding: 10px; |
| | | margin-top: 10px; |
| | | border-radius: 2px; |
| | | background: #ffffff; |
| | | } |
| | | </style> |
| | |
| | | <div class="card-header-left"> |
| | | <span>è°æ¨åå·ï¼</span> |
| | | <span class="value">{{ item.businessFormCode }}</span> |
| | | <div v-if="item.states == 0" class="states states-warning">å¾
åºåº</div> |
| | | <div v-if="item.states == 0 && item.procureDoc !=null" class="states states-warning">å¾
åºåº</div> |
| | | <div v-if="item.states == 0 && item.procureDoc ==null" class="states states-warning">å¾
æäº¤</div> |
| | | <div v-if="item.states == 1" class="states states-warning">å¾
æ¥æ¶</div> |
| | | <div v-if="item.states == 2" class="states states-success">å·²æ¥æ¶</div> |
| | | <div v-if="item.states == 4" class="states states-info">å·²æ¤é</div> |
| | | </div> |
| | | <div class="card-header-right"> |
| | | <!-- <el-button v-if="item.states == 1" site="form" type="success" size="mini" |
| | | >导åºè°æ¨åºåºå</el-button |
| | | >--> |
| | | <el-button |
| | | v-if="item.states == 0" |
| | | v-if="item.states == 0 && item.procureDoc !=null" |
| | | site="form" |
| | | type="success" |
| | | size="mini" |
| | |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.consum.base.util.ExcelStyleUtil; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.type.StatesType; |
| | |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.web.ResponseValue; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | |
| | | @ApiOperation(value = "åæ®æ°å¢", notes = "åæ®æ°å¢") |
| | | @ApiImplicitParam(name = "param", value = "åæ®æ°å¢", required = true, dataType = "LWhFormTransferParam") |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ResponseValue add() throws Exception { |
| | | LWhFormTransferParam param = CommonUtil.getObjFromReqBody(LWhFormTransferParam.class); |
| | | LWhFormTransferParam param2 = new LWhFormTransferParam(); |
| | |
| | | if (CollectionUtils.isEmpty(transferGoods)) { |
| | | return ResponseValue.error("è°æ¨åä¸è½ä¸ºç©º"); |
| | | } |
| | | long id = this.lWhFormTransferService.add(param, this.getSysInfo()); |
| | | long id = this.lWhFormTransferService.add(param, this.getSysInfo(), StrUtil.isEmpty(param.getProcureDoc())); |
| | | if(id == -1L){ |
| | | return ResponseValue.error("æ¨ä¸æ¯åºç®¡å"); |
| | | } |
| | | if(id == -2L){ |
| | | return ResponseValue.error("ä»åºä¸åå¨"); |
| | | } |
| | | |
| | | Integer transferBusinessType = param.getTransferBusinessType(); |
| | | // é¨é¨ååä¸å¡éè¦å¤ç |
| | | if (transferBusinessType == 1) { |
| | | // todo æå æ°é»è¾ |
| | | if (transferBusinessType == 1 && !StrUtil.isEmpty(param.getProcureDoc())) { |
| | | // å
åºåºï¼åå
¥åº |
| | | // åºåºå 设置åºåºä»åº |
| | | List<LWhProcureModel> modelByForm = lWhProcureModelService.getModelByForm(WhBusinessEnum.BUMENFENFA, id); |
| | |
| | | lWhFormTransfer.setOutWarehouseId(wareHouseId); |
| | | lWhFormTransfer.setOutWarehouseName(warehouseName); |
| | | lWhFormTransferService.update(lWhFormTransfer); |
| | | lWhFormTransferCoreService.doTransferOutPutNew(id, getCurrentUser(), WhBusinessEnum.BUMENFENFA); |
| | | |
| | | Long l = lWhFormTransferCoreService.doTransferOutPutNew(id, getCurrentUser(), WhBusinessEnum.BUMENFENFA); |
| | | if(l == -1L){ |
| | | return ResponseValue.error("ä»åºæ°éä¸è¶³"); |
| | | } |
| | | lWhFormTransferCoreService.doTransferInPut(id, getCurrentUser(), param.getOperatorName()); |
| | | } |
| | | |
| | | return ResponseValue.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä¸ä¼ åååï¼æµç¨ä¿®æ¹ï¼ |
| | | * |
| | | * @param idStr è°æ¨åid json |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "è°æ¨åid", required = true, dataType = "Long"),}) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping("import") |
| | | public ResponseValue upload(@RequestBody String idStr) throws Exception { |
| | | Map<String, Object> map = JSONObject.parseObject(idStr, Map.class); |
| | | String type = map.get("type").toString(); |
| | | Long id = Convert.toLong(map.get("idStr")); |
| | | String procureDoc = map.get("procureDoc").toString(); |
| | | // [è°æ¨] |
| | | if ("0".equals(type)) { |
| | | // ä¿®æ¹ |
| | | LWhFormTransfer addLWhFormTransfer = new LWhFormTransfer(); |
| | | addLWhFormTransfer.setId(id); |
| | | addLWhFormTransfer.setProcureDoc(procureDoc); |
| | | int update = lWhFormTransferService.update(addLWhFormTransfer); |
| | | if (update < 1) { |
| | | return ResponseValue.error(); |
| | | } |
| | | return ResponseValue.success(); |
| | | } |
| | | |
| | | // [åå] |
| | | Long opTime = Convert.toLong(map.get("opTime")); |
| | | // ä¿®æ¹è¡¨çæä»¶é»è¾ |
| | | LWHFromTransferExtendVO lwhFromTransferExtendVO = lWhFormTransferService.getById(id); |
| | | // ä¿®æ¹ |
| | | LWhFormTransfer addLWhFormTransfer = new LWhFormTransfer(); |
| | | addLWhFormTransfer.setId(id); |
| | | addLWhFormTransfer.setProcureDoc(procureDoc); |
| | | addLWhFormTransfer.setInTime(opTime); |
| | | addLWhFormTransfer.setOutputTime(opTime); |
| | | int update = lWhFormTransferService.update(addLWhFormTransfer); |
| | | if (update < 1) { |
| | | return ResponseValue.error(); |
| | | } |
| | | // 主ååé»è¾ |
| | | // å
åºåºï¼åå
¥åº |
| | | // åºåºå 设置åºåºä»åº |
| | | List<LWhProcureModel> modelByForm = lWhProcureModelService.getModelByForm(WhBusinessEnum.BUMENFENFA, id); |
| | | Set<Long> baseModelIds = |
| | | modelByForm.stream().map(LWhProcureModel::getBaseGoodsModelsId).collect(Collectors.toSet()); |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String agencyId = sysTenantUser.getTenantId(); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), StatesType.NORMAL.getValue()); |
| | | Set<Long> wareHouseIds = baseWarehouseList.stream().map(BaseWarehouse::getId).collect(Collectors.toSet()); |
| | | // éè¿è°æ¨åä¸çåå·idæ¥è¯¢åºè¯¥åå·ç©åæå¨çä»åºä½ç½® |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds, wareHouseIds, null); |
| | | GoodsInfoDTO goodsInfoDTO = goodsInfoDTOS.stream().findFirst().orElse(null); |
| | | if (ObjectUtils.isEmpty(goodsInfoDTO)) { |
| | | return ResponseValue.error("该åå·æ²¡æåºåå¯ä½¿ç¨"); |
| | | } |
| | | Long wareHouseId = goodsInfoDTO.getWarehouseId(); |
| | | String warehouseName = goodsInfoDTO.getWarehouseName(); |
| | | LWhFormTransfer lWhFormTransfer = new LWhFormTransfer(id); |
| | | lWhFormTransfer.setOutWarehouseId(wareHouseId); |
| | | lWhFormTransfer.setOutWarehouseName(warehouseName); |
| | | lWhFormTransferService.update(lWhFormTransfer); |
| | | lWhFormTransferCoreService.doTransferOutPutNew(id, getCurrentUser(), WhBusinessEnum.BUMENFENFA); |
| | | lWhFormTransferCoreService.doTransferInPut(id, getCurrentUser(), lwhFromTransferExtendVO.getOperatorName()); |
| | | return ResponseValue.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description å表æ¥è¯¢(è°æ¨æç») |
| | |
| | | |
| | | TemplateExportParams params; |
| | | String fileName; |
| | | if (type == 1) { |
| | | if (type == 0) { |
| | | params = new TemplateExportParams("import/è°æ¨å
¥åºå.xls"); |
| | | fileName = "è°æ¨å
¥åºå"; |
| | | }else if (type == 1) { |
| | | params = new TemplateExportParams("import/è°æ¨å
¥åºå1.xls"); |
| | | fileName = "è°æ¨å
¥åºå"; |
| | | } else { |
| | | params = new TemplateExportParams("import/è°æ¨åºåºå.xls"); |
| | | fileName = "è°æ¨åºåºå"; |
| | | } |
| | | params.setHeadingStartRow(2); |
| | | params.setStyle(ExcelStyleUtil.class); |
| | | List<TransferExcelTemplate> export = this.lWhFormTransferService.export(id, type); |
| | | |
| | | int countNum = |
| | |
| | | |
| | | public interface LWhFormTransferService extends BaseService { |
| | | |
| | | long add(LWhFormTransferParam param, FinSysTenantUser sysInfo) throws Exception; |
| | | long add(LWhFormTransferParam param, FinSysTenantUser sysInfo,boolean isHaveDoc) throws Exception; |
| | | |
| | | GenericPager<LWhFormTransfer> queryFormTransferList(TransferQry param); |
| | | |
| | |
| | | log.error("åºåºå¤±è´¥ï¼åå·{} çæ°éä¸è¶³ï¼éè¦è°æ¨{}个ï¼ä»åºä¸ç°å{}个", baseGoodsModelsId, counts, goodsModelNum); |
| | | // æå¨åæ» |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | throw new RuntimeException("åºåºå¤±è´¥!åå·æ°éä¸è¶³"); |
| | | //throw new RuntimeException("åºåºå¤±è´¥!åå·æ°éä¸è¶³"); |
| | | return -1L; |
| | | } |
| | | whGoodsRecord.setInitialCount(goodsModelNum); |
| | | whGoodsRecord.setEndCount(goodsModelNum - counts); |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | * @Author å¢åºé³ |
| | | * @Date 2023/10/30 |
| | | */ |
| | | public long add(LWhFormTransferParam param, FinSysTenantUser sysInfo) throws Exception { |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public long add(LWhFormTransferParam param, FinSysTenantUser sysInfo,boolean isHaveDoc) throws Exception { |
| | | // 1.æ°å¢è°æ¨åè®°å½ |
| | | LWhFormTransfer lWhFormTransfer = new LWhFormTransfer(); |
| | | // è°æ¨åid |
| | |
| | | BaseWarehouse warehouse = baseWarehouseService.getWarehouseByAgencyId(Long.valueOf(tenantId), null); |
| | | if (warehouse == null) { |
| | | log.error("ä»åºä¸åå¨"); |
| | | throw new Exception("ä»åºä¸åå¨"); |
| | | //throw new Exception("ä»åºä¸åå¨"); |
| | | return -2L; |
| | | } |
| | | lWhFormTransfer.setInWarehouseId(warehouse.getId()); |
| | | lWhFormTransfer.setInWarehouseName(warehouse.getWarehouseName()); |
| | |
| | | List<BaseWarehouseManager> managerList = baseWarehouseManagerService.select(manager); |
| | | if (CollectionUtils.isEmpty(managerList)) { |
| | | log.error("è¯¥ç¨æ·ä¸æ¯åºç®¡å"); |
| | | throw new Exception("è¯¥ç¨æ·ä¸æ¯åºç®¡å"); |
| | | //throw new Exception("è¯¥ç¨æ·ä¸æ¯åºç®¡å"); |
| | | return -1L; |
| | | } |
| | | BaseWarehouseManager baseWarehouseManager = managerList.stream().findFirst().orElse(null); |
| | | Long baseWarehouseId = baseWarehouseManager.getBaseWarehouseId(); |
| | |
| | | lWhFormTransfer.setInWarehouseId(param.getDepartmentId()); |
| | | lWhFormTransfer.setInWarehouseName(param.getDepartmentName()); |
| | | lWhFormTransfer.setInOperatorName(param.getOperatorName()); |
| | | |
| | | if(!isHaveDoc){ |
| | | lWhFormTransfer.setInTime(param.getCreateTime()); |
| | | } |
| | | |
| | | |
| | | lWhFormTransfer.setOutWarehouseType(WareHouseType.TENANT.getValue()); |
| | | lWhFormTransfer.setOutWarehouseId(warehouse.getId()); |
| | |
| | | |
| | | lWhFormTransfer.setOutOperatorId(sysInfo.getId()); |
| | | lWhFormTransfer.setOutOperatorName(sysInfo.getUserName()); |
| | | |
| | | if(!isHaveDoc) { |
| | | lWhFormTransfer.setOutputTime(param.getCreateTime()); |
| | | } |
| | | lWhFormTransfer.setTel(param.getTel()); |
| | | |
| | | } |
New file |
| | |
| | | package com.consum.base.util; |
| | | |
| | | import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; |
| | | import cn.afterturn.easypoi.excel.entity.params.ExcelForEachParams; |
| | | import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | |
| | | /** |
| | | * åè½æè¿°: Excelæ ·å¼è®¾ç½® |
| | | * |
| | | * @author lxk |
| | | * @date 2024/5/8 13:41 |
| | | * @version 1.0 |
| | | **/ |
| | | public class ExcelStyleUtil implements IExcelExportStyler { |
| | | |
| | | private static final short STRING_FORMAT = (short) BuiltinFormats.getBuiltinFormat("TEXT"); |
| | | private static final short FONT_SIZE_TEN = 10; |
| | | private static final short FONT_SIZE_ELEVEN = 11; |
| | | private static final short FONT_SIZE_TWELVE = 12; |
| | | |
| | | // æ é¢å¤´æ ·å¼ |
| | | private CellStyle headerStyle; |
| | | // æ°æ®åæ 颿 ·å¼ |
| | | private CellStyle titleStyle; |
| | | // æ°æ®è¡æ ·å¼ |
| | | private CellStyle styles; |
| | | |
| | | public ExcelStyleUtil(Workbook workbook) { |
| | | this.init(workbook); |
| | | } |
| | | |
| | | /** |
| | | * åå§åæ ·å¼ |
| | | * |
| | | * @param workbook |
| | | */ |
| | | private void init(Workbook workbook) { |
| | | this.headerStyle = initHeaderStyle(workbook); |
| | | this.titleStyle = initTitleStyle(workbook); |
| | | this.styles = initStyles(workbook); |
| | | } |
| | | |
| | | /** |
| | | * æ é¢å¤´æ ·å¼ |
| | | * |
| | | * @param color |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CellStyle getHeaderStyle(short color) { |
| | | return headerStyle; |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®åæ 颿 ·å¼ |
| | | * |
| | | * @param color |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CellStyle getTitleStyle(short color) { |
| | | return titleStyle; |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®è¡æ ·å¼ |
| | | * |
| | | * @param parity 表示å¥å¶è¡ |
| | | * @param excelExportEntity æ°æ®å
容 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CellStyle getStyles(boolean parity, ExcelExportEntity excelExportEntity) { |
| | | return styles; |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®è¡æ ·å¼ |
| | | * |
| | | * @param cell åå
æ ¼ |
| | | * @param dataRow æ°æ®è¡ |
| | | * @param excelExportEntity æ°æ®å
容 |
| | | * @param obj 对象 |
| | | * @param data æ°æ® |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CellStyle getStyles(Cell cell, int dataRow, ExcelExportEntity excelExportEntity, Object obj, Object data) { |
| | | return getStyles(true, excelExportEntity); |
| | | } |
| | | |
| | | /** |
| | | * 模æ¿ä½¿ç¨çæ ·å¼è®¾ç½® |
| | | * |
| | | * @param b |
| | | * @param excelForEachParams |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CellStyle getTemplateStyles(boolean b, ExcelForEachParams excelForEachParams) { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * åå§å--æ é¢å¤´æ ·å¼ |
| | | * |
| | | * @param workbook |
| | | * @return |
| | | */ |
| | | private CellStyle initHeaderStyle(Workbook workbook) { |
| | | CellStyle style = getBaseCellStyle(workbook); |
| | | style.setFont(getFont(workbook, FONT_SIZE_TWELVE, true)); |
| | | return style; |
| | | } |
| | | |
| | | /** |
| | | * åå§å--æ°æ®åæ 颿 ·å¼ |
| | | * |
| | | * @param workbook |
| | | * @return |
| | | */ |
| | | private CellStyle initTitleStyle(Workbook workbook) { |
| | | CellStyle style = getBaseCellStyle(workbook); |
| | | style.setFont(getFont(workbook, FONT_SIZE_ELEVEN, false)); |
| | | // èæ¯è² |
| | | style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); |
| | | style.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
| | | return style; |
| | | } |
| | | |
| | | /** |
| | | * åå§å--æ°æ®è¡æ ·å¼ |
| | | * |
| | | * @param workbook |
| | | * @return |
| | | */ |
| | | private CellStyle initStyles(Workbook workbook) { |
| | | CellStyle style = getBaseCellStyle(workbook); |
| | | style.setFont(getFont(workbook, FONT_SIZE_TEN, false)); |
| | | style.setDataFormat(STRING_FORMAT); |
| | | return style; |
| | | } |
| | | |
| | | /** |
| | | * åºç¡æ ·å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | private CellStyle getBaseCellStyle(Workbook workbook) { |
| | | CellStyle style = workbook.createCellStyle(); |
| | | // ä¸è¾¹æ¡ |
| | | style.setBorderBottom(BorderStyle.THIN); |
| | | // å·¦è¾¹æ¡ |
| | | style.setBorderLeft(BorderStyle.THIN); |
| | | // ä¸è¾¹æ¡ |
| | | style.setBorderTop(BorderStyle.THIN); |
| | | // å³è¾¹æ¡ |
| | | style.setBorderRight(BorderStyle.THIN); |
| | | // æ°´å¹³å±
ä¸ |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | // ä¸ä¸å±
ä¸ |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | // 设置èªå¨æ¢è¡ |
| | | style.setWrapText(true); |
| | | |
| | | return style; |
| | | } |
| | | |
| | | /** |
| | | * å使 ·å¼ |
| | | * |
| | | * @param size åä½å¤§å° |
| | | * @param isBold æ¯å¦å ç² |
| | | * @return |
| | | */ |
| | | private Font getFont(Workbook workbook, short size, boolean isBold) { |
| | | Font font = workbook.createFont(); |
| | | // å使 ·å¼ |
| | | font.setFontName("å®ä½"); |
| | | // æ¯å¦å ç² |
| | | font.setBold(isBold); |
| | | // åä½å¤§å° |
| | | font.setFontHeightInPoints(size); |
| | | return font; |
| | | } |
| | | } |