Browse Source

入库明细表上传

master
lzh 2 years ago
parent
commit
34c7f8aeaf
  1. 4
      base-ui/src/api/kucun/kucun.js
  2. 9
      base-ui/src/api/kucun/ruku.js
  3. 62
      base-ui/src/views/kucun/rkmx/index.vue
  4. 10
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountMapper.java
  5. 2
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java
  6. 17
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageService.java

4
base-ui/src/api/kucun/kucun.js

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 条件查询
export function kchz(data) {
return request({
url: '/ruku/kchz',
url: '/kucun/kchz',
method: 'get',
data: data
})
@ -11,7 +11,7 @@ export function kchz(data) {
// 条件查询
export function downloadhz(parm) {
return request({
url: '/ruku/downloadhz',
url: '/kucun/downloadhz',
method: 'get',
responseType: 'blob',
params: parm

9
base-ui/src/api/kucun/ruku.js

@ -1,11 +1,10 @@
import request from '@/utils/request'
// 条件查询
export function kchz(data) {
// 重新汇总入库商品
export function recount() {
return request({
url: '/kucun/kchz',
method: 'get',
data: data
url: '/ruku/recount',
method: 'get'
})
}
// 条件查询

62
base-ui/src/views/kucun/rkmx/index.vue

@ -3,24 +3,25 @@
<el-row :gutter="20">
<el-col :span="14">
<el-tabs v-model="tabActiveName">
<el-tab-pane label="入库单上传记录" name="uplog">用户管理</el-tab-pane>
<el-tab-pane label="[112]供应链仓入库明细" name="k112">用户管理</el-tab-pane>
<el-tab-pane label="全部入库明细" name="all">配置管理</el-tab-pane>
<el-tab-pane label="入库单上传记录" name="uplog">入库单上传记录</el-tab-pane>
<el-tab-pane label="[112]供应链仓入库明细" name="k112">[112]供应链仓入库明细</el-tab-pane>
<el-tab-pane label="全部入库明细" name="all">全部入库明细</el-tab-pane>
<el-tab-pane label="入库明细汇总" name="hz">入库明细汇总</el-tab-pane>
</el-tabs>
</el-col>
<el-col :span="10">
<el-card class="box-card">
<div slot="header" class="clearfix"><span>入库单上传</span></div>
<div slot="header" class="clearfix">
<span>入库单上传</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="recountRk">重新统计入库信息</el-button>
</div>
<div>
<el-upload
ref="upload"
class="upload-demo"
:action="updateAction"
:on-change="handleChange"
:on-progress="handleProgress"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
:file-list="fileList"
:auto-upload="false"
@ -29,7 +30,7 @@
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
<div slot="tip" class="el-upload__tip">上传 库存信息查询.xlsx文件</div>
<div slot="tip" class="el-upload__tip">上传 入库明细表.xlsx文件</div>
</el-upload>
</div>
<div>
@ -45,13 +46,18 @@
</template>
<script>
import { recount } from '@/api/kucun/ruku'
export default {
name: 'KucunRkmxIndex',
// components: { },
data() {
return {
updateAction: process.env.VUE_APP_BASE_API + '/ruku/uploadRkmxb',
name: '入库明细',
tabActiveName: 'uplog'
tabActiveName: 'uplog',
fileList: [],
uploadResultMesssage: '',
fullscreenloading: null
}
},
created() {
@ -66,6 +72,44 @@ export default {
//
handleReturn() {
this.$router.go(-1)
},
recountRk() {
recount()
.then(res => {
this.$message({
message: '入库信息已经重新汇总完成!',
type: 'success'
})
})
.catch(e => {
console.log(e)
})
},
submitUpload() {
this.$refs.upload.submit()
},
handleProgress(event, file, fileList) {
const _this = this
this.fullscreenloading = this.$loading({
lock: true,
text: '文件正在上传',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
if (event.percent >= 100) {
_this.fullscreenloading.text = '上传完成,正在导入数据库'
}
},
handleSuccess(resp, file, fileList) {
console.log('222', resp)
if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null
if (resp.success) {
const rdata = resp.data
this.uploadResultMesssage = '共导入数据:' + rdata.allNum + ' 条;符合监管条件的数据:' + rdata.validNum + ' 条;用时:' + rdata.durations + ' 毫秒。'
} else {
this.uploadResultMesssage = resp.msg
}
}
}
}

10
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountMapper.java

@ -26,6 +26,8 @@
package com.yxt.supervise.portal.biz.gdinstorage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
/**
@ -43,4 +45,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface GdInstorageCountMapper extends BaseMapper<GdInstorageCount> {
@Delete("delete from gd_instorage_count where 1=1")
void clearData();
@Insert("insert into gd_instorage_count(prodCode,prodName,prodNum,prodValue,supplierName,supplierCode,supplierCodeUnified) " +
"select colh7,coli8,sum(colr17),sum(colq16),cole4,colex,supplierCodeUnified " +
"from gd_instorage group by colh7,coli8,cole4,colex,supplierCodeUnified ")
void insertFromInstorage();
}

2
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java

@ -46,6 +46,8 @@ import org.springframework.stereotype.Service;
public class GdInstorageCountService extends ServiceImpl<GdInstorageCountMapper, GdInstorageCount> {
public ResultBean recount() {
ResultBean rb = ResultBean.fireFail();
baseMapper.clearData();
baseMapper.insertFromInstorage();
return rb.success();
}
}

17
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageService.java

@ -73,6 +73,8 @@ public class GdInstorageService extends ServiceImpl<GdInstorageMapper, GdInstora
@Autowired
private GdInstorageLogService gdInstorageLogService;
@Autowired
private GdInstorageLogErrService gdInstorageLogErrService;
@Autowired
private SupplierIndexService supplierIndexService;
public void doimp(String filePath) {
@ -148,8 +150,8 @@ public class GdInstorageService extends ServiceImpl<GdInstorageMapper, GdInstora
private RowHandler createRowHandler(GdInstorageLog gdlog) {
return new RowHandler() {
List<GdInstorageGd> toInsertListGd = new ArrayList<>();
List<GdInstorage> toInsertList = new ArrayList<>();
private List<GdInstorageGd> toInsertListGd = new ArrayList<>();
private List<GdInstorage> toInsertList = new ArrayList<>();
private List<GdInstorageLogErr> errList = new ArrayList<>();
private int x = 0, y = 0, errnum = 0;
private String odate = null;
@ -175,6 +177,14 @@ public class GdInstorageService extends ServiceImpl<GdInstorageMapper, GdInstora
String unifiedCode = supplierIndexService.unifiedCode(gd.getColex());
if (StrUtil.isBlank(unifiedCode)) {
gd.setSupplierCodeUnified(gd.getColex());
errnum++;
GdInstorageLogErr gile = new GdInstorageLogErr();
gile.setRowNum(x + 1);
gile.setErrInfo("未知供应商编号:" + gd.getColex());
gile.setFileFullPath(gdlog.getFileFullPath());
gile.setRowContent(JSONUtil.toJsonStr(r));
errList.add(gile);
} else {
gd.setSupplierCodeUnified(unifiedCode);
}
@ -198,6 +208,9 @@ public class GdInstorageService extends ServiceImpl<GdInstorageMapper, GdInstora
if (toInsertList != null && !toInsertList.isEmpty()) {
GdInstorageService.this.saveBatch(toInsertList);
}
if (errList != null && !errList.isEmpty()) {
gdInstorageLogErrService.saveBatch(errList);
}
gdlog.setAllNum(x);
gdlog.setValidNum(y);

Loading…
Cancel
Save