出库单导入;
This commit is contained in:
+162
-1
@@ -184,4 +184,165 @@ public class MaterialBaseInfo extends BaseVOEntity{
|
||||
@ApiModelProperty("整机编码")
|
||||
@Excel(name = "整机编号")
|
||||
private String machineCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
/**
|
||||
* 商品SKU码
|
||||
*/
|
||||
@ApiModelProperty("商品SKU码")
|
||||
@Excel(name = "商品SKU码")
|
||||
private String skucode;
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO’s")
|
||||
@Excel(name = "Batch Ref NO’s")
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO’s")
|
||||
@Excel(name = "Sheet Ref NO’s")
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
}
|
||||
+163
-1
@@ -182,4 +182,166 @@ public class MaterialBaseInfoPO extends BaseVOEntity{
|
||||
@Excel(name = "整机编号")
|
||||
private String machineCode;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
/**
|
||||
* 商品SKU码
|
||||
*/
|
||||
@ApiModelProperty("商品SKU码")
|
||||
@Excel(name = "商品SKU码")
|
||||
private String skucode;
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO’s")
|
||||
@Excel(name = "Batch Ref NO’s")
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO’s")
|
||||
@Excel(name = "Sheet Ref NO’s")
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
}
|
||||
+163
-1
@@ -203,4 +203,166 @@ public class MaterialBaseInfoDO extends BaseVOEntity{
|
||||
@ApiModelProperty("整机编码")
|
||||
@Excel(name = "整机编号")
|
||||
private String machineCode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
/**
|
||||
* 商品SKU码
|
||||
*/
|
||||
@ApiModelProperty("商品SKU码")
|
||||
@Excel(name = "商品SKU码")
|
||||
private String skucode;
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO’s")
|
||||
@Excel(name = "Batch Ref NO’s")
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO’s")
|
||||
@Excel(name = "Sheet Ref NO’s")
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
}
|
||||
+163
-1
@@ -181,4 +181,166 @@ public class MaterialBaseInfoDTO extends BaseVOEntity{
|
||||
@ApiModelProperty("是否公用: 1-是 2-否")
|
||||
@Excel(name = "是否公用: 1-是 2-否")
|
||||
private Integer common;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
/**
|
||||
* 商品SKU码
|
||||
*/
|
||||
@ApiModelProperty("商品SKU码")
|
||||
@Excel(name = "商品SKU码")
|
||||
private String skucode;
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO’s")
|
||||
@Excel(name = "Batch Ref NO’s")
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO’s")
|
||||
@Excel(name = "Sheet Ref NO’s")
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
}
|
||||
@@ -131,6 +131,13 @@
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- EasyExcel 解析Excel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mhd Api System-->
|
||||
<dependency>
|
||||
<groupId>com.mhd</groupId>
|
||||
|
||||
+4
-1
@@ -521,4 +521,7 @@ public class StockOutOrderApplicationService {
|
||||
outMaterialDetailDO.setContainerType(materialInventoryPO.getContainerType());
|
||||
outMaterialDetailDO.setContainerTypeName(materialInventoryPO.getContainerTypeName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+163
-1
@@ -222,4 +222,166 @@ public class OutMaterialDetail extends BaseVOEntity {
|
||||
@ApiModelProperty("越库类型:1-直接越库 2-分拨越库")
|
||||
@Excel(name = "越库类型:1-直接越库 2-分拨越库")
|
||||
private Long overStockType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
/**
|
||||
* 商品SKU码
|
||||
*/
|
||||
@ApiModelProperty("商品SKU码")
|
||||
@Excel(name = "商品SKU码")
|
||||
private String skucode;
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO’s")
|
||||
@Excel(name = "Batch Ref NO’s")
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO’s")
|
||||
@Excel(name = "Sheet Ref NO’s")
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
}
|
||||
+164
-1
@@ -238,4 +238,167 @@ public class OutMaterialDetailDO extends BaseVOEntity {
|
||||
@Excel(name = "作业数量(例如:分配数量 拣货数量 复核数量)")
|
||||
private BigDecimal actualQuantity;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
/**
|
||||
* 商品SKU码
|
||||
*/
|
||||
@ApiModelProperty("商品SKU码")
|
||||
@Excel(name = "商品SKU码")
|
||||
private String skucode;
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO’s")
|
||||
@Excel(name = "Batch Ref NO’s")
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO’s")
|
||||
@Excel(name = "Sheet Ref NO’s")
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
}
|
||||
@@ -262,4 +262,106 @@ public class StockOutOrder extends BaseVOEntity {
|
||||
@ApiModelProperty("越库类型:1-直接越库 2-分拨越库")
|
||||
@Excel(name = "越库类型:1-直接越库 2-分拨越库")
|
||||
private Long overStockType;
|
||||
}
|
||||
|
||||
@ApiModelProperty("to")
|
||||
@Excel(name = "to")
|
||||
private String to;
|
||||
|
||||
@ApiModelProperty("联系人")
|
||||
@Excel(name = "联系人")
|
||||
private String contactPerson;
|
||||
|
||||
@ApiModelProperty("车型及车牌")
|
||||
@Excel(name = "车型及车牌")
|
||||
private String vehicleModelPlate;
|
||||
|
||||
@ApiModelProperty("委托编号")
|
||||
@Excel(name = "委托编号")
|
||||
private String entrustNo;
|
||||
|
||||
@ApiModelProperty("Tel")
|
||||
@Excel(name = "Tel")
|
||||
private String tel;
|
||||
|
||||
@ApiModelProperty("司机签名")
|
||||
@Excel(name = "司机签名")
|
||||
private String driverSign;
|
||||
|
||||
@ApiModelProperty("Fax")
|
||||
@Excel(name = "Fax")
|
||||
private String fax;
|
||||
|
||||
@ApiModelProperty("申报地关区")
|
||||
@Excel(name = "申报地关区")
|
||||
private String declareCustoms;
|
||||
|
||||
@ApiModelProperty("生产商")
|
||||
@Excel(name = "生产商")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("报关员姓名及联系方式")
|
||||
@Excel(name = "报关员姓名及联系方式")
|
||||
private String customsDeclarerInfo;
|
||||
|
||||
@ApiModelProperty("送货地址")
|
||||
@Excel(name = "送货地址")
|
||||
private String deliveryAddr;
|
||||
|
||||
@ApiModelProperty("进出境关别")
|
||||
@Excel(name = "进出境关别")
|
||||
private String entryExitCustoms;
|
||||
|
||||
@ApiModelProperty("起运/运抵国(地区)")
|
||||
@Excel(name = "起运/运抵国(地区)")
|
||||
private String departureArrivalCountry;
|
||||
|
||||
@ApiModelProperty("承运商")
|
||||
@Excel(name = "承运商")
|
||||
private String carrier;
|
||||
|
||||
@ApiModelProperty("柜号")
|
||||
@Excel(name = "柜号")
|
||||
private String containerNo;
|
||||
|
||||
@ApiModelProperty("柜")
|
||||
@Excel(name = "柜")
|
||||
private String containerNoName;
|
||||
|
||||
@ApiModelProperty("出仓日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "出仓日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date outboundDate;
|
||||
@ApiModelProperty("完成时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date completeTime;
|
||||
@ApiModelProperty("orderDate")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "orderDate", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderDate;
|
||||
|
||||
@ApiModelProperty("运输方式")
|
||||
@Excel(name = "运输方式")
|
||||
private String transportModeCode;
|
||||
@ApiModelProperty("运输方式")
|
||||
@Excel(name = "运输方式")
|
||||
private String transportModeName;
|
||||
@ApiModelProperty("监管方式")
|
||||
@Excel(name = "监管方式")
|
||||
private String supervisionModeCode;
|
||||
@ApiModelProperty("监管方式")
|
||||
@Excel(name = "监管方式")
|
||||
private String supervisionModeName;
|
||||
@ApiModelProperty("海关是否查验货物")
|
||||
@Excel(name = "海关是否查验货物")
|
||||
private String customsInspectionFlag;
|
||||
@ApiModelProperty("是否需要报关")
|
||||
@Excel(name = "是否需要报关")
|
||||
private String needDeclareFlag;
|
||||
@ApiModelProperty("是否需要运输")
|
||||
@Excel(name = "是否需要运输")
|
||||
private String needTransportFlag;
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.mhd.wms.domain.stockOutOrder.repository.listener;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelReader;
|
||||
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
|
||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||
import com.mhd.wms.domain.stockOutOrder.entity.StockOutOrder;
|
||||
import com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Excel解析服务
|
||||
*/
|
||||
@Service
|
||||
public class ExcelParseService {
|
||||
|
||||
/**
|
||||
* 解析出仓委托单Excel
|
||||
* @param file 上传的Excel文件
|
||||
* @return 解析后的出仓委托单对象
|
||||
*/
|
||||
public StockOutOrderDO parseOutboundOrderExcel(MultipartFile file) throws IOException {
|
||||
// 1. 解析表头信息(前11行)
|
||||
HeaderListener headerListener = new HeaderListener();
|
||||
|
||||
// 读取前11行表头
|
||||
// 读取第一个sheet,只读前11行
|
||||
ReadSheet headerSheet = EasyExcel.readSheet(0)
|
||||
.headRowNumber(0)
|
||||
.build();
|
||||
|
||||
ExcelReader headerReader = EasyExcel.read(file.getInputStream())
|
||||
.autoCloseStream(false) // 不自动关闭流,因为后面还需要使用
|
||||
.registerReadListener(headerListener)
|
||||
.registerConverter(new NoConvertConverter()) // 注册自定义转换器
|
||||
.headRowNumber(0) // 从第0行开始读取表头
|
||||
.build();
|
||||
|
||||
// 通过监听器控制只读取前11行
|
||||
headerReader.read(headerSheet);
|
||||
|
||||
// 注意:这里不能关闭reader,因为后面还要用输入流
|
||||
|
||||
// 2. 解析商品明细(从第12行开始)
|
||||
// 重新获取输入流
|
||||
InputStream itemInputStream = file.getInputStream();
|
||||
ItemListener itemListener = new ItemListener();
|
||||
|
||||
// 商品明细需要跳过前11行,从第12行开始读取
|
||||
ExcelReader itemReader = EasyExcel.read(itemInputStream)
|
||||
.autoCloseStream(false) // 不自动关闭流
|
||||
.registerReadListener(itemListener)
|
||||
.registerConverter(new NoConvertConverter()) // 注册自定义转换器
|
||||
.headRowNumber(12) // 关键:设置headRowNumber为11,表示前11行是表头,从第12行开始读取数据
|
||||
.build();
|
||||
|
||||
ReadSheet itemSheet = EasyExcel.readSheet(0).build();
|
||||
itemReader.read(itemSheet);
|
||||
|
||||
// 关闭读取器
|
||||
itemReader.finish();
|
||||
|
||||
// 3. 组装完整的出仓委托单
|
||||
StockOutOrderDO stockOutOrder = headerListener.getStockOutOrder();
|
||||
stockOutOrder.setMaterialDetailList(itemListener.getItemList());
|
||||
|
||||
return stockOutOrder;
|
||||
}
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
package com.mhd.wms.domain.stockOutOrder.repository.listener;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.excel.metadata.data.ReadCellData;
|
||||
import com.mhd.wms.domain.stockOutOrder.entity.StockOutOrder;
|
||||
import com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 解析表头信息的监听器(处理前11行)
|
||||
*/
|
||||
@Getter
|
||||
public class HeaderListener extends AnalysisEventListener<Map<Integer, Object>> {
|
||||
private final StockOutOrderDO stockOutOrder = new StockOutOrderDO();
|
||||
private int rowNum = 0;
|
||||
private final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
@Override
|
||||
public void invoke(Map<Integer, Object> data, AnalysisContext context) {
|
||||
// 将Map<Integer, Object>转换为Map<Integer, String>
|
||||
Map<Integer, String> stringData = convertToStringMap(data);
|
||||
// 将Map转换为List再转为数组
|
||||
List<String> dataList = mapToList(stringData);
|
||||
Object[] rowData = listToArray(dataList);
|
||||
|
||||
// 根据行号提取对应信息
|
||||
switch (rowNum) {
|
||||
case 4: // 第5行:to、仓库联系人、车型及车牌、委托编码
|
||||
stockOutOrder.setTo(getStringValue(rowData[2]));
|
||||
stockOutOrder.setContactPerson(getStringValue(rowData[4]));
|
||||
stockOutOrder.setVehicleModelPlate(getStringValue(rowData[11]));
|
||||
stockOutOrder.setEntrustNo(getStringValue(rowData[15]));
|
||||
break;
|
||||
case 5: // 第6行:承运方、tel、柜号、司机签名
|
||||
stockOutOrder.setCarrier(getStringValue(rowData[2]));
|
||||
stockOutOrder.setTel(getStringValue(rowData[4]));
|
||||
stockOutOrder.setContainerNo(getStringValue(rowData[11]));
|
||||
stockOutOrder.setDriverSign(getStringValue(rowData[15]));
|
||||
break;
|
||||
case 6: // 第7行:出仓日期、fax、运输方式、申报地关区
|
||||
// 将LocalDate转换为Date
|
||||
LocalDate localDate = parseDate(getStringValue(rowData[2]));
|
||||
if (localDate != null) {
|
||||
Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
stockOutOrder.setOutboundDate(date);
|
||||
}
|
||||
stockOutOrder.setFax(getStringValue(rowData[4]));
|
||||
stockOutOrder.setTransportModeName(getStringValue(rowData[11]));
|
||||
stockOutOrder.setDeclareCustoms(getStringValue(rowData[15]));
|
||||
break;
|
||||
case 7: // 第8行:生产商、客户名称、报关姓名及联系方式、完成时间
|
||||
stockOutOrder.setManufacturer(getStringValue(rowData[2]));
|
||||
stockOutOrder.setCustomerName(getStringValue(rowData[4]));
|
||||
stockOutOrder.setCustomsDeclarerInfo(getStringValue(rowData[11]));
|
||||
LocalDate CompleteTime = parseDate(getStringValue(rowData[15]));
|
||||
if (CompleteTime != null) {
|
||||
Date date = Date.from(CompleteTime.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
stockOutOrder.setCompleteTime(date);
|
||||
}
|
||||
break;
|
||||
case 8: // 第9行:监管方式、送货地址、海关是否查验货物、进出境关别
|
||||
stockOutOrder.setSupervisionModeName(getStringValue(rowData[2]));
|
||||
stockOutOrder.setDeliveryAddr(getStringValue(rowData[4]));
|
||||
stockOutOrder.setCustomsInspectionFlag(getStringValue(rowData[11]));
|
||||
stockOutOrder.setEntryExitCustoms(getStringValue(rowData[15]));
|
||||
break;
|
||||
case 9: // 第10行:下单日期、起运国
|
||||
LocalDate orderDate = parseDate(getStringValue(rowData[2]));
|
||||
if (orderDate != null) {
|
||||
Date date = Date.from(orderDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
stockOutOrder.setOrderDate(date);
|
||||
}
|
||||
stockOutOrder.setDepartureArrivalCountry(getStringValue(rowData[4]));
|
||||
break;
|
||||
}
|
||||
rowNum++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
// 解析完成后的处理
|
||||
}
|
||||
|
||||
/**
|
||||
* 将List转换为数组
|
||||
*/
|
||||
private Object[] listToArray(List<String> list) {
|
||||
// 创建一个足够大的数组来容纳最多30列数据
|
||||
Object[] array = new Object[30];
|
||||
for (int i = 0; i < 30 && i < list.size(); i++) {
|
||||
array[i] = list.get(i);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Object的Map转换为String的Map
|
||||
*/
|
||||
private Map<Integer, String> convertToStringMap(Map<Integer, Object> dataMap) {
|
||||
if (dataMap == null) {
|
||||
return new java.util.HashMap<>();
|
||||
}
|
||||
|
||||
Map<Integer, String> stringMap = new java.util.HashMap<>();
|
||||
for (Map.Entry<Integer, Object> entry : dataMap.entrySet()) {
|
||||
Object value = entry.getValue();
|
||||
String stringValue = value != null ? value.toString() : "";
|
||||
stringMap.put(entry.getKey(), stringValue);
|
||||
}
|
||||
|
||||
return stringMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Map转换为List
|
||||
*/
|
||||
private List<String> mapToList(Map<Integer, String> map) {
|
||||
if (map == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 找到最大索引以确定列表大小
|
||||
int maxSize = map.keySet().stream().mapToInt(Integer::intValue).max().orElse(-1) + 1;
|
||||
maxSize = Math.max(maxSize, 30); // 至少30个位置
|
||||
|
||||
List<String> list = new ArrayList<>(Collections.nCopies(maxSize, ""));
|
||||
|
||||
for (Map.Entry<Integer, String> entry : map.entrySet()) {
|
||||
if (entry.getKey() >= 0 && entry.getKey() < maxSize) {
|
||||
String value = entry.getValue();
|
||||
list.set(entry.getKey(), value != null ? value : "");
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为字符串,处理null值
|
||||
*/
|
||||
private String getStringValue(Object value) {
|
||||
return value == null ? "" : value.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析日期
|
||||
*/
|
||||
private LocalDate parseDate(String dateStr) {
|
||||
if (dateStr == null || dateStr.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
// 处理Excel中的日期格式(如"2026-01-05 00:00:00")
|
||||
if (dateStr.contains(" ")) {
|
||||
dateStr = dateStr.split(" ")[0];
|
||||
}
|
||||
return LocalDate.parse(dateStr, dateFormatter);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+174
@@ -0,0 +1,174 @@
|
||||
package com.mhd.wms.domain.stockOutOrder.repository.listener;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.excel.metadata.data.ReadCellData;
|
||||
import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
|
||||
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
|
||||
import lombok.Getter;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 解析商品明细的监听器(从第12行开始)
|
||||
*/
|
||||
@Getter
|
||||
public class ItemListener extends AnalysisEventListener<Map<Integer, Object>> {
|
||||
private final List<OutMaterialDetailDO> itemList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void invoke(Map<Integer, Object> data, AnalysisContext context) {
|
||||
// 将Map<Integer, Object>转换为Map<Integer, String>
|
||||
Map<Integer, String> stringData = convertToStringMap(data);
|
||||
// 将Map转换为List再转为数组
|
||||
List<String> dataList = mapToList(stringData);
|
||||
Object[] rowData = listToArray(dataList);
|
||||
|
||||
// 提取序号(第一列),过滤空行和标题行
|
||||
String serialNoStr = getStringValue(rowData[0]);
|
||||
|
||||
if (serialNoStr.isEmpty() || "序号".equals(serialNoStr) || !isSequenceNumber(serialNoStr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
OutMaterialDetailDO item = new OutMaterialDetailDO();
|
||||
|
||||
// 填充商品明细数据
|
||||
//商品名称 规格型号/ITEM 商品SKU码 Invoice No. 申报数量 申报单位 升 箱数 件数 尺寸 仓库数量 "总净重
|
||||
//(KG)" 总毛重 (KG) "总体积
|
||||
//(CBM)" 总面积(SQM) Batch Ref NO's Sheet Ref NO's 原产国 箱号/卡板号 总价 币制 备注
|
||||
item.setCommodityName(getStringValue(rowData[1]));
|
||||
item.setSpecificationModel(getStringValue(rowData[2]));
|
||||
item.setSkucode(getStringValue(rowData[3]));
|
||||
item.setInvoiceNo(getStringValue(rowData[4]));
|
||||
item.setDeclareQuantity(parseBigDecimal(rowData[5]).doubleValue());
|
||||
item.setDeclareUnit(getStringValue(rowData[6]));
|
||||
item.setLiter(getStringValue(rowData[7]));
|
||||
item.setCaseCount(parseInteger(rowData[8]).doubleValue());
|
||||
item.setPieceCount(parseInteger(rowData[9]).doubleValue());
|
||||
item.setSize(getStringValue(rowData[10]));
|
||||
//仓库数量 出库数量?
|
||||
item.setOutboundQuantity(parseBigDecimal(rowData[11]).doubleValue());
|
||||
item.setTotalNetWeight(parseBigDecimal(rowData[12]).doubleValue());
|
||||
item.setTotalGrossWeight(parseBigDecimal(rowData[13]).doubleValue());
|
||||
item.setTotalVolume(parseBigDecimal(rowData[14]).doubleValue());
|
||||
item.setTotalArea(parseBigDecimal(rowData[15]).doubleValue());
|
||||
item.setBatchRefNo(getStringValue(rowData[16]));
|
||||
item.setSheetRefNo(getStringValue(rowData[17]));
|
||||
item.setCountryOfOrigin(getStringValue(rowData[18]));
|
||||
|
||||
item.setCasePalletNo(getStringValue(rowData[19]));
|
||||
item.setTotalAmount(parseBigDecimal(rowData[20]).doubleValue());
|
||||
item.setCurrency(getStringValue(rowData[21]));
|
||||
item.setRemark(getStringValue(rowData[22]));
|
||||
|
||||
itemList.add(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
// 解析完成后的处理
|
||||
}
|
||||
|
||||
/**
|
||||
* 将List转换为数组
|
||||
*/
|
||||
private Object[] listToArray(List<String> list) {
|
||||
// 创建一个足够大的数组来容纳最多30列数据
|
||||
Object[] array = new Object[30];
|
||||
for (int i = 0; i < 30 && i < list.size(); i++) {
|
||||
array[i] = list.get(i);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Object的Map转换为String的Map
|
||||
*/
|
||||
private Map<Integer, String> convertToStringMap(Map<Integer, Object> dataMap) {
|
||||
if (dataMap == null) {
|
||||
return new java.util.HashMap<>();
|
||||
}
|
||||
|
||||
Map<Integer, String> stringMap = new java.util.HashMap<>();
|
||||
for (Map.Entry<Integer, Object> entry : dataMap.entrySet()) {
|
||||
Object value = entry.getValue();
|
||||
String stringValue = value != null ? value.toString() : "";
|
||||
stringMap.put(entry.getKey(), stringValue);
|
||||
}
|
||||
|
||||
return stringMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Map转换为List
|
||||
*/
|
||||
private List<String> mapToList(Map<Integer, String> map) {
|
||||
if (map == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 找到最大索引以确定列表大小
|
||||
int maxSize = map.keySet().stream().mapToInt(Integer::intValue).max().orElse(-1) + 1;
|
||||
maxSize = Math.max(maxSize, 30); // 至少30个位置
|
||||
|
||||
List<String> list = new ArrayList<>(Collections.nCopies(maxSize, ""));
|
||||
|
||||
for (Map.Entry<Integer, String> entry : map.entrySet()) {
|
||||
if (entry.getKey() >= 0 && entry.getKey() < maxSize) {
|
||||
String value = entry.getValue();
|
||||
list.set(entry.getKey(), value != null ? value : "");
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private String getStringValue(Object value) {
|
||||
return value == null ? "" : value.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析整数,失败返回0
|
||||
*/
|
||||
private Integer parseInteger(Object value) {
|
||||
try {
|
||||
String strValue = getStringValue(value);
|
||||
if (strValue.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
return Integer.parseInt(strValue);
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析BigDecimal,失败返回0
|
||||
*/
|
||||
private BigDecimal parseBigDecimal(Object value) {
|
||||
try {
|
||||
String strValue = getStringValue(value);
|
||||
if (strValue.isEmpty()) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return new BigDecimal(strValue);
|
||||
} catch (Exception e) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isSequenceNumber(String str) {
|
||||
if (str == null || str.trim().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
str = str.trim();
|
||||
|
||||
return str.matches("^[1-9]\\d*$") || str.matches("^[1-9]\\d*\\.\\d+$") || str.matches("^0\\.\\d+$");
|
||||
}
|
||||
}
|
||||
+104
-1
@@ -290,4 +290,107 @@ public class StockOutOrderDO extends BaseVOEntity {
|
||||
@ApiModelProperty("小于复核状态: 1-未复核 2-复核中 3-已复核")
|
||||
private Integer ltCheckStatus;
|
||||
|
||||
}
|
||||
|
||||
@ApiModelProperty("to")
|
||||
@Excel(name = "to")
|
||||
private String to;
|
||||
|
||||
@ApiModelProperty("联系人")
|
||||
@Excel(name = "联系人")
|
||||
private String contactPerson;
|
||||
|
||||
@ApiModelProperty("车型及车牌")
|
||||
@Excel(name = "车型及车牌")
|
||||
private String vehicleModelPlate;
|
||||
|
||||
@ApiModelProperty("委托编号")
|
||||
@Excel(name = "委托编号")
|
||||
private String entrustNo;
|
||||
|
||||
@ApiModelProperty("Tel")
|
||||
@Excel(name = "Tel")
|
||||
private String tel;
|
||||
|
||||
@ApiModelProperty("司机签名")
|
||||
@Excel(name = "司机签名")
|
||||
private String driverSign;
|
||||
|
||||
@ApiModelProperty("Fax")
|
||||
@Excel(name = "Fax")
|
||||
private String fax;
|
||||
|
||||
@ApiModelProperty("申报地关区")
|
||||
@Excel(name = "申报地关区")
|
||||
private String declareCustoms;
|
||||
|
||||
@ApiModelProperty("生产商")
|
||||
@Excel(name = "生产商")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("报关员姓名及联系方式")
|
||||
@Excel(name = "报关员姓名及联系方式")
|
||||
private String customsDeclarerInfo;
|
||||
|
||||
@ApiModelProperty("送货地址")
|
||||
@Excel(name = "送货地址")
|
||||
private String deliveryAddr;
|
||||
|
||||
@ApiModelProperty("进出境关别")
|
||||
@Excel(name = "进出境关别")
|
||||
private String entryExitCustoms;
|
||||
|
||||
@ApiModelProperty("起运/运抵国(地区)")
|
||||
@Excel(name = "起运/运抵国(地区)")
|
||||
private String departureArrivalCountry;
|
||||
|
||||
@ApiModelProperty("承运商")
|
||||
@Excel(name = "承运商")
|
||||
private String carrier;
|
||||
|
||||
@ApiModelProperty("柜号")
|
||||
@Excel(name = "柜号")
|
||||
private String containerNo;
|
||||
|
||||
@ApiModelProperty("柜")
|
||||
@Excel(name = "柜")
|
||||
private String containerNoName;
|
||||
|
||||
@ApiModelProperty("出仓日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "出仓日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date outboundDate;
|
||||
@ApiModelProperty("完成时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date completeTime;
|
||||
@ApiModelProperty("orderDate")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "orderDate", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderDate;
|
||||
|
||||
@ApiModelProperty("运输方式")
|
||||
@Excel(name = "运输方式")
|
||||
private String transportModeCode;
|
||||
@ApiModelProperty("运输方式")
|
||||
@Excel(name = "运输方式")
|
||||
private String transportModeName;
|
||||
@ApiModelProperty("监管方式")
|
||||
@Excel(name = "监管方式")
|
||||
private String supervisionModeCode;
|
||||
@ApiModelProperty("监管方式")
|
||||
@Excel(name = "监管方式")
|
||||
private String supervisionModeName;
|
||||
@ApiModelProperty("海关是否查验货物")
|
||||
@Excel(name = "海关是否查验货物")
|
||||
private String customsInspectionFlag;
|
||||
@ApiModelProperty("是否需要报关")
|
||||
@Excel(name = "是否需要报关")
|
||||
private String needDeclareFlag;
|
||||
@ApiModelProperty("是否需要运输")
|
||||
@Excel(name = "是否需要运输")
|
||||
private String needTransportFlag;
|
||||
|
||||
}
|
||||
+104
-1
@@ -277,4 +277,107 @@ public class StockOutOrderDTO extends StockOutOrderBaseDTO {
|
||||
|
||||
@ApiModelProperty("小于复核状态: 1-未复核 2-复核中 3-已复核")
|
||||
private Integer ltCheckStatus;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty("to")
|
||||
@Excel(name = "to")
|
||||
private String to;
|
||||
|
||||
@ApiModelProperty("联系人")
|
||||
@Excel(name = "联系人")
|
||||
private String contactPerson;
|
||||
|
||||
@ApiModelProperty("车型及车牌")
|
||||
@Excel(name = "车型及车牌")
|
||||
private String vehicleModelPlate;
|
||||
|
||||
@ApiModelProperty("委托编号")
|
||||
@Excel(name = "委托编号")
|
||||
private String entrustNo;
|
||||
|
||||
@ApiModelProperty("Tel")
|
||||
@Excel(name = "Tel")
|
||||
private String tel;
|
||||
|
||||
@ApiModelProperty("司机签名")
|
||||
@Excel(name = "司机签名")
|
||||
private String driverSign;
|
||||
|
||||
@ApiModelProperty("Fax")
|
||||
@Excel(name = "Fax")
|
||||
private String fax;
|
||||
|
||||
@ApiModelProperty("申报地关区")
|
||||
@Excel(name = "申报地关区")
|
||||
private String declareCustoms;
|
||||
|
||||
@ApiModelProperty("生产商")
|
||||
@Excel(name = "生产商")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("报关员姓名及联系方式")
|
||||
@Excel(name = "报关员姓名及联系方式")
|
||||
private String customsDeclarerInfo;
|
||||
|
||||
@ApiModelProperty("送货地址")
|
||||
@Excel(name = "送货地址")
|
||||
private String deliveryAddr;
|
||||
|
||||
@ApiModelProperty("进出境关别")
|
||||
@Excel(name = "进出境关别")
|
||||
private String entryExitCustoms;
|
||||
|
||||
@ApiModelProperty("起运/运抵国(地区)")
|
||||
@Excel(name = "起运/运抵国(地区)")
|
||||
private String departureArrivalCountry;
|
||||
|
||||
@ApiModelProperty("承运商")
|
||||
@Excel(name = "承运商")
|
||||
private String carrier;
|
||||
|
||||
@ApiModelProperty("柜号")
|
||||
@Excel(name = "柜号")
|
||||
private String containerNo;
|
||||
|
||||
@ApiModelProperty("柜")
|
||||
@Excel(name = "柜")
|
||||
private String containerNoName;
|
||||
|
||||
@ApiModelProperty("出仓日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "出仓日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date outboundDate;
|
||||
@ApiModelProperty("完成时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date completeTime;
|
||||
@ApiModelProperty("orderDate")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "orderDate", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderDate;
|
||||
|
||||
@ApiModelProperty("运输方式")
|
||||
@Excel(name = "运输方式")
|
||||
private String transportModeCode;
|
||||
@ApiModelProperty("运输方式")
|
||||
@Excel(name = "运输方式")
|
||||
private String transportModeName;
|
||||
@ApiModelProperty("监管方式")
|
||||
@Excel(name = "监管方式")
|
||||
private String supervisionModeCode;
|
||||
@ApiModelProperty("监管方式")
|
||||
@Excel(name = "监管方式")
|
||||
private String supervisionModeName;
|
||||
@ApiModelProperty("海关是否查验货物")
|
||||
@Excel(name = "海关是否查验货物")
|
||||
private String customsInspectionFlag;
|
||||
@ApiModelProperty("是否需要报关")
|
||||
@Excel(name = "是否需要报关")
|
||||
private String needDeclareFlag;
|
||||
@ApiModelProperty("是否需要运输")
|
||||
@Excel(name = "是否需要运输")
|
||||
private String needTransportFlag;
|
||||
}
|
||||
+36
-1
@@ -5,15 +5,20 @@ import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.wms.application.service.stockOutOrder.StockOutOrderApplicationService;
|
||||
import com.mhd.wms.domain.stockOutOrder.repository.listener.ExcelParseService;
|
||||
import com.mhd.wms.domain.stockOutOrder.repository.po.StockOutOrderPO;
|
||||
import com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO;
|
||||
import com.mhd.wms.interfaces.assember.stockOutOrder.StockOutOrderAssembler;
|
||||
import com.mhd.wms.interfaces.dto.stockOutOrder.StockOutOrderDTO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -45,6 +50,36 @@ public class StockOutOrderApi extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ExcelParseService excelParseService;
|
||||
|
||||
/**
|
||||
* 上传并解析出仓委托单Excel
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public ResponseEntity<StockOutOrderDO> parseOutboundOrder(
|
||||
@RequestParam("file") MultipartFile file) {
|
||||
|
||||
// 验证文件
|
||||
if (file.isEmpty()) {
|
||||
return ResponseEntity.badRequest().body(null);
|
||||
}
|
||||
|
||||
// 验证文件类型
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (fileName == null || !fileName.endsWith(".xls") && !fileName.endsWith(".xlsx")) {
|
||||
return ResponseEntity.status(HttpStatus.UNSUPPORTED_MEDIA_TYPE).body(null);
|
||||
}
|
||||
|
||||
try {
|
||||
// 解析Excel并返回结果
|
||||
StockOutOrderDO result = excelParseService.parseOutboundOrderExcel(file);
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (IOException e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑出库单
|
||||
*/
|
||||
@@ -230,4 +265,4 @@ public class StockOutOrderApi extends BaseController {
|
||||
return toAjax(stockOutOrderApplicationService.close(stockOutOrderDO));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user