Merge branch 'dev_wkx_wms_20260120' into wms_dev

This commit is contained in:
王奎兴
2026-01-23 15:34:45 +08:00
17 changed files with 507 additions and 94 deletions
@@ -72,14 +72,14 @@ public class StockOutOrderApplicationService {
public List<StockOutOrderPO> queryList(StockOutOrderDO stockOutOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
/*if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
stockOutOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
stockOutOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}*/
return stockOutOrderDomainService.queryList(stockOutOrderDO);
}
@@ -89,13 +89,13 @@ public class StockOutOrderApplicationService {
*/
public Boolean insert(StockOutOrderDO stockOutOrderDO) {
//设置仓库
setWarehouseInfo(stockOutOrderDO);
//setWarehouseInfo(stockOutOrderDO);
//设置货主信息
shipperParam(stockOutOrderDO);
//shipperParam(stockOutOrderDO);
//设置客户信息
customerParam(stockOutOrderDO);
//customerParam(stockOutOrderDO);
//设置数据字典键值
setDataDict(stockOutOrderDO);
//setDataDict(stockOutOrderDO);
return stockOutOrderDomainService.insert(stockOutOrderDO);
}
@@ -129,5 +129,23 @@ public class MaterialInventory extends BaseVOEntity {
@Excel(name = "盘点是否可用:0-禁用 1-可用")
private Integer isAble;
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
}
@ApiModelProperty("净重(KG)")
@Excel(name = "净重(KG)")
private BigDecimal netWeight;
@ApiModelProperty("毛重(KG)")
@Excel(name = "毛重(KG)")
private BigDecimal grossWeight;
@ApiModelProperty("体积")
@Excel(name = "体积")
private BigDecimal volume;
@ApiModelProperty("面积")
@Excel(name = "面积")
private BigDecimal area;
}
@@ -127,4 +127,25 @@ public class MaterialInventoryPO extends MaterialBasePO {
@ApiModelProperty("盘点是否可用:0-禁用 1-可用")
@Excel(name = "盘点是否可用:0-禁用 1-可用")
private Integer isAble;
}
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
@ApiModelProperty("净重(KG)")
@Excel(name = "净重(KG)")
private BigDecimal netWeight;
@ApiModelProperty("毛重(KG)")
@Excel(name = "毛重(KG)")
private BigDecimal grossWeight;
@ApiModelProperty("体积")
@Excel(name = "体积")
private BigDecimal volume;
@ApiModelProperty("面积")
@Excel(name = "面积")
private BigDecimal area;
}
@@ -147,4 +147,25 @@ public class MaterialInventoryQueryListPO extends MaterialBasePO {
@ApiModelProperty("盘点是否可用:0-禁用 1-可用")
@Excel(name = "盘点是否可用:0-禁用 1-可用")
private Integer isAble;
}
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
@ApiModelProperty("净重(KG)")
@Excel(name = "净重(KG)")
private BigDecimal netWeight;
@ApiModelProperty("毛重(KG)")
@Excel(name = "毛重(KG)")
private BigDecimal grossWeight;
@ApiModelProperty("体积")
@Excel(name = "体积")
private BigDecimal volume;
@ApiModelProperty("面积")
@Excel(name = "面积")
private BigDecimal area;
}
@@ -144,4 +144,25 @@ public class MaterialInventoryDO extends MaterialBaseDO {
@ApiModelProperty("物料/库位信息")
@Excel(name = "物料/库位信息")
private String storageInfo;
}
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
@ApiModelProperty("净重(KG)")
@Excel(name = "净重(KG)")
private BigDecimal netWeight;
@ApiModelProperty("毛重(KG)")
@Excel(name = "毛重(KG)")
private BigDecimal grossWeight;
@ApiModelProperty("体积")
@Excel(name = "体积")
private BigDecimal volume;
@ApiModelProperty("面积")
@Excel(name = "面积")
private BigDecimal area;
}
@@ -168,4 +168,25 @@ public class MaterialInventoryQueryListDO extends MaterialBaseDO {
@ApiModelProperty("物料/库位信息")
@Excel(name = "物料/库位信息")
private String storageInfo;
}
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
@ApiModelProperty("净重(KG)")
@Excel(name = "净重(KG)")
private BigDecimal netWeight;
@ApiModelProperty("毛重(KG)")
@Excel(name = "毛重(KG)")
private BigDecimal grossWeight;
@ApiModelProperty("体积")
@Excel(name = "体积")
private BigDecimal volume;
@ApiModelProperty("面积")
@Excel(name = "面积")
private BigDecimal area;
}
@@ -230,4 +230,166 @@ public class OutMaterialDetailPO extends StockOutOrderBaseDO {
@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 NOs
*/
@ApiModelProperty("Batch Ref NOs")
@Excel(name = "Batch Ref NOs")
private String batchRefNo;
/**
* Sheet Ref NOs
*/
@ApiModelProperty("Sheet Ref NOs")
@Excel(name = "Sheet Ref NOs")
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;
}
@@ -1,6 +1,7 @@
package com.mhd.wms.domain.stockOutOrder.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
@@ -265,6 +266,7 @@ public class StockOutOrder extends BaseVOEntity {
@ApiModelProperty("to")
@Excel(name = "to")
@TableField(value = "\"TO\"")
private String to;
@ApiModelProperty("联系人")
@@ -4,8 +4,11 @@ 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.application.service.stockOutOrder.StockOutOrderApplicationService;
import com.mhd.wms.domain.stockOutOrder.entity.StockOutOrder;
import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService;
import com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@@ -18,56 +21,50 @@ import java.util.Map;
@Service
public class ExcelParseService {
@Autowired
private StockOutOrderApplicationService stockOutOrderApplicationService;
/**
* 解析出仓委托单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) // 不自动关闭流,因为后面还需要使用
.autoCloseStream(false)
.registerReadListener(headerListener)
.registerConverter(new NoConvertConverter()) // 注册自定义转换器
.headRowNumber(0) // 从第0行开始读取表头
.registerConverter(new NoConvertConverter())
.headRowNumber(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) // 不自动关闭流
.autoCloseStream(false)
.registerReadListener(itemListener)
.registerConverter(new NoConvertConverter()) // 注册自定义转换器
.headRowNumber(12) // 关键:设置headRowNumber为11,表示前11行是表头,从第12行开始读取数据
.registerConverter(new NoConvertConverter())
.headRowNumber(12)
.build();
ReadSheet itemSheet = EasyExcel.readSheet(0).build();
itemReader.read(itemSheet);
// 关闭读取器
itemReader.finish();
// 3. 组装完整的出仓委托单
StockOutOrderDO stockOutOrder = headerListener.getStockOutOrder();
stockOutOrder.setMaterialDetailList(itemListener.getItemList());
stockOutOrderApplicationService.insert(stockOutOrder);
return stockOutOrder;
}
}
@@ -1,11 +1,18 @@
package com.mhd.wms.domain.stockOutOrder.repository.listener;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.mhd.common.core.domain.po.SysDictDataVo;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.wms.domain.stockOutOrder.entity.StockOutOrder;
import com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDate;
import java.time.ZoneId;
@@ -25,6 +32,8 @@ 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");
@Autowired
private SystemServiceFeign systemServiceFeign;
@Override
public void invoke(Map<Integer, Object> data, AnalysisContext context) {
@@ -38,50 +47,86 @@ public class HeaderListener extends AnalysisEventListener<Map<Integer, Object>>
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]));
stockOutOrder.setContactPerson(getStringValue(rowData[5]));
stockOutOrder.setVehicleModelPlate(getStringValue(rowData[12]));
stockOutOrder.setEntrustNo(getStringValue(rowData[16]));
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]));
stockOutOrder.setTel(getStringValue(rowData[5]));
stockOutOrder.setContainerNoName(getStringValue(rowData[12]));
if (ObjectUtil.isNotNull(getStringValue(rowData[12]))) {
stockOutOrder.setContainerNoName(getStringValue(rowData[12]));
AjaxResult transportMode = systemServiceFeign.selectListByDictType("cabinetNo");
if (ObjectUtil.isNotNull(transportMode) && transportMode.get("code").equals("200")) {
List<SysDictDataVo> transportModeList = JSON.parseArray(JSONObject.toJSONString(transportMode.get("data")), SysDictDataVo.class);
for (SysDictDataVo sysDictDataVo : transportModeList) {
if (getStringValue(rowData[12]).equals(sysDictDataVo.getDictLabel())) {
stockOutOrder.setContainerNo(sysDictDataVo.getDictValue());
break;
}
}
}
}
stockOutOrder.setDriverSign(getStringValue(rowData[16]));
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());
Date date = Date.from(localDate.atStartOfDay(ZoneId.of("UTC")).toInstant());
stockOutOrder.setOutboundDate(date);
}
stockOutOrder.setFax(getStringValue(rowData[4]));
stockOutOrder.setTransportModeName(getStringValue(rowData[11]));
stockOutOrder.setDeclareCustoms(getStringValue(rowData[15]));
stockOutOrder.setFax(getStringValue(rowData[5]));
if (ObjectUtil.isNotNull(getStringValue(rowData[12]))) {
stockOutOrder.setTransportModeName(getStringValue(rowData[12]));
AjaxResult transportMode = systemServiceFeign.selectListByDictType("transportMode");
if (ObjectUtil.isNotNull(transportMode) && transportMode.get("code").equals("200")) {
List<SysDictDataVo> transportModeList = JSON.parseArray(JSONObject.toJSONString(transportMode.get("data")), SysDictDataVo.class);
for (SysDictDataVo sysDictDataVo : transportModeList) {
if (getStringValue(rowData[12]).equals(sysDictDataVo.getDictLabel())) {
stockOutOrder.setTransportModeCode(sysDictDataVo.getDictValue());
break;
}
}
}
}
stockOutOrder.setDeclareCustoms(getStringValue(rowData[16]));
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]));
stockOutOrder.setCustomerName(getStringValue(rowData[5]));
stockOutOrder.setCustomsDeclarerInfo(getStringValue(rowData[12]));
LocalDate CompleteTime = parseDate(getStringValue(rowData[16]));
if (CompleteTime != null) {
Date date = Date.from(CompleteTime.atStartOfDay(ZoneId.systemDefault()).toInstant());
Date date = Date.from(CompleteTime.atStartOfDay(ZoneId.of("UTC")).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]));
if (ObjectUtil.isNotNull(getStringValue(rowData[2]))) {
stockOutOrder.setSupervisionModeName(getStringValue(rowData[2]));
AjaxResult transportMode = systemServiceFeign.selectListByDictType("controlType");
if (ObjectUtil.isNotNull(transportMode) && transportMode.get("code").equals("200")) {
List<SysDictDataVo> transportModeList = JSON.parseArray(JSONObject.toJSONString(transportMode.get("data")), SysDictDataVo.class);
for (SysDictDataVo sysDictDataVo : transportModeList) {
if (getStringValue(rowData[2]).equals(sysDictDataVo.getDictLabel())) {
stockOutOrder.setSupervisionModeCode(sysDictDataVo.getDictValue());
break;
}
}
}
}
stockOutOrder.setDeliveryAddr(getStringValue(rowData[5]));
stockOutOrder.setCustomsInspectionFlag(getStringValue(rowData[12]));
stockOutOrder.setEntryExitCustoms(getStringValue(rowData[16]));
break;
case 9: // 第10行:下单日期、起运国
LocalDate orderDate = parseDate(getStringValue(rowData[2]));
if (orderDate != null) {
Date date = Date.from(orderDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
Date date = Date.from(orderDate.atStartOfDay(ZoneId.of("UTC")).toInstant());
stockOutOrder.setOrderDate(date);
}
stockOutOrder.setDepartureArrivalCountry(getStringValue(rowData[4]));
stockOutOrder.setDepartureArrivalCountry(getStringValue(rowData[5]));
break;
}
rowNum++;
@@ -161,7 +206,6 @@ public class HeaderListener extends AnalysisEventListener<Map<Integer, Object>>
return null;
}
try {
// 处理Excel中的日期格式(如"2026-01-05 00:00:00"
if (dateStr.contains(" ")) {
dateStr = dateStr.split(" ")[0];
}
@@ -2,8 +2,6 @@ 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;
@@ -11,7 +9,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Collections;
import java.util.stream.Collectors;
/**
* 解析商品明细的监听器(从第12行开始)
@@ -30,7 +27,11 @@ public class ItemListener extends AnalysisEventListener<Map<Integer, Object>> {
// 提取序号(第一列),过滤空行和标题行
String serialNoStr = getStringValue(rowData[0]);
String materialNo = getStringValue(rowData[1]);
String specificationModel = getStringValue(rowData[2]);
if (materialNo.isEmpty() && specificationModel.isEmpty()) {
return;
}
if (serialNoStr.isEmpty() || "序号".equals(serialNoStr) || !isSequenceNumber(serialNoStr)) {
return;
}
@@ -38,33 +39,34 @@ public class ItemListener extends AnalysisEventListener<Map<Integer, Object>> {
OutMaterialDetailDO item = new OutMaterialDetailDO();
// 填充商品明细数据
//商品名称 规格型号/ITEM 商品SKU码 Invoice No. 申报数量 申报单位 升 箱数 件数 尺寸 仓库数量 "总净重
//商品名称 料号 规格型号/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.setMaterialNo(getStringValue(rowData[2]));
item.setSpecificationModel(getStringValue(rowData[3]));
item.setSkucode(getStringValue(rowData[4]));
item.setInvoiceNo(getStringValue(rowData[5]));
item.setDeclareQuantity(parseBigDecimal(rowData[6]).doubleValue());
item.setDeclareUnit(getStringValue(rowData[7]));
item.setLiter(getStringValue(rowData[8]));
item.setCaseCount(parseBigDecimal(rowData[9]).doubleValue());
item.setPieceCount(parseBigDecimal(rowData[10]).doubleValue());
item.setSize(getStringValue(rowData[11]));
//仓库数量 出库数量?
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.setOutboundQuantity(parseBigDecimal(rowData[12]).doubleValue());
item.setTotalNetWeight(parseBigDecimal(rowData[13]).doubleValue());
item.setTotalGrossWeight(parseBigDecimal(rowData[14]).doubleValue());
item.setTotalVolume(parseBigDecimal(rowData[15]).doubleValue());
item.setTotalArea(parseBigDecimal(rowData[16]).doubleValue());
item.setBatchRefNo(getStringValue(rowData[17]));
item.setSheetRefNo(getStringValue(rowData[18]));
item.setCountryOfOrigin(getStringValue(rowData[19]));
item.setCasePalletNo(getStringValue(rowData[19]));
item.setTotalAmount(parseBigDecimal(rowData[20]).doubleValue());
item.setCurrency(getStringValue(rowData[21]));
item.setRemark(getStringValue(rowData[22]));
item.setCasePalletNo(getStringValue(rowData[20]));
item.setTotalAmount(parseBigDecimal(rowData[21]).doubleValue());
item.setCurrency(getStringValue(rowData[22]));
item.setRemark(getStringValue(rowData[23]));
itemList.add(item);
}
@@ -271,4 +271,107 @@ public class StockOutOrderPO extends BaseVOEntity {
@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;
}
@@ -124,18 +124,18 @@ public class StockOutOrderDomainService {
public Boolean insert(StockOutOrderDO stockOutOrderDO) {
stockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
//设置物料信息
setMaterialDetailInfo(stockOutOrderDO);
//setMaterialDetailInfo(stockOutOrderDO);
//统计种类
stockOutOrderDO.setMaterialQuantity(stockOutOrderDO.getMaterialDetailList().size());
//stockOutOrderDO.setMaterialQuantity(stockOutOrderDO.getMaterialDetailList().size());
//统计总数量
BigDecimal quantity = stockOutOrderDO.getMaterialDetailList().stream().map(OutMaterialDetailDO::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
stockOutOrderDO.setQuantity(quantity);
//BigDecimal quantity = stockOutOrderDO.getMaterialDetailList().stream().map(OutMaterialDetailDO::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
//stockOutOrderDO.setQuantity(quantity);
//统计总重量
BigDecimal weightLimit = stockOutOrderDO.getMaterialDetailList().stream().map(OutMaterialDetailDO::getWeightLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
stockOutOrderDO.setWeightLimit(weightLimit);
// BigDecimal weightLimit = stockOutOrderDO.getMaterialDetailList().stream().map(OutMaterialDetailDO::getWeightLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
// stockOutOrderDO.setWeightLimit(weightLimit);
//统计总体积
BigDecimal volumeLimit = stockOutOrderDO.getMaterialDetailList().stream().map(OutMaterialDetailDO::getVolumeLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
stockOutOrderDO.setVolumeLimit(volumeLimit);
//BigDecimal volumeLimit = stockOutOrderDO.getMaterialDetailList().stream().map(OutMaterialDetailDO::getVolumeLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
//stockOutOrderDO.setVolumeLimit(volumeLimit);
stockOutOrderService.insert(stockOutOrderDO);
return outMaterialDetailService.batchInsert(stockOutOrderDO.getOutOrderNumber(), stockOutOrderDO.getMaterialDetailList());
}
@@ -998,4 +998,4 @@ public class StockOutOrderDomainService {
return 3;
}
}
}
}
@@ -116,4 +116,4 @@ public class PickingOrderApi extends BaseController {
PickingOrderDO pickingOrderDO = pickingOrderAssembler.toDO(pickingOrderDTO);
return toAjax(pickingOrderApplicationService.completePicking(pickingOrderDO));
}
}
}
@@ -57,26 +57,26 @@ public class StockOutOrderApi extends BaseController {
* 上传并解析出仓委托单Excel
*/
@PostMapping("/import")
public ResponseEntity<StockOutOrderDO> parseOutboundOrder(
public AjaxResult parseOutboundOrder(
@RequestParam("file") MultipartFile file) {
// 验证文件
if (file.isEmpty()) {
return ResponseEntity.badRequest().body(null);
return error("文件为空");
}
// 验证文件类型
String fileName = file.getOriginalFilename();
if (fileName == null || !fileName.endsWith(".xls") && !fileName.endsWith(".xlsx")) {
return ResponseEntity.status(HttpStatus.UNSUPPORTED_MEDIA_TYPE).body(null);
return error("文件类型错误");
}
try {
// 解析Excel并返回结果
StockOutOrderDO result = excelParseService.parseOutboundOrderExcel(file);
return ResponseEntity.ok(result);
return AjaxResult.success(result);
} catch (IOException e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
return error("解析失败");
}
}
@@ -62,7 +62,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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.level, a.parent_unique_id, a.allow_modify,
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.remark, a.create_time, a.create_by,gen_picking_order,
a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type
a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type,
a.COMMODITY_NAME,a.COMMODITY_NO,a.MATERIAL_NO,a.SPECIFICATION_MODEL,a.SKUCODE,a.INVOICE_NO,a.LITER,a.SIZE,a.DECLARE_UNIT,a.BATCH_REF_NO,a.SHEET_REF_NO,a.COUNTRY_OF_ORIGIN,a.CASE_PALLET_NO,a.CURRENCY,a.DECLARE_QUANTITY,a.CASE_COUNT,a.PIECE_COUNT,a.OUTBOUND_QUANTITY,a.TOTAL_NET_WEIGHT,a.TOTAL_GROSS_WEIGHT,a.TOTAL_VOLUME,a.TOTAL_AREA,a.TOTAL_AMOUNT,a.UNIT
</sql>
<sql id="selectMaterialDetailPo1">
@@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.storage_section_id, a.storage_code, a.storage_name, a.storage_location_id, a.storage_location_code, a.storage_location_name, a.material_base_info_id,a.material_detail_id,
a.batch_number,a.material_status_code,a.material_status_name,a.container_id,a.container_code,a.container_type,a.container_type_name,IFNULL(a.freeze_quantity,0) freeze_quantity,a.is_able,
IFNULL(a.inventory_quantity,0) inventory_quantity, IFNULL(a.allocation_quantity,0) allocation_quantity, a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name,
a.del_flag
a.del_flag,a.unit,a.area,a.NET_WEIGHT,a.GROSS_WEIGHT,a.VOLUME
</sql>
<sql id="selectMaterialInventoryPo1">