Merge branch 'dev_qinhongzhanWMS' into wms_dev
This commit is contained in:
+60
@@ -1,5 +1,6 @@
|
||||
package com.mhd.wms.domain.pickingMaterialDetail.repository.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
@@ -10,7 +11,11 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -198,4 +203,59 @@ public class PickingMaterialDetailPO extends BaseVOEntity {
|
||||
@ApiModelProperty("物料更多属性列表(批次属性)")
|
||||
private List<MaterialMoreDetailPO> materialMoreDetailList;
|
||||
|
||||
@ApiModelProperty("Invoice No.")
|
||||
@Excel(name = "Invoice No.")
|
||||
@TableField(exist = false)
|
||||
private String invoiceNo;
|
||||
|
||||
@ApiModelProperty("Batch Ref NO's")
|
||||
@Excel(name = "Batch Ref NO's")
|
||||
private String batchRefNo;
|
||||
|
||||
@ApiModelProperty("Sheet Ref NO's")
|
||||
@Excel(name = "Sheet Ref NO's")
|
||||
private String sheetRefNo;
|
||||
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String boxPalletNo;
|
||||
|
||||
@ApiModelProperty("扩展字段1")
|
||||
@Excel(name = "扩展字段1")
|
||||
private String extAttr1;
|
||||
|
||||
@ApiModelProperty("扩展字段2")
|
||||
@Excel(name = "扩展字段2")
|
||||
private String extAttr2;
|
||||
|
||||
@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 productionDate;
|
||||
|
||||
@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 expiryDate;
|
||||
|
||||
@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 inventoryDate;
|
||||
|
||||
@ApiModelProperty("ExtAttr3")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date extAttr3;
|
||||
|
||||
@ApiModelProperty("ExtAttr4")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date extAttr4;
|
||||
|
||||
}
|
||||
|
||||
+11
@@ -32,6 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -104,6 +105,16 @@ public class ExcelParseService {
|
||||
stockOutOrder.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
}
|
||||
initParam(stockOutOrder);
|
||||
//设置创建时间和创建人信息
|
||||
if (loginUser != null) {
|
||||
stockOutOrder.setCreateBy(loginUser.getUserid());
|
||||
stockOutOrder.setCreateByName(loginUser.getUsername());
|
||||
stockOutOrder.setCreateTime(new Date());
|
||||
stockOutOrder.setUpdateBy(loginUser.getUserid());
|
||||
stockOutOrder.setUpdateByName(loginUser.getUsername());
|
||||
stockOutOrder.setUpdateTime(new Date());
|
||||
stockOutOrder.setDelFlag(1);
|
||||
}
|
||||
//校验必填字段
|
||||
StringBuilder errorMsg = check(stockOutOrder);
|
||||
if (errorMsg.length() > 0) {
|
||||
|
||||
+115
-2
@@ -107,12 +107,72 @@ public class ItemListener extends AnalysisEventListener<Map<Integer, Object>> {
|
||||
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() : "";
|
||||
String stringValue = convertToString(value);
|
||||
stringMap.put(entry.getKey(), stringValue);
|
||||
}
|
||||
|
||||
return stringMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Object转换为String,处理BigDecimal等数字类型,去除小数点后的零
|
||||
*/
|
||||
private String convertToString(Object value) {
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 如果是BigDecimal类型,需要特殊处理,去除小数点后的零
|
||||
if (value instanceof BigDecimal) {
|
||||
BigDecimal bd = (BigDecimal) value;
|
||||
// 如果小数部分为0,转换为整数形式
|
||||
if (bd.scale() > 0 && bd.stripTrailingZeros().scale() <= 0) {
|
||||
return String.valueOf(bd.longValue());
|
||||
}
|
||||
// 否则去除尾部零
|
||||
return bd.stripTrailingZeros().toPlainString();
|
||||
}
|
||||
|
||||
// 如果是Double或Float类型,也需要处理
|
||||
if (value instanceof Double) {
|
||||
Double d = (Double) value;
|
||||
if (d == d.longValue()) {
|
||||
return String.valueOf(d.longValue());
|
||||
}
|
||||
return d.toString();
|
||||
}
|
||||
|
||||
if (value instanceof Float) {
|
||||
Float f = (Float) value;
|
||||
if (f == f.longValue()) {
|
||||
return String.valueOf(f.longValue());
|
||||
}
|
||||
return f.toString();
|
||||
}
|
||||
|
||||
// 如果是String类型,检查是否是数字字符串(如 "123.0"),去除小数点后的零
|
||||
if (value instanceof String) {
|
||||
String str = value.toString().trim();
|
||||
if (str.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
// 尝试解析为数字,如果是整数形式的小数(如 "123.0"),转换为整数
|
||||
try {
|
||||
BigDecimal bd = new BigDecimal(str);
|
||||
// 如果小数部分为0,转换为整数形式
|
||||
if (bd.scale() > 0 && bd.stripTrailingZeros().scale() <= 0) {
|
||||
return String.valueOf(bd.longValue());
|
||||
}
|
||||
// 否则去除尾部零
|
||||
return bd.stripTrailingZeros().toPlainString();
|
||||
} catch (NumberFormatException e) {
|
||||
// 不是数字字符串,直接返回
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
return value.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Map转换为List
|
||||
@@ -139,7 +199,60 @@ public class ItemListener extends AnalysisEventListener<Map<Integer, Object>> {
|
||||
}
|
||||
|
||||
private String getStringValue(Object value) {
|
||||
return value == null ? "" : value.toString().trim();
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 如果是BigDecimal类型,需要特殊处理,去除小数点后的零
|
||||
if (value instanceof BigDecimal) {
|
||||
BigDecimal bd = (BigDecimal) value;
|
||||
// 如果小数部分为0,转换为整数形式
|
||||
if (bd.scale() > 0 && bd.stripTrailingZeros().scale() <= 0) {
|
||||
return String.valueOf(bd.longValue());
|
||||
}
|
||||
// 否则去除尾部零
|
||||
return bd.stripTrailingZeros().toPlainString();
|
||||
}
|
||||
|
||||
// 如果是Double或Float类型,也需要处理
|
||||
if (value instanceof Double) {
|
||||
Double d = (Double) value;
|
||||
if (d == d.longValue()) {
|
||||
return String.valueOf(d.longValue());
|
||||
}
|
||||
return d.toString();
|
||||
}
|
||||
|
||||
if (value instanceof Float) {
|
||||
Float f = (Float) value;
|
||||
if (f == f.longValue()) {
|
||||
return String.valueOf(f.longValue());
|
||||
}
|
||||
return f.toString();
|
||||
}
|
||||
|
||||
// 如果是String类型,检查是否是数字字符串(如 "123.0"),去除小数点后的零
|
||||
if (value instanceof String) {
|
||||
String str = value.toString().trim();
|
||||
if (str.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
// 尝试解析为数字,如果是整数形式的小数(如 "123.0"),转换为整数
|
||||
try {
|
||||
BigDecimal bd = new BigDecimal(str);
|
||||
// 如果小数部分为0,转换为整数形式
|
||||
if (bd.scale() > 0 && bd.stripTrailingZeros().scale() <= 0) {
|
||||
return String.valueOf(bd.longValue());
|
||||
}
|
||||
// 否则去除尾部零
|
||||
return bd.stripTrailingZeros().toPlainString();
|
||||
} catch (NumberFormatException e) {
|
||||
// 不是数字字符串,直接返回
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
return value.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+13
@@ -37,6 +37,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="storageLocationCode" column="storage_location_code" />
|
||||
<result property="storageLocationName" column="storage_location_name" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="invoiceNo" column="INVOICE_NO" />
|
||||
<result property="batchRefNo" column="BATCH_REF_NO" />
|
||||
<result property="sheetRefNo" column="SHEET_REF_NO" />
|
||||
<result property="boxPalletNo" column="BOX_PALLET_NO" />
|
||||
<result property="extAttr1" column="EXT_ATTR_1" />
|
||||
<result property="extAttr2" column="EXT_ATTR_2" />
|
||||
<result property="productionDate" column="PRODUCTION_DATE" />
|
||||
<result property="expiryDate" column="EXPIRY_DATE" />
|
||||
<result property="inventoryDate" column="INVENTORY_DATE" />
|
||||
<result property="extAttr3" column="EXT_ATTR_3" />
|
||||
<result property="extAttr4" column="EXT_ATTR_4" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
@@ -55,6 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.material_inventory_id, a.batch_number, a.container_id, a.container_code, a.container_type, a.container_type_name, a.material_status_code, a.material_status_name,
|
||||
a.warehouse_id, a.warehouse_code, a.warehouse_name, a.storage_section_id, a.storage_code, a.storage_name,
|
||||
a.storage_location_id, a.storage_location_code, a.storage_location_name, a.remark,
|
||||
a.INVOICE_NO, a.BATCH_REF_NO, a.SHEET_REF_NO, a.BOX_PALLET_NO, a.EXT_ATTR_1, a.EXT_ATTR_2,
|
||||
a.PRODUCTION_DATE, a.EXPIRY_DATE, a.INVENTORY_DATE, a.EXT_ATTR_3, a.EXT_ATTR_4,
|
||||
a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
|
||||
</sql>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user