|
@@ -4043,7 +4043,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
@Override
|
|
|
public AjaxResult importLibraryInformation(MultipartFile file) {
|
|
|
List<TWarehousebillsitems> itemList = new ArrayList<>();
|
|
|
-
|
|
|
InputStream inputStream = null;
|
|
|
try {
|
|
|
inputStream = file.getInputStream();
|
|
@@ -4053,6 +4052,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
workbook = WorkbookFactory.create(inputStream);
|
|
|
} else if (originalFilename.endsWith("xlsx")) {
|
|
|
workbook = new XSSFWorkbook(inputStream);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error("文件后缀异常");
|
|
|
}
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
int line = 0;
|
|
@@ -4069,59 +4070,38 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
case "箱号":
|
|
|
//设置单元格类型
|
|
|
cell.setCellType(CellType.STRING);
|
|
|
- if (StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
|
- return AjaxResult.error("Excel箱信息数据第" + line + "行数据缺少箱号");
|
|
|
+ if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
|
|
|
+ warehousebillsitems.setfCntrno(cell.getStringCellValue());
|
|
|
}
|
|
|
- warehousebillsitems.setfCntrno(cell.getStringCellValue());
|
|
|
break;
|
|
|
- /*case "铅封号":
|
|
|
+ case "铅封号":
|
|
|
//设置单元格类型
|
|
|
cell.setCellType(CellType.STRING);
|
|
|
- if (StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
|
- return AjaxResult.error("Excel箱信息数据第" + line + "箱类型");
|
|
|
- }
|
|
|
- companyMsg.setTypeidName(cell.getStringCellValue());
|
|
|
if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
|
|
|
- Long fId = tCntrMapper.selectRcntrFId(companyMsg.getTypeidName());
|
|
|
- companyMsg.setfTypeid(fId);
|
|
|
+ warehousebillsitems.setfSealno(cell.getStringCellValue());
|
|
|
}
|
|
|
break;
|
|
|
case "预计件数":
|
|
|
//设置单元格类型
|
|
|
cell.setCellType(CellType.STRING);
|
|
|
- if (StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
|
- return AjaxResult.error("Excel箱信息数据第" + line + "行数据缺少最新地点");
|
|
|
+ if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
|
|
|
+ warehousebillsitems.setfPlanqty(Long.valueOf(cell.getStringCellValue()));
|
|
|
}
|
|
|
- companyMsg.setAddressName((cell.getStringCellValue()));
|
|
|
break;
|
|
|
case "预计毛重":
|
|
|
//设置单元格类型
|
|
|
cell.setCellType(CellType.STRING);
|
|
|
- if (StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
|
- return AjaxResult.error("Excel箱信息数据第" + line + "行数据缺少货名");
|
|
|
- }
|
|
|
- companyMsg.setOwnerName(cell.getStringCellValue());
|
|
|
if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
|
|
|
- String fPackageid = sysDictDataMapper.selectDictValue("f_owner", cell.getStringCellValue());
|
|
|
- if (StringUtils.isNotEmpty(fPackageid)) {
|
|
|
- companyMsg.setfOwner(fPackageid);
|
|
|
- }
|
|
|
+ warehousebillsitems.setfPlangrossweight(new BigDecimal(cell.getStringCellValue()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
}
|
|
|
break;
|
|
|
case "预计净重":
|
|
|
//设置单元格类型
|
|
|
cell.setCellType(CellType.STRING);
|
|
|
- if (StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
|
- return AjaxResult.error("Excel箱信息数据第" + line + "行数据缺少箱状态");
|
|
|
- }
|
|
|
- companyMsg.setCntrstatusName(cell.getStringCellValue());
|
|
|
if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
|
|
|
- String setCntrstatusid = sysDictDataMapper.selectDictValue("f_cntrstatus", cell.getStringCellValue());
|
|
|
- if (StringUtils.isNotEmpty(setCntrstatusid)) {
|
|
|
- companyMsg.setfCntrstatus(setCntrstatusid);
|
|
|
- }
|
|
|
+ warehousebillsitems.setfPlannetweight(new BigDecimal(cell.getStringCellValue()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
}
|
|
|
- break;*/
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
itemList.add(warehousebillsitems);
|
|
@@ -4129,7 +4109,34 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
} catch (IOException e) {
|
|
|
return AjaxResult.error("上传文件失败,请检查文件是否损坏");
|
|
|
}
|
|
|
- return AjaxResult.success("success", itemList);
|
|
|
+ String errinfo = "";
|
|
|
+ int line = 1;
|
|
|
+ for (TWarehousebillsitems li : itemList) {
|
|
|
+ if (StringUtils.isEmpty(li.getfCntrno())) {
|
|
|
+ errinfo = errinfo + "第" + line + "行箱号为空,";
|
|
|
+ }
|
|
|
+ if (StringUtils.isNull(li.getfPlanqty())) {
|
|
|
+ errinfo = errinfo + "第" + line + "行预计件数为空,";
|
|
|
+ } else {
|
|
|
+ li.setfQty(li.getfPlanqty());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNull(li.getfPlangrossweight())) {
|
|
|
+ errinfo = errinfo + "第" + line + "行预计毛重为空,";
|
|
|
+ } else {
|
|
|
+ li.setfGrossweight(li.getfPlangrossweight());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNull(li.getfPlannetweight())) {
|
|
|
+ errinfo = errinfo + "第" + line + "行预计净重为空,";
|
|
|
+ } else {
|
|
|
+ li.setfNetweight(li.getfPlannetweight());
|
|
|
+ }
|
|
|
+ line++;
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(errinfo)) {
|
|
|
+ return AjaxResult.success("success", itemList);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error(errinfo, itemList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|