采购订单-文件导入

product
chuang 2 years ago
parent 273161bff7
commit 4ac2d775f0

@ -34,10 +34,13 @@ import java.util.Map;
*/
public class FileCopy {
public static String getInfoAndUpFile(File[] fileList)throws Exception {
public static ArrayList<Object> getInfoAndUpFile(File[] fileList) throws Exception {
String fileName = "";
// 图片对应的信息
// 榜单图片对应的信息
HashMap<String, Object> fileMap = new HashMap<>();
// 车辆图片对应的信息
HashMap<String, Object> carFileMap = new HashMap<>();
ArrayList<Object> resultList = new ArrayList<>();
File excelFile = null;
for (int i = 0; i < fileList.length; i++) {
File file = fileList[i];
@ -46,10 +49,22 @@ public class FileCopy {
int xlsIndex = 0;
// 将文件夹中的文件上传到文件服务器
if (file.isDirectory()) {
fileName = getInfoAndUpFile(file.listFiles());
ArrayList<Object> resultListt = getInfoAndUpFile(file.listFiles());
if (resultListt.get(0) != null) {
fileName = fileName+String.valueOf(resultListt.get(0));
}
if (resultListt.get(1) != null) {
carFileMap.putAll ((HashMap<String, Object>) resultListt.get(1));
}
if (resultListt.get(2) != null) {
fileMap.putAll ((HashMap<String, Object>) resultListt.get(2));
}
}
if (file.isFile()) {
String indexString = name.substring(0, name.lastIndexOf("."));
String parent = file.getParent();
String parentName = parent.substring(parent.lastIndexOf("\\") + 1, parent.length());
String substring = name.substring(name.lastIndexOf(".") + 1, name.length());
if (substring.contains("xls") || substring.contains("xlsx")) {
// 进行word操作
@ -68,9 +83,29 @@ public class FileCopy {
if (annex.getCode() == 200) {
list.add(annex.getData());
}
fileMap.put(indexString,JsonUtil.getListToJsonArray(list));
// 将榜单照片存在榜单列表中
if (indexString.equals("1")) {
if (fileMap.containsKey(parentName)) {
List<Object> o = (List<Object>) fileMap.get(parentName);
o.add(annex.getData());
fileMap.put(parentName, o);
} else {
fileMap.put(parentName, list);
}
} else {
if (carFileMap.containsKey(parentName)) {
List<Object> o = (List<Object>) carFileMap.get(parentName);
o.add(annex.getData());
carFileMap.put(parentName, o);
} else {
carFileMap.put(parentName, list);
}
}
// 将车辆照片存在车辆照片中
}
if (i == fileList.length - 1) {
if (excelFile != null) {
ExcelReader reader = ExcelUtil.getReader(excelFile);
reader.setIgnoreEmptyRow(true);
// List<HashMap> read = reader.read(3, reader.read().size(), HashMap.class);
@ -104,6 +139,7 @@ public class FileCopy {
// continue;
// }
Cell cell4 = row.createCell(18);
Cell cell = row.createCell(19);
Cell cell1 = row.createCell(20);
Cell cell2 = row.createCell(21);
@ -119,9 +155,14 @@ public class FileCopy {
cell.setCellValue("销售合同编码");
cell = row.createCell(22);
cell.setCellValue("采购合同编码");
cell = row.createCell(18);
cell.setCellValue("车辆图片地址");
} else {
Object o1 = fileMap.get(String.valueOf(o));
Object o2 = carFileMap.get(String.valueOf(o));
cell.setCellValue(String.valueOf(o1).equals("null") ? "" : String.valueOf(o1));
cell4.setCellValue(String.valueOf(o2).equals("null") ? "" : String.valueOf(o2));
cell1.setCellValue(companyStr);
cell2.setCellValue(str);
cell3.setCellValue(str3);
@ -141,13 +182,20 @@ public class FileCopy {
UploaderVO fileLoader = (UploaderVO) annex.getData();
System.out.println(fileLoader);
System.out.println(fileLoader.getName());
return fileLoader.getName();
resultList.add(fileLoader.getName());
resultList.add(carFileMap);
resultList.add(fileMap);
return resultList;
}
}
}
}
return fileName;
}
resultList.add(fileName);
resultList.add(carFileMap);
resultList.add(fileMap);
return resultList;
}
@ -157,10 +205,11 @@ public class FileCopy {
file.mkdirs();
}
}
/**
* @TODO
* @param path
* @return
* @TODO
*/
public static boolean delAllFile(String path) {
boolean flag = false;
@ -192,11 +241,9 @@ public class FileCopy {
}
/**
* base64
*
* @param picturesInfo
* @return
* @throws Exception
@ -234,8 +281,10 @@ public class FileCopy {
}
return imageBaseList;
}
/**
*
*
* @param
* @return
*/
@ -300,6 +349,7 @@ public class FileCopy {
}
}
public static void copyFile(File source, String dest) throws IOException {
if (source.exists()) {

@ -73,8 +73,8 @@ import java.util.List;
import java.util.Map;
/**
*
* purchaseorder
*
* @ V3.2.0
* @ LINKAGE-BOOT
* @ LINKAGE-BOOT
@ -286,7 +286,6 @@ public class PurchaseorderController {
}
/**
*
*
@ -328,12 +327,11 @@ public class PurchaseorderController {
@Cleanup InputStream inputStream = file.getInputStream();
File gbk = ZipUtil.unzip(inputStream, temporaryFile, Charset.forName("GBK"));
HashMap<String, String> imgMap = new HashMap<>();
String fileName = FileCopy.getInfoAndUpFile(gbk.listFiles());
log.warn(filePath);
log.warn(fileName);
List<Object> resultList= FileCopy.getInfoAndUpFile(gbk.listFiles());
FileUtil.deleteFileAll(temporaryFile);
// FileUtil.upFile(file, filePath, fileName);
DownloadVO vo = DownloadVO.builder().build();
vo.setName(fileName);
vo.setName(String.valueOf(resultList.get(0)));
return ActionResult.success(vo);
} else {
return ActionResult.fail("选择文件不符合导入");
@ -405,6 +403,7 @@ public class PurchaseorderController {
DownloadVO vo = this.creatModelExcel(configValueUtil.getTemporaryFilePath(), mapList, keys, userInfo);
return ActionResult.success(vo);
}
//导出表格
public DownloadVO creatModelExcel(String path, List<Map<String, Object>> list, String[] keys, UserInfo userInfo) {
DownloadVO vo = DownloadVO.builder().build();
@ -559,9 +558,6 @@ public class PurchaseorderController {
}*/
if (vo.getCreatorTime() != null) {
vo.setCreatorTime(vo.getCreatorTime());
}
@ -734,8 +730,6 @@ public class PurchaseorderController {
}
/**
*
*
@ -847,7 +841,6 @@ public class PurchaseorderController {
}
/**
*
*
@ -884,8 +877,4 @@ public class PurchaseorderController {
}
}

@ -41,19 +41,17 @@ public class PurchaseorderDTO {
@Excel(name = "结算重量")
private String settlement;
@Excel(name = "磅单图片")
private String imgPicturess;
@Excel(name = "是否垫资")
private String advance;
@Excel(name = "自然人")
private String naturalId;
// @Excel(name = "自然人")
// private String naturalId;
@Excel(name = "采购单价")
@Excel(name = "采购")
private String purchasePrice;
@Excel(name = "销售单价")
@Excel(name = "销售")
private String salesPrice;
@Excel(name = "运费")
@ -62,6 +60,9 @@ public class PurchaseorderDTO {
@Excel(name = "起始地")
private String originPrice;
@Excel(name = "业务员2")
private String naturalId;
@Excel(name = "备注")
private String remark;
@ -70,6 +71,8 @@ public class PurchaseorderDTO {
@Excel(name = "榜单图片地址")
private String poundPictures;
@Excel(name = "车辆图片地址")
private String carPictures;
@Excel(name = "销售合同编码")
private String salesId;
@ -79,6 +82,7 @@ public class PurchaseorderDTO {
@Excel(name = "客户")
private String customerId;
private String id;
private List<PurchaseorderDTO> list;

@ -23,8 +23,6 @@ import jnpf.base.controller.BillRuleController;
import jnpf.base.entity.ProvinceEntity;
import jnpf.base.mapper.ProvinceMapper;
import jnpf.config.ConfigValueUtil;
import jnpf.contractfile.entity.ContractFileEntity;
import jnpf.contractfile.service.ContractFileService;
import jnpf.customer.entity.CustomerEntity;
import jnpf.customer.mapper.CustomerVMapper;
import jnpf.exception.DataException;
@ -77,6 +75,7 @@ import java.awt.*;
import java.io.*;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@ -85,7 +84,6 @@ import java.util.*;
import java.util.stream.Collectors;
/**
*
* purchaseorder
* V3.2.0
* LINKAGE-BOOT
@ -231,7 +229,6 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 8));
BigDecimal sum = BigDecimal.ZERO;
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
@ -342,7 +339,7 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
HSSFCell lowCell2 = lowRow.createCell(8);
lowCell1.setCellValue("合计");
lowCell1.setCellStyle(lineStyle);
sum.setScale(2,BigDecimal.ROUND_DOWN);
sum.setScale(2, RoundingMode.DOWN);
lowCell2.setCellValue(sum.toString());
lowCell2.setCellStyle(lineStyle);
lowRow.createCell(1).setCellStyle(lineStyle);
@ -367,13 +364,13 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
sheet.autoSizeColumn(8);
sheet.setAutobreaks(true);//这个是sheet缩放设置默认打印一页要true
sheet.setMargin(Sheet.BottomMargin,( double ) 0.5 );// 页边距(下)
sheet.setMargin(Sheet.BottomMargin, 0.5);// 页边距(下)
sheet.setMargin(Sheet.LeftMargin,( double ) 0.1 );// 页边距(左)
sheet.setMargin(Sheet.LeftMargin, 0.1);// 页边距(左)
sheet.setMargin(Sheet.RightMargin,( double ) 0.1 );// 页边距(右)
sheet.setMargin(Sheet.RightMargin, 0.1);// 页边距(右)
sheet.setMargin(Sheet.TopMargin,( double ) 0.5 );// 页边距(上)
sheet.setMargin(Sheet.TopMargin, 0.5);// 页边距(上)
sheet.setHorizontallyCenter(true);//设置打印页面为水平居中
@ -386,7 +383,6 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
sheet.setFitToPage(true);
HSSFPrintSetup printSetup = sheet.getPrintSetup();
printSetup.setLandscape(false); // 打印方向true横向false纵向
@ -394,8 +390,6 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
printSetup.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE); //纸张大小自选A4 作者:大萌音音 https://www.bilibili.com/read/cv15053559 出处bilibili
workbook.write(fileOut);
} finally {
@ -411,7 +405,6 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
}
/**
*
* @param wrapper
* @param templateFilePath
* @throws Exception
@ -462,10 +455,10 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
}
/**
*@TODO word
* @param list word
* @param templateFilePath
* @throws Exception
* @TODO word
*/
public void getWord(List<HashMap<String, Object>> list, String templateFilePath) throws Exception {
// 创建一个新的word文件
@ -491,7 +484,7 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
HashMap<String, Object> map = list.get(i);
if (i == 0) {
Paragraph title = section.addParagraph();
title.appendText(String.valueOf(map.get("supplierName")+"榜单图片"));
title.appendText(map.get("supplierName") + "榜单图片");
titleStr = String.valueOf(map.get("supplierName"));
title.getFormat().setHorizontalAlignment(HorizontalAlignment.Center);
@ -604,9 +597,9 @@ if (pMap!=null&&pMap.size()>0){
// log.warn("报错点"+model.getAmount().equals("null"));
settlementSum = settlementSum.add(new BigDecimal(model.getSettlement() == null ? "0.00000000" : model.getSettlement()));
amountSum = amountSum.add(new BigDecimal(model.getAmount() == null ? "0.00000000" : model.getAmount()));
model.setSettlement(new BigDecimal(model.getSettlement()).setScale(2,BigDecimal.ROUND_HALF_DOWN).toString());
model.setPrice(new BigDecimal(model.getPrice()).setScale(2,BigDecimal.ROUND_HALF_DOWN).toString());
model.setAmount(new BigDecimal(model.getAmount()==null?"0.00000000":model.getAmount()).setScale(2,BigDecimal.ROUND_HALF_DOWN).toString());
model.setSettlement(new BigDecimal(model.getSettlement()).setScale(2, RoundingMode.HALF_DOWN).toString());
model.setPrice(new BigDecimal(model.getPrice()).setScale(2, RoundingMode.HALF_DOWN).toString());
model.setAmount(new BigDecimal(model.getAmount() == null ? "0.00000000" : model.getAmount()).setScale(2, RoundingMode.HALF_DOWN).toString());
// 客户名称
String supplierNm = model.getSupplierNm();
imgMap.put("supplierNm", supplierNm);
@ -626,7 +619,7 @@ if (pMap!=null&&pMap.size()>0){
Section section = document.addSection();
Paragraph title = section.addParagraph();
title.appendText(String.valueOf(map.get("supplierName")+"榜单图片"));
title.appendText(map.get("supplierName") + "榜单图片");
ParagraphStyle style = new ParagraphStyle(document);
style.setName("titleStyle");
style.getCharacterFormat().setBold(true);
@ -651,7 +644,7 @@ if (pMap!=null&&pMap.size()>0){
for (int i1 = 0; i1 < pictures1.size(); i1++) {
Map<String, Object> map2 = pictures1.get(i1);
if (map2.get("filePath") != null && !String.valueOf(map2.get("filePath")).equals("null")) {
log.warn("路径"+(String)map2.get("filePath"));
log.warn("路径" + map2.get("filePath"));
// 添加一个段落
Paragraph paragraph1 = section.addParagraph();
paragraph1.appendText(String.valueOf(map1.get("supplierNm")));
@ -660,10 +653,10 @@ if (pMap!=null&&pMap.size()>0){
DocPicture pic = paragraph.appendPicture((String) map2.get("filePath"));
if (map2.get("width") != null) {
pic.setWidth(Float.valueOf(String.valueOf(map2.get("width")+"f")));
pic.setWidth(Float.valueOf(map2.get("width") + "f"));
}
if (map2.get("height") != null) {
pic.setHeight(Float.valueOf(String.valueOf(map2.get("height")+"f")));
pic.setHeight(Float.valueOf(map2.get("height") + "f"));
}
}
}
@ -671,8 +664,8 @@ if (pMap!=null&&pMap.size()>0){
}
//生成word文档
document.saveToFile(templateFilePath + "doc.docx", FileFormat.Docx_2013);
map.put("settlementSum",settlementSum.setScale(2,BigDecimal.ROUND_HALF_DOWN).toString());
map.put("amountSum",amountSum.setScale(2,BigDecimal.ROUND_HALF_DOWN).toString() );
map.put("settlementSum", settlementSum.setScale(2, RoundingMode.HALF_DOWN).toString());
map.put("amountSum", amountSum.setScale(2, RoundingMode.HALF_DOWN).toString());
map.put("reportList", list);
//repotData自己加测试数据
@ -698,7 +691,6 @@ if (pMap!=null&&pMap.size()>0){
}
//"attachment; filename=" + new String(fileName.getBytes("gbk"), StandardCharsets.ISO_8859_1));
} catch (Exception e) {
log.error("导出pdf失败:{}", e);
@ -952,6 +944,7 @@ if (pMap!=null&&pMap.size()>0){
return purchaseorderPagination.setData(list, list.size());
}*/
}
@Override
public List<PurchaseorderitemEntity> getTypeList(PurchaseorderPagination purchaseorderPagination, String dataType) {
String userId = userProvider.get().getUserId();
@ -1094,7 +1087,7 @@ if (pMap!=null&&pMap.size()>0){
Field declaredField = purchaseorderitemEntity.getClass().getDeclaredField(sidx);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
purchaseorderQueryWrapper="asc".equals(purchaseorderPagination.getSort().toLowerCase())?purchaseorderQueryWrapper.orderByAsc(value):purchaseorderQueryWrapper.orderByDesc(value);
purchaseorderQueryWrapper = "asc".equalsIgnoreCase(purchaseorderPagination.getSort()) ? purchaseorderQueryWrapper.orderByAsc(value) : purchaseorderQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
@ -1130,12 +1123,14 @@ if (pMap!=null&&pMap.size()>0){
entity.setId(id);
return this.updateById(entity);
}
@Override
public void delete(PurchaseorderitemEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
//子表方法
@Override
public List<Purchaseorder_item0Entity> GetPurchaseorder_item0List(String id) {
@ -1190,7 +1185,6 @@ if (pMap!=null&&pMap.size()>0){
public void getVehicle(List<HashMap<String, Object>> vehicleInfo, String templateFilePath) throws Exception {
// BufferedInputStream input = null;
// BufferedOutputStream out = null;
try{
if (vehicleInfo != null && vehicleInfo.size() > 0) {
for (int i = 0; i < vehicleInfo.size(); i++) {
HashMap<String, Object> map = vehicleInfo.get(i);
@ -1229,15 +1223,6 @@ if (pMap!=null&&pMap.size()>0){
}
}
}
}finally {
// if (input!=null){
// input.close();
// }
// if (out!=null){
// out.close();
// }
}
}
@ -1286,12 +1271,9 @@ if (pMap!=null&&pMap.size()>0){
}
}
}
@Override
@ -1302,6 +1284,9 @@ if (pMap!=null&&pMap.size()>0){
for (int i = 0; i < purchaseorderList.size(); i++) {
Map<String, Object> dataRowMap = new HashMap<>();
PurchaseorderDTO model = purchaseorderList.get(i);
if (model.getPoundDate()==null){
}else {
dataRowMap.put("poundDate", model.getPoundDate());
dataRowMap.put("vehicleId", model.getVehicleId());
dataRowMap.put("materialId", model.getMaterialId());
@ -1311,7 +1296,7 @@ if (pMap!=null&&pMap.size()>0){
dataRowMap.put("buckleWeight", model.getBuckleWeight());
dataRowMap.put("netWeight", model.getNetWeight());
dataRowMap.put("settlement", model.getSettlement());
dataRowMap.put("imgPicturess", model.getPoundPictures());
dataRowMap.put("poundPictures", model.getPoundPictures());
dataRowMap.put("advance", model.getAdvance());
dataRowMap.put("naturalId", model.getNaturalId());
dataRowMap.put("purchasePrice", model.getPurchasePrice());
@ -1323,8 +1308,11 @@ if (pMap!=null&&pMap.size()>0){
dataRowMap.put("salesId", model.getSalesId());
dataRowMap.put("purchaseId", model.getPurchaseId());
dataRowMap.put("customerId", model.getCustomerId());
dataRowMap.put("carPictures", model.getCarPictures());
dataRow.add(dataRowMap);
}
}
for (int i = 1; i <= 23; i++) {
Map<String, Object> columnsMap = new HashMap<>();
columnsMap.put("AllowDBNull", true);
@ -1360,6 +1348,7 @@ if (pMap!=null&&pMap.size()>0){
/**
*
*
* @param dataList
* @return
*/
@ -1373,14 +1362,17 @@ if (pMap!=null&&pMap.size()>0){
List<PurchaseorderDTO> errList = new ArrayList<>();
int num1 = dataList.size();
ArrayList<Integer> ints = new ArrayList<>();
// 进行编码id的转换
for (int i = 0; i < num1; i++) {
PurchaseorderDTO model = dataList.get(i);
// 收获日期
if (model.getPoundDate() != null && !model.getPoundDate().isEmpty() && !model.getPoundDate().equals("null")) {
// model.setCreatorTime(DateUtil.cstFormat(model.getCreatorTime()));
Date date = new SimpleDateFormat("yyyy.MM.dd").parse(model.getPoundDate());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
model.setPoundDate(formatter.format(date));
// 单位
if (model.getUnit() != null) {
if (model.getUnit().equals("吨") || model.getUnit().equals("T")) {
model.setUnit("0");
@ -1389,6 +1381,7 @@ if (pMap!=null&&pMap.size()>0){
model.setUnit("1");
}
}
// 是否垫资
if (model.getAdvance() != null) {
if (model.getAdvance().equals("是")) {
model.setAdvance("1");
@ -1397,20 +1390,21 @@ if (pMap!=null&&pMap.size()>0){
model.setAdvance("0");
}
}
// 送货车号
if (model.getVehicleId() != null) {
LambdaQueryWrapper<VehicleEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(VehicleEntity::getTicketno, model.getVehicleId());
List<VehicleEntity> vehicleEntityList = vehicleMapper.selectList(wrapper);
if (vehicleEntityList != null && vehicleEntityList.size() > 0) {
model.setVehicleId(vehicleEntityList.get(0).getId());
}
else {
} else {
model.setCauseError("车牌号不存在!请添加车辆信息在尝试添加!");
errList.add(model);
ints.add(i);
continue;
}
}
// 货物
if (model.getMaterialId() != null) {
LambdaQueryWrapper<MaterialEntity> wrapper = new LambdaQueryWrapper<MaterialEntity>();
wrapper.eq(MaterialEntity::getItemName, model.getMaterialId());
@ -1424,6 +1418,7 @@ if (pMap!=null&&pMap.size()>0){
continue;
}
}
// 业务员2
if (model.getNaturalId() != null) {
LambdaQueryWrapper<Jg_naturalEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Jg_naturalEntity::getName, model.getNaturalId());
@ -1431,12 +1426,13 @@ if (pMap!=null&&pMap.size()>0){
if (naturalEntityList != null && naturalEntityList.size() > 0) {
model.setNaturalId(naturalEntityList.get(0).getId());
} else {
model.setCauseError("自然人信息不存在!请添加自然人信息后尝试添加!");
model.setCauseError("业务员2信息不存在请添加业务员2信息后尝试添加!");
errList.add(model);
ints.add(i);
continue;
}
}
// 客户
if (model.getCustomerId() != null) {
LambdaQueryWrapper<CustomerEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CustomerEntity::getSupplierNm, model.getCustomerId());
@ -1450,6 +1446,7 @@ if (pMap!=null&&pMap.size()>0){
continue;
}
}
// 采购合同编码
if (model.getPurchaseId() != null) {
LambdaQueryWrapper<PurchaseorderitemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PurchaseorderitemEntity::getDocumentNo, model.getPurchaseId());
@ -1463,6 +1460,7 @@ if (pMap!=null&&pMap.size()>0){
continue;
}
}
// 销售合同编码
if (model.getSalesId() != null) {
LambdaQueryWrapper<SaleorderitemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SaleorderitemEntity::getDocumentNo, model.getSalesId());
@ -1472,10 +1470,12 @@ if (pMap!=null&&pMap.size()>0){
} else {
model.setCauseError("销售合同不存在!请添加销售合同后尝试添加!");
errList.add(model);
ints.add(i);
continue;
}
}
// 起始地
if (model.getOriginPrice() != null) {
// 区域转换
LambdaQueryWrapper<ProvinceEntity> wrapper = new LambdaQueryWrapper<>();
@ -1525,11 +1525,13 @@ if (pMap!=null&&pMap.size()>0){
errList.add(model);
}
}
// 错误信息
ArrayList<PurchaseorderDTO> dtos = new ArrayList<>();
for (int i = 0; i < ints.size(); i++) {
Integer integer = ints.get(i);
dtos.add(dataList.get(integer));
}
// 移除错误的信息
for (int i = 0; i < dtos.size(); i++) {
PurchaseorderDTO purchaseorderDTO = dtos.get(i);
dataList.remove(purchaseorderDTO);
@ -1565,7 +1567,6 @@ if (dataList.size()>0){
//采购
for (int i = 0; i < dataList.size(); i++) {
PurchaseorderDTO model = dataList.get(i);
Purchaseorder_item0Entity item0 = new Purchaseorder_item0Entity();
Long aLong2 = new DefaultIdentifierGenerator().nextId(Purchaseorder_item0Entity.class);
@ -1585,9 +1586,9 @@ if (dataList.size()>0){
//rate税率默认为0 即13个点
item0.setRate("0");
//amount金额price*settlement保留6位小数
item0.setAmount(item0.getPrice().multiply(item0.getSettlement()).setScale(6,BigDecimal.ROUND_HALF_UP));
item0.setAmount(item0.getPrice().multiply(item0.getSettlement()).setScale(6, RoundingMode.HALF_UP));
//not_amount不含税金额price*settlement*(1 - 税率) 不含税价格为sum/1.13=price
item0.setNotAmount(item0.getAmount().divide(new BigDecimal(1+0.13)));
item0.setNotAmount(item0.getAmount().divide(BigDecimal.valueOf(1 + 0.13)));
//vehicle_id车辆id磅单c表车辆id
item0.setVehicleId(model.getVehicleId());
//material_id物料id磅单表物料id
@ -1644,7 +1645,6 @@ if (dataList.size()>0){
}
} else {
log.error("采购合同不存在!请添加后后重新添加!");
errList.addAll(dataList);
@ -1710,15 +1710,15 @@ if (dataList.size()>0){
map.put(8, "扣重");
map.put(9, "净重");
map.put(10, "结算重量");
map.put(11, "榜单图片");
map.put(12, "是否垫资");
map.put(13, "自然人");
map.put(14, "采购单价");
map.put(15, "销售单价");
map.put(16, "运费");
map.put(17, "起始地");
map.put(18, "备注");
map.put(19, "错误原因");
map.put(11, "是否垫资");
map.put(12, "自然人");
map.put(13, "采购单价");
map.put(14, "销售单价");
map.put(15, "运费");
map.put(16, "起始地");
map.put(17, "备注");
map.put(18, "错误原因");
map.put(19, "车辆图片地址");
map.put(20, "榜单图片地址");
map.put(21, "销售合同编码");
map.put(22, "采购合同编码");

Loading…
Cancel
Save