rev:1.报废出库回传修改2.出库页面导入excel
This commit is contained in:
Binary file not shown.
@@ -3,7 +3,9 @@ package org.nl.wms.st.inbill.service;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
@@ -303,4 +305,11 @@ public interface CheckOutBillService {
|
||||
* }
|
||||
*/
|
||||
JSONObject updataIsOverdue(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 导入运费
|
||||
* @param file、
|
||||
* @param request、
|
||||
*/
|
||||
void importExcel(MultipartFile file, HttpServletRequest request);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.st.outbill.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -9,7 +10,9 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
@@ -313,10 +316,16 @@ public class CheckOutBillController {
|
||||
checkOutBillService.download(map, response, stor_id, bill_status, bill_type);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/updataIsOverdue")
|
||||
@Log("更新是否超期")
|
||||
public ResponseEntity<Object> updataIsOverdue(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(checkOutBillService.updataIsOverdue(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/importExcel")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> importExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||
checkOutBillService.importExcel(file, request);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
@@ -39,10 +41,13 @@ import org.nl.wms.util.TranUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -1048,6 +1053,78 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(MultipartFile file, HttpServletRequest request) {
|
||||
// 明细
|
||||
WQLObject dtl = WQLObject.getWQLObject("st_ivt_iostorinvdtl");
|
||||
// 主表
|
||||
WQLObject mst = WQLObject.getWQLObject("st_ivt_iostorinv");
|
||||
// 物流公司
|
||||
WQLObject tran = WQLObject.getWQLObject("MD_CS_TransportationBase");
|
||||
|
||||
// 1.获取上传文件输入流
|
||||
InputStream inputStream = null;
|
||||
|
||||
try {
|
||||
inputStream = file.getInputStream();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 查询所有物流公司
|
||||
List<JSONObject> tranList = tran.query("is_used = '1' and is_delete = '0'")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read(1, excelReader.getRowCount());
|
||||
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
List list = read.get(i);
|
||||
|
||||
// 交货单
|
||||
String vbeln = list.get(0).toString();
|
||||
|
||||
if (ObjectUtil.isEmpty(vbeln)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 根据交货单找到主单据
|
||||
JSONObject jsonDtl = dtl.query("vbeln = '" + vbeln + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonDtl)) {
|
||||
continue;
|
||||
}
|
||||
JSONObject jsonMst = mst.query("iostorinv_id = '" + jsonDtl.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
|
||||
// 物流公司名称
|
||||
String cust_name = list.get(1).toString();
|
||||
// 匹配对应的物流公司
|
||||
JSONObject jsonTran = tranList.stream()
|
||||
.filter(row -> row.getString("cust_name").equals(cust_name))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
// 运单号
|
||||
String order_number = list.get(2).toString();
|
||||
|
||||
// 车型
|
||||
String car_type = list.get(3).toString();
|
||||
|
||||
// 其他费用
|
||||
String other_freight = list.get(4).toString();
|
||||
|
||||
// 其他费用
|
||||
String estimated_freight = list.get(5).toString();
|
||||
|
||||
// 更新主表
|
||||
jsonMst.put("trans_code", ObjectUtil.isNotEmpty(jsonTran) ? jsonTran.getString("cust_code") : "" );
|
||||
jsonMst.put("order_number", order_number);
|
||||
jsonMst.put("car_type", car_type);
|
||||
jsonMst.put("other_freight", other_freight);
|
||||
jsonMst.put("estimated_freight", estimated_freight);
|
||||
mst.update(jsonMst);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject whereJson) {
|
||||
|
||||
@@ -410,10 +410,14 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
|
||||
// List<JSONObject> planList = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name in ('" + pcsn_in + "')").getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
JSONArray item = new JSONArray();
|
||||
// 查询仓库
|
||||
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr")
|
||||
.query("stor_code = '" + jo_mst.getString("stor_code") + "'").uniqueResult(0);
|
||||
|
||||
for (int j = 0; j < disArr.size(); j++) {
|
||||
JSONObject param = new JSONObject();
|
||||
JSONArray item = new JSONArray();
|
||||
|
||||
JSONObject json = disArr.getJSONObject(j);
|
||||
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
@@ -436,9 +440,20 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
}
|
||||
jsonDtl.put("Details", details);
|
||||
item.add(jsonDtl);
|
||||
|
||||
param.put("Items", item);
|
||||
|
||||
// 仓库编码
|
||||
param.put("WareHouse", jsonStor.getString("ext_id"));
|
||||
// new LmsToMesServiceImpl().ChildScrapUpdate(param);
|
||||
|
||||
// 更新分配回传成功
|
||||
JSONObject jsonUpdate = new JSONObject();
|
||||
jsonUpdate.put("is_upload", "1");
|
||||
|
||||
WQLObject.getWQLObject("st_ivt_iostorinvdis")
|
||||
.update(jsonUpdate,"iostorinv_id = '"+jo_mst.getString("iostorinv_id")+"' and box_no = '"+json.getString("box_no")+"'");
|
||||
}
|
||||
param.put("Items", item);
|
||||
new LmsToMesServiceImpl().ChildScrapUpdate(param);
|
||||
|
||||
jo_mst.put("upload_mes", "1");
|
||||
jo_mst.put("is_upload", "1");
|
||||
|
||||
@@ -210,6 +210,7 @@
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
WHERE
|
||||
dis.iostorinv_id = 输入.iostorinv_id
|
||||
AND dis.is_upload <> '1'
|
||||
GROUP BY dis.box_no
|
||||
|
||||
ENDSELECT
|
||||
|
||||
117
lms/nladmin-ui/src/views/wms/st/outbill/UploadDialog.vue
Normal file
117
lms/nladmin-ui/src/views/wms/st/outbill/UploadDialog.vue
Normal file
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="导入Excel文件"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="400px"
|
||||
:show-close="true"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
class="upload-demo"
|
||||
action=""
|
||||
drag
|
||||
:on-exceed="is_one"
|
||||
:limit="1"
|
||||
:auto-upload="false"
|
||||
:multiple="false"
|
||||
:show-file-list="true"
|
||||
:on-change="uploadByJsqd"
|
||||
:file-list="fileList"
|
||||
accept=".xlsx,.xls"
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
<div class="el-upload__text">
|
||||
将文件拖到此处,或
|
||||
<em>点击上传</em>
|
||||
</div>
|
||||
<div slot="tip" class="el-upload__tip">只能上传Excel文件,且不超过10MB</div>
|
||||
</el-upload>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'UploadDialog',
|
||||
mixins: [crud()],
|
||||
components: {},
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
fileList: [],
|
||||
file1: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
openParam: {
|
||||
handler(newValue, oldValue) {
|
||||
this.opendtlParam = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
is_one() {
|
||||
this.crud.notify('只能上传一个excel文件!', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||
},
|
||||
// 文件校验方法
|
||||
beforeAvatarUpload(file) {
|
||||
// 不能导入大小超过2Mb的文件
|
||||
if (file.size > 10 * 1024 * 1024) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
// 文件发生改变就会触发的事件
|
||||
uploadByJsqd(file) {
|
||||
this.file1 = file
|
||||
},
|
||||
submit() {
|
||||
debugger
|
||||
if (this.beforeAvatarUpload(this.file1)) {
|
||||
this.fileList.name = this.file1.name
|
||||
this.fileList.url = ''
|
||||
var formdata = new FormData()
|
||||
formdata.append('file', this.file1.raw)
|
||||
// excelImport:请求接口 formdata:传递参数
|
||||
checkoutbill.excelImport(formdata).then((res) => {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$emit('tableChanged', null)
|
||||
this.$emit('update:dialogShow', false)
|
||||
})
|
||||
} else {
|
||||
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -248,4 +248,11 @@ export function updataIsOverdue(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, getOutBillDis2, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, updataIsOverdue }
|
||||
export function excelImport(data) {
|
||||
return request({
|
||||
url: '/api/checkoutbill/importExcel',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, getOutBillDis2, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, updataIsOverdue, excelImport }
|
||||
|
||||
@@ -251,6 +251,16 @@
|
||||
>
|
||||
导出Excel
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
@click="Import"
|
||||
>
|
||||
导入运费
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
@@ -338,6 +348,7 @@
|
||||
<DivDialog :dialog-show.sync="divShow" :open-array="openParam" :stor-id="storId" :rowmst="mstrow" @DivChanged="querytable" />
|
||||
<TaskDialog :dialog-show.sync="taskShow" :open-array="openParam" :rowmst="mstrow" @TaskChanged="querytable" />
|
||||
<MoneyDialog :dialog-show.sync="openMoneyDialog" :open-param-money="openParamMoney" />
|
||||
<UploadDialog :dialog-show.sync="uploadDialogShow" @tableChanged="tableChanged"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -350,6 +361,7 @@ import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import AddDialog from '@/views/wms/st/outbill/AddDialog'
|
||||
import MoneyDialog from '@/views/wms/st/outbill/MoneyDialog'
|
||||
import UploadDialog from '@/views/wms/st/outbill/UploadDialog'
|
||||
import DivDialog from '@/views/wms/st/outbill/DivDialog'
|
||||
import TaskDialog from '@/views/wms/st/outbill/TaskDialog'
|
||||
import ViewDialog from '@/views/wms/st/outbill/ViewDialog'
|
||||
@@ -361,7 +373,7 @@ const start = new Date()
|
||||
|
||||
export default {
|
||||
name: 'Checkoutbill',
|
||||
components: { ViewDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DivDialog, TaskDialog, MoneyDialog },
|
||||
components: { ViewDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DivDialog, TaskDialog, MoneyDialog, UploadDialog },
|
||||
cruds() {
|
||||
return CRUD({ title: '用户', idField: 'iostorinv_id', url: 'api/checkoutbill', crudMethod: { ...checkoutbill },
|
||||
optShow: {
|
||||
@@ -399,6 +411,7 @@ export default {
|
||||
openParamMoney: null,
|
||||
mstrow: {},
|
||||
viewShow: false,
|
||||
uploadDialogShow: false,
|
||||
currentRow: null,
|
||||
checkrows: [],
|
||||
storlist: [],
|
||||
@@ -620,6 +633,12 @@ export default {
|
||||
}).catch(() => {
|
||||
crud.downloadLoading = false
|
||||
})
|
||||
},
|
||||
Import() {
|
||||
this.uploadDialogShow = true
|
||||
},
|
||||
tableChanged() {
|
||||
this.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user