应收导入问题

product
杨世强 2 years ago
parent d136eacef8
commit e432c65c9c

@ -15,6 +15,7 @@ import jnpf.base.UserInfo;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.exception.DataException;
import jnpf.invoices.entity.InvoicesItem0Entity;
import jnpf.poundlist.entity.PoundlistEntity;
import jnpf.poundlist.service.PoundlistService;
import jnpf.saleorder.entity.SaleorderitemEntity;
@ -43,6 +44,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import javax.validation.Valid;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import jnpf.util.GeneraterSwapUtil;
@ -200,8 +202,8 @@ public class ArinvoicesController {
UserInfo userInfo=userProvider.get();
DownloadVO vo=DownloadVO.builder().build();
try{
vo.setName("职员信息.xlsx");
vo.setUrl(UploaderUtil.uploaderFile("/api/Common/DownloadModel?encryption=" ,userInfo.getId()+"#"+"职员信息.xlsx"+"#"+"Temporary"));
vo.setName("销售发票数据模板.xlsx");
vo.setUrl(UploaderUtil.uploaderFile("/api/file/DownloadModel?encryption=" ,userInfo.getId()+"#"+"arinvoices_import_template.xlsx"+"#"+"Temporary"));
}catch(Exception e){
log.error("信息导出Excel错误:{}" ,e.getMessage());
}
@ -532,6 +534,24 @@ public class ArinvoicesController {
}
/**
*
*
* @return
*/
@ApiOperation("导入预览")
@GetMapping("/ImportPreview")
public ActionResult ImportPreview(String fileName) {
String filePath = configValueUtil.getTemporaryFilePath();
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
//得到数据
List<Arinvoices_item0Entity> personList = ExcelUtil.importExcel(temporary, 3, 1, Arinvoices_item0Entity.class);
//预览数据
Map<String, Object> map = arinvoices_item0Service.importPreview(personList);
return ActionResult.success(map);
}

@ -83,7 +83,7 @@ public class Arinvoices_item0Entity {
@Excel(name = "税率")
@TableField("TAX_RATE")
private Integer taxRate;
private String taxRate;
@Excel(name = "税额")
@TableField("TAX_AMOUNT")
@ -111,4 +111,8 @@ public class Arinvoices_item0Entity {
@TableField("SALES_ORDER_NO")
private String salesOrderNo;
@Excel(name = "商品名称")
@TableField("MATERIAL_NAME")
private String materialName;
}

@ -62,4 +62,8 @@ public class Arinvoices_item0Model {
@JsonProperty("attachMent")
private String attachMent;
/** 物料名称*/
@JsonProperty("materialName")
private String materialName;
}

@ -2,6 +2,11 @@ package jnpf.arinvoices.service;
import jnpf.arinvoices.entity.Arinvoices_item0Entity;
import com.baomidou.mybatisplus.extension.service.IService;
import jnpf.invoices.entity.InvoicesItem0Entity;
import java.util.List;
import java.util.Map;
/**
*
* jg_arinvoices_item0
@ -11,5 +16,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
* 2023-02-23
*/
public interface Arinvoices_item0Service extends IService<Arinvoices_item0Entity> {
/**
*
*
* @param personList
* @return
*/
Map<String, Object> importPreview(List<Arinvoices_item0Entity> personList);
}

@ -4,6 +4,7 @@ import jnpf.arinvoices.entity.*;
import jnpf.arinvoices.mapper.Arinvoices_item0Mapper;
import jnpf.arinvoices.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.invoices.entity.InvoicesItem0Entity;
import jnpf.util.RandomUtil;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
@ -38,4 +39,72 @@ import java.util.*;
public class Arinvoices_item0ServiceImpl extends ServiceImpl<Arinvoices_item0Mapper, Arinvoices_item0Entity> implements Arinvoices_item0Service{
@Override
public Map<String, Object> importPreview(List<Arinvoices_item0Entity> personList) {
List<Map<String, Object>> dataRow = new ArrayList<>();
List<Map<String, Object>> columns = new ArrayList<>();
if(personList != null) {
for (int i = 0; i < personList.size(); i++) {
Map<String, Object> dataRowMap = new HashMap<>();
Arinvoices_item0Entity model = personList.get(i);
dataRowMap.put("materialName", model.getMaterialName());
dataRowMap.put("invoiceCode", model.getInvoiceCode());
dataRowMap.put("invoiceNo", model.getInvoiceNo());
dataRowMap.put("invoiceQuantity", model.getInvoiceQuantity());
dataRowMap.put("involceAmount", model.getInvolceAmount().add(model.getTaxAmount()));
dataRowMap.put("taxRate", model.getTaxRate());
dataRowMap.put("taxAmount", model.getTaxAmount());
dataRowMap.put("amountNotTax", model.getInvolceAmount().subtract(model.getTaxAmount()));
dataRowMap.put("invoiceStatus", "0");
dataRowMap.put("creatorUserName", model.getCreatorUserName());
dataRowMap.put("invoiceDate", model.getInvoiceDate());
dataRow.add(dataRowMap);
}
for (int i = 1; i < 12; i++) {
Map<String, Object> columnsMap = new HashMap<>();
columnsMap.put("AllowDBNull", true);
columnsMap.put("AutoIncrement", false);
columnsMap.put("AutoIncrementSeed", 0);
columnsMap.put("AutoIncrementStep", 1);
columnsMap.put("Caption", this.getColumns(i));
columnsMap.put("ColumnMapping", 1);
columnsMap.put("ColumnName", this.getColumns(i));
columnsMap.put("Container", null);
columnsMap.put("DataType", "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
columnsMap.put("DateTimeMode", 3);
columnsMap.put("DefaultValue", null);
columnsMap.put("DesignMode", false);
columnsMap.put("Expression", "");
columnsMap.put("ExtendedProperties", "");
columnsMap.put("MaxLength", -1);
columnsMap.put("Namespace", "");
columnsMap.put("Ordinal", 0);
columnsMap.put("Prefix", "");
columnsMap.put("ReadOnly", false);
columnsMap.put("Site", null);
columnsMap.put("Table", personList);
columnsMap.put("Unique", false);
columns.add(columnsMap);
}
}
Map<String, Object> map = new HashMap<>();
map.put("dataRow", dataRow);
map.put("columns", columns);
return map;
}
private String getColumns(Integer key) {
Map<Integer, String> map = new HashMap<>();
map.put(1, "物料名称");
map.put(2, "发票代码");
map.put(3, "发票号码");
map.put(4, "发票数量");
map.put(5, "发票金额");
map.put(6, "税率");
map.put(7, "税额");
map.put(8, "不含税金额");
map.put(9, "发票状态");
map.put(10, "开票人");
map.put(11, "开票日期");
return map.get(key);
}
}

@ -26,6 +26,10 @@ public class Invoices_item0itemModel {
@JsonProperty("invoiceCode")
private String invoiceCode;
/** 数量 **/
@JsonProperty("invoiceNum")
private String invoiceNum;
/** 金额 **/
@JsonProperty("invoiceAmount")
private String invoiceAmount;

@ -533,7 +533,7 @@ public class TradeuploadController {
queryWrapper.lambda().eq(TradeuploadEntity::getCustomerId,entity.getCustomerId());
List<TradeuploadEntity> list = tradeuploadService.list(queryWrapper);
if (list != null && list.size()>0){
return ActionResult.success("磅单重复");
return ActionResult.fail("磅单重复");
}
entity.setId(mainId);
tradeuploadService.save(entity);

@ -19,7 +19,7 @@ export function ImportPreview(data) {
//模板下载
export function TemplateDownload() {
return request({
url: '/api/arinvoices/Arinvoices/TemplateDownload',
url: '/api/arinvoices/Arinvoices/templateDownload',
method: 'get'
})
}

@ -210,6 +210,13 @@
</div>
<el-table :data="dataForm.arinvoices_item0List" size='mini' show-summary :summary-method="getSummaries2" >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="materialName" label="物料名称" align="center" width="130">
<template slot-scope="scope">
<el-input v-model="scope.row.materialName"
placeholder="请输入" clearable :style='{"width":"100%"}' disabled>
</el-input>
</template>
</el-table-column>
<el-table-column prop="invoiceCode" label="发票代码" align="center" width="130">
<template slot-scope="scope">
<el-input v-model="scope.row.invoiceCode"

@ -210,6 +210,13 @@
</div>
<el-table :data="dataForm.arinvoices_item0List" size='mini' show-summary :summary-method="getSummaries2" >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="materialName" label="物料名称" align="center" width="130">
<template slot-scope="scope">
<el-input v-model="scope.row.materialName"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
</template>
</el-table-column>
<el-table-column prop="invoiceCode" label="发票代码" align="center" width="130">
<template slot-scope="scope">
<el-input v-model="scope.row.invoiceCode"
@ -417,7 +424,7 @@
}else if(column.taxRate == '0'){
column.taxRate = '5';
}
this.dataForm.invoicesitem0List.push(column);
this.dataForm.arinvoices_item0List.push(column);
});
},
uploadForm() {
@ -459,7 +466,7 @@
return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value)) && (index === 3 || index === 4 || index === 6 || index === 7 )) {
if (!values.every(value => isNaN(value)) && (index === 4 || index === 5 || index === 7 || index === 8 )) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
@ -472,6 +479,8 @@
sums[index] = '';
}
});
this.dataForm.invoiceQuantity = sums[4];
this.dataForm.invoiceAmount = sums[5];
return sums;
},
arinvoices_item1Exist() {
@ -555,11 +564,13 @@
type: 'success',
duration: 1000,
onClose: () => {
this.submitDisabled = true;
this.submitDisabled = false;
this.visible = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}else{
request({
@ -577,6 +588,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -603,9 +603,9 @@
})
},
request() {
this.submitDisabled = true;
var _data = this.dataList()
if (!this.dataForm.id) {
this.submitDisabled = true;
request({
url: '/api/collection/Collection',
method: 'post',
@ -621,9 +621,10 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
this.submitDisabled = true;
request({
url: '/api/collection/Collection/' + this.dataForm.id,
method: 'PUT',
@ -640,6 +641,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -708,6 +708,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -725,6 +727,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -477,6 +477,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -494,6 +496,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -522,6 +522,8 @@
this.$emit('close', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -539,6 +541,8 @@
this.$emit('close', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -481,6 +481,20 @@
})
},
request() {
var statusFlag = true;
this.dataForm.payment_item0List.forEach((item,index) => {
if (this.jnpf.floatAdd(item.amount, item.paymentAmount) > item.requestAmount){
statusFlag = false;
}
})
if (!statusFlag){
this.$message({
type: 'error',
message: '已超出申请金额,请核查',
duration: 3000
});
return
}
this.submitDisabled = true;
var _data = this.dataList()
if (!this.dataForm.id) {
@ -499,6 +513,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -516,6 +532,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -633,13 +633,15 @@
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
duration: 3000,
onClose: () => {
this.submitDisabled = false;
this.visible = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -650,13 +652,15 @@
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
duration: 3000,
onClose: () => {
this.submitDisabled = false;
this.visible = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -991,13 +991,15 @@
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
duration: 3000,
onClose: () => {
this.submitDisabled = false;
this.visible = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -1008,13 +1010,15 @@
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
duration: 3000,
onClose: () => {
this.submitDisabled = false;
this.visible = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -617,13 +617,15 @@
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
duration: 3000,
onClose: () => {
this.submitDisabled = false;
this.visible = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -634,13 +636,15 @@
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
duration: 3000,
onClose: () => {
this.submitDisabled = false;
this.visible = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -996,13 +996,15 @@
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
duration: 3000,
onClose: () => {
this.submitDisabled = false;
this.visible = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}else{
request({
@ -1013,13 +1015,15 @@
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
duration: 3000,
onClose: () => {
this.submitDisabled = false;
this.visible = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -476,7 +476,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
url: '/api/purchaseback/Purchaseback/' + this.dataForm.id,
@ -493,7 +495,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
}
},
addpurchaseback_item0List() {

@ -298,6 +298,13 @@
</el-input>
</template>
</el-table-column>
<el-table-column prop="invoiceNum" label="数量">
<template slot-scope="scope">
<el-input v-model="scope.row.invoiceNum" placeholder="请输入" clearable
:style='{"width":"100%"}'>
</el-input>
</template>
</el-table-column>
<el-table-column prop="invoiceAmount" label="金额">
<template slot-scope="scope">
<el-input v-model="scope.row.invoiceAmount" placeholder="请输入" clearable

@ -922,6 +922,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -939,6 +941,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -683,6 +683,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -700,6 +702,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -450,6 +450,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -467,6 +469,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -477,7 +477,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
url: '/api/purchaseback/Purchaseback/' + this.dataForm.id,
@ -494,7 +496,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
}
},
addpurchaseback_item0List() {

@ -644,6 +644,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -661,6 +663,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -624,6 +624,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -641,6 +643,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -407,6 +407,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}else{
request({
@ -424,6 +426,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -447,7 +447,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
url: '/api/saleback/Saleback/' + this.dataForm.id,
@ -464,7 +466,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
}
},
addsaleback_item0List() {

@ -1047,6 +1047,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -1064,6 +1066,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -36,11 +36,11 @@
</div>
<div class="import-main" v-show="active==2">
<JNPF-table v-loading="listLoading" :data="list">
<!-- <el-table-column prop="materialName" label="物料名称" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.materialName" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="materialName" label="物料名称" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.materialName" />
</template>
</el-table-column>
<el-table-column prop="invoiceCode" label="发票代码" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.invoiceCode" />
@ -148,7 +148,7 @@
</template>
<script>
import { TemplateDownload, ImportData, ImportPreview } from '@/api/scm/invoices'
import { TemplateDownload, ImportData, ImportPreview } from '@/api/scm/arinvoices'
export default {
data() {
return {

@ -222,6 +222,13 @@
</div>
<el-table :data="dataForm.arinvoices_item0List" size='mini' show-summary :summary-method="getSummaries2" >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="materialName" label="物料名称" align="center" width="130">
<template slot-scope="scope">
<el-input v-model="scope.row.materialName"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
</template>
</el-table-column>
<el-table-column prop="invoiceCode" label="发票代码" align="center" width="130">
<template slot-scope="scope">
<el-input v-model="scope.row.invoiceCode"
@ -440,7 +447,7 @@
return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value)) && (index === 3 || index === 4 || index === 6 || index === 7 )) {
if (!values.every(value => isNaN(value)) && (index === 4 || index === 5 || index === 7 || index === 8 )) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
@ -453,6 +460,8 @@
sums[index] = '';
}
});
this.dataForm.invoiceQuantity = sums[4];
this.dataForm.invoiceAmount = sums[5];
return sums;
},
invoiceQuantitySum(){
@ -594,6 +603,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}else{
request({
@ -611,6 +622,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},
@ -636,12 +649,12 @@
invoiceNo:undefined,
invoiceQuantity:undefined,
involceAmount:undefined,
taxRate:undefined,
taxRate:'0',
taxAmount:undefined,
amountNotTax:undefined,
invoiceStatus:undefined,
invoiceStatus:'0',
creatorUserName:undefined,
invoiceDate:undefined,
invoiceDate:new Date().getTime(),
attachMent:undefined,
}
this.dataForm.arinvoices_item0List.push(item)

@ -389,6 +389,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}else{
request({
@ -406,6 +408,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -448,6 +448,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -465,6 +467,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},

@ -435,7 +435,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
url: '/api/saleback/Saleback/' + this.dataForm.id,
@ -452,7 +454,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
}
},
addsaleback_item0List() {

@ -625,7 +625,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
@ -642,7 +644,9 @@
this.$emit('refresh', true)
}
})
})
}).catch(() => {
this.submitDisabled = false
})
}
},
request3() {
@ -669,7 +673,9 @@
this.$refs.poundUpload.handleRemove(0);
}
})
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
@ -691,7 +697,9 @@
this.$refs.poundUpload.handleRemove(0);
}
})
})
}).catch(() => {
this.submitDisabled = false
})
}
},
request() {

@ -605,6 +605,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -622,6 +624,8 @@
this.$emit('refresh', true)
}
})
}).catch(() => {
this.submitDisabled = false
})
}
},
@ -638,6 +642,8 @@
type: 'success',
duration: 1000,
})
}).catch(() => {
this.submitDisabled = false
})
} else {
request({
@ -650,6 +656,8 @@
type: 'success',
duration: 1000,
})
}).catch(() => {
this.submitDisabled = false
})
}
this.dataForm.vehicleId = null;

Loading…
Cancel
Save