From 42ec0ec4adbce7044abcb6f6c847f1f516aa1c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 9 Apr 2026 10:27:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93oms;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/ReservationInMaterialDetail.java | 367 ++++ .../IReservationInMaterialDetailService.java | 62 + .../ReservationInMaterialDetailMapper.java | 27 + .../ReservationInMaterialDetailImpl.java | 276 +++ .../po/ReservationInMaterialDetailPO.java | 413 ++++ .../todo/QueryOrderOverStockDO.java | 140 ++ .../ReservationInMaterialDetailBaseDO.java | 42 + .../todo/ReservationInMaterialDetailDO.java | 373 ++++ .../todo/ReservationInMaterialDetailDTO.java | 381 ++++ ...ionInMaterialDetailApplicationService.java | 72 + .../ReservationInMaterialDetailAssembler.java | 65 + ...ervationInMaterialDetailDomainService.java | 64 + .../entity/ReservationStockInOrder.java | 355 ++++ .../IReservationStockInOrderService.java | 44 + .../mapper/ReservationStockInOrderMapper.java | 33 + .../ReservationStockInOrderImpl.java | 84 + .../repository/po/MaterialBaseInfoPO.java | 242 +++ .../repository/po/MaterialGoodsRulePO.java | 131 ++ .../po/MaterialWarehouseControlPO.java | 97 + .../po/ReservationStockInOrderBasePO.java | 116 + .../po/ReservationStockInOrderPO.java | 376 ++++ .../todo/ReservationStockInOrderBaseDO.java | 111 + .../todo/ReservationStockInOrderBaseDTO.java | 110 + .../todo/ReservationStockInOrderDO.java | 382 ++++ .../todo/ReservationStockInOrderDTO.java | 379 ++++ .../ReservationStockInOrderImportRowDTO.java | 211 ++ ...rvationStockInOrderApplicationService.java | 1859 +++++++++++++++++ .../ReservationStockInOrderAssembler.java | 134 ++ .../ReservationStockInOrderDomainService.java | 789 +++++++ .../ReservationInMaterialDetailApi.java | 83 + .../ReservationStockInOrderApi.java | 130 ++ .../ReservationInMaterialDetailMapper.xml | 339 +++ .../ReservationStockInOrderMapper.xml | 444 ++++ 33 files changed, 8731 insertions(+) create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/entity/ReservationInMaterialDetail.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/facade/IReservationInMaterialDetailService.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/mapper/ReservationInMaterialDetailMapper.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/persistence/ReservationInMaterialDetailImpl.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/po/ReservationInMaterialDetailPO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/QueryOrderOverStockDO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailBaseDO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDTO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailApplicationService.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailAssembler.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailDomainService.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/entity/ReservationStockInOrder.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialBaseInfoPO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialGoodsRulePO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialWarehouseControlPO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/ReservationStockInOrderBasePO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/ReservationStockInOrderPO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderBaseDO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderBaseDTO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderDO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderDTO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderImportRowDTO.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderAssembler.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationInMaterialDetail/ReservationInMaterialDetailApi.java create mode 100644 mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationStockInOrder/ReservationStockInOrderApi.java create mode 100644 mhd_oms/src/main/resources/mapper/reservationInMaterialDetail/ReservationInMaterialDetailMapper.xml create mode 100644 mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/entity/ReservationInMaterialDetail.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/entity/ReservationInMaterialDetail.java new file mode 100644 index 000000000..d7b68027e --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/entity/ReservationInMaterialDetail.java @@ -0,0 +1,367 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.entity; + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + + +/** + * 物料明细对象 material_detail + * + * @author gen + * @date 2024-05-21 + */ + +@Data +public class ReservationInMaterialDetail extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("订单物料明细id") + @TableId(type = IdType.AUTO) + private Long materialDetailId; + + @ApiModelProperty("业务唯一id") + @JsonSerialize(using = ToStringSerializer.class) + private Long uniqueId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("物料基础信息id") + @Excel(name = "物料基础信息id") + private Long materialBaseInfoId; + + @ApiModelProperty("物料编码") + @Excel(name = "物料编码") + private String materialCode; + + @ApiModelProperty("物料名称") + @Excel(name = "物料名称") + private String materialName; + + @ApiModelProperty("物料条形码") + @Excel(name = "物料条形码") + private String barCode; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; + + @ApiModelProperty("收货数量") + @Excel(name = "收货数量") + private BigDecimal receiptQuantity; + + @ApiModelProperty("上架数量") + @Excel(name = "上架数量") + private BigDecimal shelvesQuantity; + + @ApiModelProperty("作业数量(例如:收货数量 上架数量)") + @Excel(name = "作业数量(例如:收货数量 上架数量)") + private BigDecimal actualQuantity; + + @ApiModelProperty("收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)") + @Excel(name = "收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)") + private Integer receiptStatus; + + @ApiModelProperty("上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)") + @Excel(name = "上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)") + private Integer shelvesStatus; + + @ApiModelProperty("包装规格id") + @Excel(name = "包装规格id") + private Long packId; + + @ApiModelProperty("包装规格编码") + @Excel(name = "包装规格编码") + private String packCode; + + @ApiModelProperty("包装规格名称") + @Excel(name = "包装规格名称") + private String packName; + + @ApiModelProperty("包装详情id") + @Excel(name = "包装详情id") + private Long packDetailId; + + @ApiModelProperty("单位代码:EA IP CS PL OT") + @Excel(name = "单位代码:EA IP CS PL OT") + private String unitCode; + + @ApiModelProperty("单位名称") + @Excel(name = "单位名称") + private String unitName; + + @ApiModelProperty("单位数量") + @Excel(name = "单位数量") + private BigDecimal unitNumber; + + @ApiModelProperty("物料仓库控制信息id") + @Excel(name = "物料仓库控制信息id") + private Long materialWarehouseControlId; + + @ApiModelProperty("是否序列号管理: 1-是 2-否") + @Excel(name = "是否序列号管理: 1-是 2-否") + private Integer serialNumberManage; + + @ApiModelProperty("是否质检管理: 1-是 2-否") + @Excel(name = "是否质检管理: 1-是 2-否") + private Integer qualityInspectionManage; + + @ApiModelProperty("质检阶段: 1-收货前 2-收货后上架前") + @Excel(name = "质检阶段: 1-收货前 2-收货后上架前") + private Integer qualityInspectionStage; + + @ApiModelProperty("质检规则: 1-全检 2-抽检 ") + @Excel(name = "质检规则: 1-全检 2-抽检 ") + private Integer qualityInspectionRule; + + @ApiModelProperty("抽检比例") + @Excel(name = "抽检比例") + private BigDecimal qualityInspectionRatio; + + @ApiModelProperty("质检项: 1-包装 2-纯度") + @Excel(name = "质检项: 1-包装 2-纯度") + private Integer qualityInspectionTerm; + + @ApiModelProperty("质检结果: 1-正常 2-异常") + @Excel(name = "质检结果: 1-正常 2-异常") + private Integer qualityInspectionResults; + + @ApiModelProperty("是否允许超收: 1-是 2-否") + @Excel(name = "是否允许超收: 1-是 2-否") + private Integer allowOvercharge; + + @ApiModelProperty("超收比例") + @Excel(name = "超收比例") + private BigDecimal overchargeRatio; + + @ApiModelProperty("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @ApiModelProperty("分配规则id") + @Excel(name = "分配规则id") + private Long distributeRuleId; + + @ApiModelProperty("分配规则编码") + @Excel(name = "分配规则编码") + private String distributeRuleCode; + + @ApiModelProperty("分配规则名称") + @Excel(name = "分配规则名称") + private String distributeRuleName; + + @ApiModelProperty("容器id") + @Excel(name = "容器id") + private Long containerId; + + @ApiModelProperty("容器编码") + @Excel(name = "容器编码") + private String containerCode; + + @ApiModelProperty("容器类型 数据字典") + @Excel(name = "容器类型 数据字典") + private String containerType; + + @ApiModelProperty("容器类型名称 数据字典") + @Excel(name = "容器类型名称 数据字典") + private String containerTypeName; + + @ApiModelProperty("上架仓库id") + private Long warehouseId; + + @ApiModelProperty("上架仓库编码") + @Excel(name = "上架仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("上架库区id") + @Excel(name = "上架库区id") + private Long storageSectionId; + + @ApiModelProperty("上架库区编码") + @Excel(name = "上架库区编码") + private String storageCode; + + @ApiModelProperty("上架库区名称") + @Excel(name = "上架库区名称") + private String storageName; + + @ApiModelProperty("上架库位id") + @Excel(name = "上架库位id") + private Long storageLocationId; + + @ApiModelProperty("上架库位编码") + @Excel(name = "上架库位编码") + private String storageLocationCode; + + @ApiModelProperty("上架库位名称") + @Excel(name = "上架库位名称") + private String storageLocationName; + + @ApiModelProperty("层级深度,从一级开始递增") + private Integer level; + + @ApiModelProperty("父级唯一Id") + private Long parentUniqueId; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("越库单id") + private Long overStockId; + + @ApiModelProperty("越库单状态 0:无状态 1:处理中 2:越库完成") + @Excel(name = "越库单状态 0:无状态 1:处理中 2:越库完成") + private Integer overStockStatus; + + @ApiModelProperty("越库类型:1-直接越库 2-分拨越库") + @Excel(name = "越库类型:1-直接越库 2-分拨越库") + private Long overStockType; + + // ========== 报关相关明细字段 ========== + @ApiModelProperty("规格型号") + @Excel(name = "规格型号/ITEM") + private String specificationModel; + + @ApiModelProperty("SKU码") + @Excel(name = "SKU码") + private String skuCode; + + @ApiModelProperty("Invoice No.") + @Excel(name = "Invoice No.") + private String invoiceNo; + + @ApiModelProperty("升") + @Excel(name = "升") + private BigDecimal liter; + + @ApiModelProperty("尺寸") + @Excel(name = "尺寸") + private String dimensions; + + @ApiModelProperty("申报单位") + @Excel(name = "申报单位") + private String declarationUnit; + + @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 originCountry; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("币制") + @Excel(name = "币制") + private String currency; + + @ApiModelProperty("单位") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("申报数量") + @Excel(name = "申报数量") + private BigDecimal declaredQuantity; + + @ApiModelProperty("箱数") + @Excel(name = "箱数") + private BigDecimal boxCount; + + @ApiModelProperty("件数") + @Excel(name = "件数") + private BigDecimal pieceCount; + + @ApiModelProperty("入库数量(输入大于等于0的数字,可以为小数)") + @Excel(name = "入库数量") + private BigDecimal inboundQuantity; + + @ApiModelProperty("总净重(KG)") + @Excel(name = "总净重(KG)") + private BigDecimal totalNetWeight; + + @ApiModelProperty("总毛重(KG)") + @Excel(name = "总毛重(KG)") + private BigDecimal totalGrossWeight; + + @ApiModelProperty("总体积(CBM)") + @Excel(name = "总体积(CBM)") + private BigDecimal totalVolume; + + @ApiModelProperty("总面积(SQM)") + @Excel(name = "总面积(SQM)") + private BigDecimal totalArea; + + @ApiModelProperty("总价") + @Excel(name = "总价") + private BigDecimal totalPrice; + + @ApiModelProperty("合同收费") + @Excel(name = "合同收费") + private BigDecimal contractFee; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseFee; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWhFee; + + @ApiModelProperty("折扣(%)") + @Excel(name = "折扣(%)") + private BigDecimal discountRate; + + @ApiModelProperty("单体积(CBM)") + @Excel(name = "单体积(CBM)") + private BigDecimal singleVolume; + + @ApiModelProperty("单毛重(KG)") + @Excel(name = "单毛重(KG)") + private BigDecimal singleGrossWeight; + + @ApiModelProperty("lot编号") + @Excel(name = "lot编号") + private String lotNo; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/facade/IReservationInMaterialDetailService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/facade/IReservationInMaterialDetailService.java new file mode 100644 index 000000000..6f2dca555 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/facade/IReservationInMaterialDetailService.java @@ -0,0 +1,62 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.repository.facade; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mhd.oms.domain.reservationInMaterialDetail.entity.ReservationInMaterialDetail; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO; + +import java.util.List; + +/** + * 物料明细Service接口 + * + * @author gen + * @date 2024-05-21 + */ +public interface IReservationInMaterialDetailService extends IService +{ + + /** + * 分页查询物料明细列表 + */ + public List queryList(com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO inMaterialDetailDO); + + + public List queryInOrderList(QueryOrderOverStockDO queryOrderOverStockDO); + + /** + * 分页查询物料明细列表 + */ + public List queryListChildren(com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO inMaterialDetailDO); + + /** + * 新增物料明细 + */ + public Boolean insert(com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO inMaterialDetailDO); + + /** + * 修改物料明细 + */ + public Boolean update(com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO inMaterialDetailDO); + + /** + * 新增物料明细 + */ + public Boolean batchInsert(String orderNumber, List inMaterialDetailDOList); + + + /** + * 修改物料明细 + */ + public Boolean batchUpdate(List inMaterialDetailDOList, com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailBaseDO inMaterialDetailBaseDO); + + /** + * 批量删除物料明细 + */ + public Boolean delete(Long[] materialDetailIds); + + + /** + * 查询物料明细 + */ + public com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO getInfo(Long materialDetailId); +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/mapper/ReservationInMaterialDetailMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/mapper/ReservationInMaterialDetailMapper.java new file mode 100644 index 000000000..6fba3c252 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/mapper/ReservationInMaterialDetailMapper.java @@ -0,0 +1,27 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.oms.domain.reservationInMaterialDetail.entity.ReservationInMaterialDetail; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO; + +import java.util.List; + +/** + * 物料明细Mapper接口 + * + * @author gen + * @date 2024-05-21 + */ +public interface ReservationInMaterialDetailMapper extends BaseMapper +{ + /** + * 查询物料明细列表 + */ + public List queryList(com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO inMaterialDetailDO); + + /** + * 关联入库单查询物料明细列表 + */ + public List queryInOrderList(QueryOrderOverStockDO queryOrderOverStockDO); + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/persistence/ReservationInMaterialDetailImpl.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/persistence/ReservationInMaterialDetailImpl.java new file mode 100644 index 000000000..e122dbeb0 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/persistence/ReservationInMaterialDetailImpl.java @@ -0,0 +1,276 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.repository.persistence; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mhd.common.core.constant.SnowFlakeConstants; +import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.common.core.utils.uuid.IdGenerator; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.reservationInMaterialDetail.entity.ReservationInMaterialDetail; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.facade.IReservationInMaterialDetailService; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.mapper.ReservationInMaterialDetailMapper; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailBaseDO; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO; +import com.mhd.system.api.model.LoginUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * 物料明细Service业务层处理 + * + * @author gen + * @date 2024-05-21 + */ +@Service +public class ReservationInMaterialDetailImpl extends ServiceImpl implements IReservationInMaterialDetailService { + @Autowired + private ReservationInMaterialDetailMapper inMaterialDetailMapper; +// @Autowired +// private IMaterialBaseInfoService materialBaseInfoService; +// @Autowired +// private IMaterialGoodsRuleService materialGoodsRuleService; +// @Autowired +// private IMaterialWarehouseControlService materialWarehouseControlService; +// @Autowired +// private SystemServiceFeign systemServiceFeign; + @Autowired + private IdGenerator idGenerator; + + + /** + * 查询物料明细列表 + */ + @Override + public List queryList(com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO inMaterialDetailDO) { + return inMaterialDetailMapper.queryList(inMaterialDetailDO); + } + + /** + * 关联入库单查询物料明细列表 + */ + @Override + public List queryInOrderList(QueryOrderOverStockDO queryOrderOverStockDO) { + return inMaterialDetailMapper.queryInOrderList(queryOrderOverStockDO); + } + + /** + * 查询物料明细列表 + */ + @Override + public List queryListChildren(com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO inMaterialDetailDO) + { + List inMaterialDetailPOList = inMaterialDetailMapper.queryList(inMaterialDetailDO); + + // 获取查询的层级 + List inMaterialDetailPOParentList = inMaterialDetailPOList + .stream().filter(e -> 1 == e.getLevel()).collect(Collectors.toList()); + // 递归查询子集 + inMaterialDetailPOParentList.forEach(materialDetailPO -> materialDetailPO.setChildren(getChildren(materialDetailPO.getUniqueId(), inMaterialDetailPOList, 2))); + return inMaterialDetailPOParentList; + } + + private List getChildren(Long parentUniqueId, List inMaterialDetailPOList, Integer maxLevel){ + List childrenCityList = inMaterialDetailPOList.stream().filter(materialDetailPO -> parentUniqueId.equals(materialDetailPO.getParentUniqueId())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(childrenCityList)){ + childrenCityList.forEach(childrenCity -> { + if (childrenCity.getLevel() < maxLevel){ + childrenCity.setChildren(getChildren(childrenCity.getUniqueId(), inMaterialDetailPOList, maxLevel)); + } + }); + } + return childrenCityList; + } + + /** + * 新增物料明细 + */ + @Override + public Boolean insert(ReservationInMaterialDetailDO inMaterialDetailDO) { + ReservationInMaterialDetail inMaterialDetail = new ReservationInMaterialDetail(); + BeanUtils.copyProperties(inMaterialDetailDO, inMaterialDetail); + return this.save(inMaterialDetail); + } + + /** + * 修改物料明细 + */ + @Override + public Boolean update(ReservationInMaterialDetailDO inMaterialDetailDO) { + ReservationInMaterialDetail inMaterialDetail = new ReservationInMaterialDetail(); + BeanUtils.copyProperties(inMaterialDetailDO, inMaterialDetail); + return this.updateById(inMaterialDetail); + } + + /** + * @description 批量新增物流明细 + * @author ZhouGY + * @date 2024/5/22 9:27 + * @param inOrderNumber + * @param inMaterialDetailDOList + * @return Boolean + */ + @Transactional(rollbackFor = Exception.class) + @Override + public Boolean batchInsert(String inOrderNumber, List inMaterialDetailDOList) { + if (CollectionUtils.isEmpty(inMaterialDetailDOList)) { + throw new ServiceException("物料明细不能为空"); + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + // 获取用户姓名(优先从UserPo获取,如果为空则使用realname,最后使用username作为兜底) + String userRealName = loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null + ? loginUser.getUserPo().getUserName() + : (loginUser.getRealname() != null ? loginUser.getRealname() : loginUser.getUsername()); + // 批量新增或修改 + List inMaterialDetailList = new ArrayList<>(); + for (ReservationInMaterialDetailDO inMaterialDetailDO : inMaterialDetailDOList){ + ReservationInMaterialDetail inMaterialDetail = new ReservationInMaterialDetail(); + BeanUtils.copyProperties(inMaterialDetailDO, inMaterialDetail); + inMaterialDetail.setOrganizationId(loginUser.getUserPo().getOrganizationId()); + inMaterialDetail.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + inMaterialDetail.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + inMaterialDetail.setUniqueId(idGenerator.snowflakeId(SnowFlakeConstants.wmsId)); + inMaterialDetail.setInOrderNumber(inOrderNumber); + inMaterialDetail.setLevel(1); + inMaterialDetail.setCreateBy(loginUser.getUserid()); + inMaterialDetail.setCreateByName(userRealName); + inMaterialDetail.setCreateTime(new Date()); + // 新增入库单明细时,如果计划数量为空,则使用入库数量作为计划数量 + if (inMaterialDetail.getQuantity() == null && inMaterialDetailDO.getInboundQuantity() != null) { + inMaterialDetail.setQuantity(inMaterialDetailDO.getInboundQuantity()); + } + inMaterialDetailList.add(inMaterialDetail); + } + return saveBatch(inMaterialDetailList); + } + + /** + * @description 批量修改物流明细 + * @author ZhouGY + * @date 2024/5/22 9:27 + * @param inMaterialDetailDOList + * @param inMaterialDetailBaseDO + * @return Boolean + */ + @Transactional(rollbackFor = Exception.class) + @Override + public Boolean batchUpdate(List inMaterialDetailDOList, ReservationInMaterialDetailBaseDO inMaterialDetailBaseDO) { + if (CollectionUtils.isEmpty(inMaterialDetailDOList)) { + throw new ServiceException("物料明细不能为空"); + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + // 获取用户姓名(优先从UserPo获取,如果为空则使用realname,最后使用username作为兜底) + String userRealName = loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null + ? loginUser.getUserPo().getUserName() + : (loginUser.getRealname() != null ? loginUser.getRealname() : loginUser.getUsername()); + + // 查询所有记录(包括已删除的),用于判断是否需要恢复已删除的记录 + List inMaterialDetailDbAllList = inMaterialDetailMapper.selectList(new QueryWrapper().lambda() + .eq(ReservationInMaterialDetail::getInOrderNumber, inMaterialDetailBaseDO.getInOrderNumber())); + // 查询未删除的记录,用于正常的更新逻辑 + List inMaterialDetailDbList = inMaterialDetailDbAllList.stream() + .filter(item -> item.getDelFlag() != null && item.getDelFlag() == 1) + .collect(Collectors.toList()); + Map materialDetailMap = inMaterialDetailDbList.stream().collect(Collectors.toMap(ReservationInMaterialDetail::getMaterialDetailId, Function.identity())); + // 查询已删除的记录,用于恢复逻辑 + Map materialDetailDeletedMap = inMaterialDetailDbAllList.stream() + .filter(item -> item.getDelFlag() != null && item.getDelFlag() == 2) + .collect(Collectors.toMap(ReservationInMaterialDetail::getMaterialDetailId, Function.identity())); + //批量新增或修改物料信息 + List inMaterialDetailList = new ArrayList<>(); + //需要修改的物流明细 + List materialDetailIdsByUpdate = new ArrayList<>(); + for (ReservationInMaterialDetailDO inMaterialDetailDO : inMaterialDetailDOList){ + //判断是否需要修改 + ReservationInMaterialDetail inMaterialDetail = null; + if (inMaterialDetailDO.getMaterialDetailId() != null) { + // 先查找未删除的记录 + inMaterialDetail = materialDetailMap.get(inMaterialDetailDO.getMaterialDetailId()); + // 如果未删除的记录中找不到,检查是否在已删除的记录中 + if (inMaterialDetail == null) { + ReservationInMaterialDetail deletedDetail = materialDetailDeletedMap.get(inMaterialDetailDO.getMaterialDetailId()); + if (deletedDetail != null) { + // 恢复已删除的记录 + inMaterialDetail = deletedDetail; + inMaterialDetail.setDelFlag(1); // 恢复记录 + } + } + } + if (inMaterialDetail == null){ + // 新增明细:清空 materialDetailId,让数据库自动生成 + inMaterialDetail = new ReservationInMaterialDetail(); + BeanUtils.copyProperties(inMaterialDetailDO, inMaterialDetail); + inMaterialDetail.setMaterialDetailId(null); // 清空ID,确保新增 + inMaterialDetail.setUniqueId(idGenerator.snowflakeId(SnowFlakeConstants.wmsId)); + inMaterialDetail.setInOrderNumber(inMaterialDetailBaseDO.getInOrderNumber()); + inMaterialDetail.setOrganizationId(inMaterialDetailBaseDO.getOrganizationId()); + inMaterialDetail.setOrganizationName(inMaterialDetailBaseDO.getOrganizationName()); + inMaterialDetail.setTopOrganizationId(inMaterialDetailBaseDO.getTopOrganizationId()); + inMaterialDetail.setDelFlag(1); // 确保新增记录的delFlag为1 + }else { + BeanUtils.copyProperties(inMaterialDetailDO, inMaterialDetail); + inMaterialDetail.setUpdateBy(loginUser.getUserid()); + inMaterialDetail.setUpdateByName(userRealName); + inMaterialDetail.setUpdateTime(new Date()); + materialDetailIdsByUpdate.add(inMaterialDetailDO.getMaterialDetailId()); + } + inMaterialDetailList.add(inMaterialDetail); + } + //需修改的物料明细id集合不为空 + if (!CollectionUtils.isEmpty(inMaterialDetailDbList) && !CollectionUtils.isEmpty(materialDetailIdsByUpdate)){ + List materialDetailIdsByDb = inMaterialDetailDbList.stream().map(ReservationInMaterialDetail::getMaterialDetailId).collect(Collectors.toList()); + //过滤需要修改的id集合 + materialDetailIdsByDb.removeAll(materialDetailIdsByUpdate); + //判断是否存在需要删除的物流明细 标记删除 + if (!CollectionUtils.isEmpty(materialDetailIdsByDb)){ + update(new UpdateWrapper().lambda() + .set(ReservationInMaterialDetail::getDelFlag, 2) + .set(ReservationInMaterialDetail::getUpdateBy, loginUser.getUserid()) + .set(ReservationInMaterialDetail::getUpdateByName, userRealName) + .set(ReservationInMaterialDetail::getUpdateTime, new Date()) + .in(ReservationInMaterialDetail::getMaterialDetailId, materialDetailIdsByDb)); + } + } + //保存物料明细信息 + return saveOrUpdateBatch(inMaterialDetailList); + } + + /** + * 批量删除物料明细 + */ + @Override + public Boolean delete(Long[] materialDetailIds ) { + List list = new ArrayList<>(); + for (Long id : materialDetailIds) { + ReservationInMaterialDetail inMaterialDetail = new ReservationInMaterialDetail(); + inMaterialDetail.setMaterialDetailId(id); + inMaterialDetail.setDelFlag(2); + list.add(inMaterialDetail); + } + return this.updateBatchById(list); + } + + /** + * 修改物料明细 + */ + @Override + public ReservationInMaterialDetailPO getInfo(Long materialDetailId) { + ReservationInMaterialDetail inMaterialDetail = this.getById(materialDetailId); + ReservationInMaterialDetailPO inMaterialDetailPO = new ReservationInMaterialDetailPO(); + BeanUtils.copyProperties(inMaterialDetail, inMaterialDetailPO); + return inMaterialDetailPO; + } + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/po/ReservationInMaterialDetailPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/po/ReservationInMaterialDetailPO.java new file mode 100644 index 000000000..1ea363f7a --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/po/ReservationInMaterialDetailPO.java @@ -0,0 +1,413 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.repository.po; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.mhd.common.core.annotation.Excel; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.ReservationStockInOrderBasePO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + + +/** + * 物料明细对象 material_detail + * + * @author gen + * @date 2024-05-21 + */ + +@Data +@ApiModel(value = "物料明细对象", description = "物料明细响应对象") +public class ReservationInMaterialDetailPO extends ReservationStockInOrderBasePO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("订单物料明细id") + private Long materialDetailId; + + @ApiModelProperty("业务唯一id") + @JsonSerialize(using = ToStringSerializer.class) + private Long uniqueId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("物料基础信息id") + @Excel(name = "物料基础信息id") + private Long materialBaseInfoId; + + @ApiModelProperty("物料编码") + @Excel(name = "物料编码") + private String materialCode; + + @ApiModelProperty("物料名称") + @Excel(name = "物料名称") + private String materialName; + + @ApiModelProperty("物料条形码") + @Excel(name = "物料条形码") + private String barCode; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; + + @ApiModelProperty("收货数量") + @Excel(name = "收货数量") + private BigDecimal receiptQuantity; + + @ApiModelProperty("上架数量") + @Excel(name = "上架数量") + private BigDecimal shelvesQuantity; + + @ApiModelProperty("作业数量(例如:收货数量 上架数量)") + @Excel(name = "作业数量(例如:收货数量 上架数量)") + private BigDecimal actualQuantity; + + @ApiModelProperty("收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)") + @Excel(name = "收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)") + private Integer receiptStatus; + + @ApiModelProperty("上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)") + @Excel(name = "上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)") + private Integer shelvesStatus; + + @ApiModelProperty("包装规格id") + @Excel(name = "包装规格id") + private Long packId; + + @ApiModelProperty("包装规格编码") + @Excel(name = "包装规格编码") + private String packCode; + + @ApiModelProperty("包装规格名称") + @Excel(name = "包装规格名称") + private String packName; + + @ApiModelProperty("包装详情id") + @Excel(name = "包装详情id") + private Long packDetailId; + + @ApiModelProperty("单位代码:EA IP CS PL OT") + @Excel(name = "单位代码:EA IP CS PL OT") + private String unitCode; + + @ApiModelProperty("单位名称") + @Excel(name = "单位名称") + private String unitName; + + @ApiModelProperty("单位数量") + @Excel(name = "单位数量") + private BigDecimal unitNumber; + + @ApiModelProperty("物料仓库控制信息id") + @Excel(name = "物料仓库控制信息id") + private Long materialWarehouseControlId; + + @ApiModelProperty("是否序列号管理: 1-是 2-否") + @Excel(name = "是否序列号管理: 1-是 2-否") + private Integer serialNumberManage; + + @ApiModelProperty("是否质检管理: 1-是 2-否") + @Excel(name = "是否质检管理: 1-是 2-否") + private Integer qualityInspectionManage; + + @ApiModelProperty("质检阶段: 1-收货前 2-收货后上架前") + @Excel(name = "质检阶段: 1-收货前 2-收货后上架前") + private Integer qualityInspectionStage; + + @ApiModelProperty("质检规则: 1-全检 2-抽检 ") + @Excel(name = "质检规则: 1-全检 2-抽检 ") + private Integer qualityInspectionRule; + + @ApiModelProperty("抽检比例") + @Excel(name = "抽检比例") + private BigDecimal qualityInspectionRatio; + + @ApiModelProperty("质检项: 1-包装 2-纯度") + @Excel(name = "质检项: 1-包装 2-纯度") + private Integer qualityInspectionTerm; + + @ApiModelProperty("质检结果: 1-正常 2-异常") + @Excel(name = "质检结果: 1-正常 2-异常") + private Integer qualityInspectionResults; + + @ApiModelProperty("是否允许超收: 1-是 2-否") + @Excel(name = "是否允许超收: 1-是 2-否") + private Integer allowOvercharge; + + @ApiModelProperty("超收比例") + @Excel(name = "超收比例") + private BigDecimal overchargeRatio; + + @ApiModelProperty("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @ApiModelProperty("分配规则id") + @Excel(name = "分配规则id") + private Long distributeRuleId; + + @ApiModelProperty("分配规则编码") + @Excel(name = "分配规则编码") + private String distributeRuleCode; + + @ApiModelProperty("分配规则名称") + @Excel(name = "分配规则名称") + private String distributeRuleName; + + @ApiModelProperty("容器id") + @Excel(name = "容器id") + private Long containerId; + + @ApiModelProperty("容器编码") + @Excel(name = "容器编码") + private String containerCode; + + @ApiModelProperty("容器类型 数据字典") + @Excel(name = "容器类型 数据字典") + private String containerType; + + @ApiModelProperty("容器类型名称 数据字典") + @Excel(name = "容器类型名称 数据字典") + private String containerTypeName; + + @ApiModelProperty("上架仓库id") + private Long warehouseId; + + @ApiModelProperty("上架仓库编码") + @Excel(name = "上架仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("上架库区id") + @Excel(name = "上架库区id") + private Long storageSectionId; + + @ApiModelProperty("上架库区编码") + @Excel(name = "上架库区编码") + private String storageCode; + + @ApiModelProperty("上架库区名称") + @Excel(name = "上架库区名称") + private String storageName; + + @ApiModelProperty("上架库位id") + @Excel(name = "上架库位id") + private Long storageLocationId; + + @ApiModelProperty("上架库位编码") + @Excel(name = "上架库位编码") + private String storageLocationCode; + + @ApiModelProperty("上架库位名称") + @Excel(name = "上架库位名称") + private String storageLocationName; + + @ApiModelProperty("层级深度,从一级开始递增") + private Integer level; + + @ApiModelProperty("父级唯一Id") + @JsonSerialize(using = ToStringSerializer.class) + private Long parentUniqueId; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("未收货数量") + @Excel(name = "未收货数量") + private BigDecimal waitReceiptQuantity; + + @ApiModelProperty("未上架数量") + @Excel(name = "未上架数量") + private BigDecimal waitShelvesQuantity; + + @ApiModelProperty("物料明细") + private List children; + + @ApiModelProperty("越库单id") + private Long overStockId; + + @ApiModelProperty("越库单状态 0:无状态 1:处理中 2:越库完成") + @Excel(name = "越库单状态 0:无状态 1:处理中 2:越库完成") + private Integer overStockStatus; + + @ApiModelProperty("越库类型:1-直接越库 2-分拨越库") + @Excel(name = "越库类型:1-直接越库 2-分拨越库") + private Long overStockType; + + // ========== 报关相关明细字段 ========== + @ApiModelProperty("规格型号") + @Excel(name = "规格型号/ITEM") + private String specificationModel; + + @ApiModelProperty("SKU码") + @Excel(name = "SKU码") + private String skuCode; + + @ApiModelProperty("Invoice No.") + @Excel(name = "Invoice No.") + private String invoiceNo; + + @ApiModelProperty("升") + @Excel(name = "升") + private BigDecimal liter; + + @ApiModelProperty("尺寸") + @Excel(name = "尺寸") + private String dimensions; + + @ApiModelProperty("申报单位") + @Excel(name = "申报单位") + private String declarationUnit; + + @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 originCountry; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("币制") + @Excel(name = "币制") + private String currency; + + @ApiModelProperty("单位") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("申报数量") + @Excel(name = "申报数量") + private BigDecimal declaredQuantity; + + @ApiModelProperty("箱数") + @Excel(name = "箱数") + private BigDecimal boxCount; + + @ApiModelProperty("件数") + @Excel(name = "件数") + private BigDecimal pieceCount; + + @ApiModelProperty("入库数量") + @Excel(name = "入库数量") + private BigDecimal inboundQuantity; + + @ApiModelProperty("总净重(KG)") + @Excel(name = "总净重(KG)") + private BigDecimal totalNetWeight; + + @ApiModelProperty("总毛重(KG)") + @Excel(name = "总毛重(KG)") + private BigDecimal totalGrossWeight; + + @ApiModelProperty("总体积(CBM)") + @Excel(name = "总体积(CBM)") + private BigDecimal totalVolume; + + @ApiModelProperty("总面积(SQM)") + @Excel(name = "总面积(SQM)") + private BigDecimal totalArea; + + @ApiModelProperty("总价") + @Excel(name = "总价") + private BigDecimal totalPrice; + + @ApiModelProperty("生产日期") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date productionDate; + + @ApiModelProperty("过期日期") + @Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date expiryDate; + + @ApiModelProperty("存货日期") + @Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date inventoryDate; + + @ApiModelProperty("扩展属性1") + @Excel(name = "扩展属性1") + private String extAttr1; + + @ApiModelProperty("扩展属性2") + @Excel(name = "扩展属性2") + private String extAttr2; + + @ApiModelProperty("扩展属性3") + @Excel(name = "扩展属性3") + private String extAttr3; + + @ApiModelProperty("扩展属性4") + @Excel(name = "扩展属性4") + private String extAttr4; + + + @ApiModelProperty("合同收费") + @Excel(name = "合同收费") + private BigDecimal contractFee; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseFee; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWhFee; + + @ApiModelProperty("折扣(%)") + @Excel(name = "折扣(%)") + private BigDecimal discountRate; + + @ApiModelProperty("单体积(CBM)") + @Excel(name = "单体积(CBM)") + private BigDecimal singleVolume; + + @ApiModelProperty("单毛重(KG)") + @Excel(name = "单毛重(KG)") + private BigDecimal singleGrossWeight; + + @ApiModelProperty("lot编号") + @Excel(name = "lot编号") + private String lotNo; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/QueryOrderOverStockDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/QueryOrderOverStockDO.java new file mode 100644 index 000000000..3310cedd1 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/QueryOrderOverStockDO.java @@ -0,0 +1,140 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.repository.todo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + + +/** + * 越库管理对象 over_stock + * + * @author gen + * @date 2024-07-23 + */ + +@Data +public class QueryOrderOverStockDO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("仓库id") + @Excel(name = "仓库id") + private Long warehouseId; + + @ApiModelProperty("仓库编码") + @Excel(name = "仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @ApiModelProperty("物料基础信息id") + @Excel(name = "物料基础信息id") + private Long materialBaseInfoId; + + @ApiModelProperty("物料编码") + @Excel(name = "物料编码") + private String materialCode; + + @ApiModelProperty("物料名称") + @Excel(name = "物料名称") + private String materialName; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("入库单类型编码") + @Excel(name = "入库单类型编码") + private String inOrderTypeCode; + + @ApiModelProperty("入库单类型名称") + @Excel(name = "入库单类型名称") + private String inOrderTypeName; + + @ApiModelProperty("预计到货时间 开始") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间 开始", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date inOrderExpectStartTime; + + @ApiModelProperty("预计到货时间 结束") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间 结束", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date inOrderExpectEndTime; + + @ApiModelProperty("出库单号") + @Excel(name = "出库单号") + private String outOrderNumber; + + @ApiModelProperty("出库单类型编码") + @Excel(name = "出库单类型编码") + private String outOrderTypeCode; + + @ApiModelProperty("出库单类型名称") + @Excel(name = "出库单类型名称") + private String outOrderTypeName; + + @ApiModelProperty("预计出货时间 开始") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间 开始", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date outOrderExpectStartTime; + + @ApiModelProperty("预计出货时间 结束") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间 结束", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date outOrderExpectEndTime; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private List shipperIdList; + + @ApiModelProperty("物料编码") + @Excel(name = "物料编码") + private List materialBaseInfoIdList; + + @ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + @Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + private Integer inStatus; + + @ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭") + @Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-拣货中 6-波次中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭") + private Integer outStatus; + + @ApiModelProperty("越库单状态 0:无状态 1:处理中 2:越库完成") + @Excel(name = "越库单状态 0:无状态 1:处理中 2:越库完成") + private Integer overStockStatus; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailBaseDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailBaseDO.java new file mode 100644 index 000000000..e2430a912 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailBaseDO.java @@ -0,0 +1,42 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.repository.todo; + +import com.mhd.common.core.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author ZhouGY + * @title StockBaseDO + * @description: TODO + * @date 2024/5/23 20:30 + **/ +@Data +public class ReservationInMaterialDetailBaseDO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("收货单号") + @Excel(name = "收货单号") + private String receiptOrderNumber; + + @ApiModelProperty("上架单号") + @Excel(name = "上架单号") + private String shelfOrderNumber; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDO.java new file mode 100644 index 000000000..1ec61ae3a --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDO.java @@ -0,0 +1,373 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.repository.todo; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.mhd.common.core.annotation.Excel; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderBaseDO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + + +/** + * 物料明细对象 material_detail + * + * @author gen + * @date 2024-05-21 + */ + +@Data +public class ReservationInMaterialDetailDO extends ReservationStockInOrderBaseDO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("订单物料明细id") + private Long materialDetailId; + + @ApiModelProperty("业务唯一id") + @JsonSerialize(using = ToStringSerializer.class) + private Long uniqueId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("物料基础信息id") + @Excel(name = "物料基础信息id") + private Long materialBaseInfoId; + + @ApiModelProperty("物料编码") + @Excel(name = "物料编码") + private String materialCode; + + @ApiModelProperty("物料名称") + @Excel(name = "物料名称") + private String materialName; + + @ApiModelProperty("物料条形码") + @Excel(name = "物料条形码") + private String barCode; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; + + @ApiModelProperty("收货数量") + @Excel(name = "收货数量") + private BigDecimal receiptQuantity; + + @ApiModelProperty("上架数量") + @Excel(name = "上架数量") + private BigDecimal shelvesQuantity; + + @ApiModelProperty("作业数量(例如:收货数量 上架数量)") + @Excel(name = "作业数量(例如:收货数量 上架数量)") + private BigDecimal actualQuantity; + + @ApiModelProperty("收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)") + @Excel(name = "收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)") + private Integer receiptStatus; + + @ApiModelProperty("上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)") + @Excel(name = "上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)") + private Integer shelvesStatus; + + @ApiModelProperty("包装规格id") + @Excel(name = "包装规格id") + private Long packId; + + @ApiModelProperty("包装规格编码") + @Excel(name = "包装规格编码") + private String packCode; + + @ApiModelProperty("包装规格名称") + @Excel(name = "包装规格名称") + private String packName; + + @ApiModelProperty("包装详情id") + @Excel(name = "包装详情id") + private Long packDetailId; + + @ApiModelProperty("单位代码:EA IP CS PL OT") + @Excel(name = "单位代码:EA IP CS PL OT") + private String unitCode; + + @ApiModelProperty("单位名称") + @Excel(name = "单位名称") + private String unitName; + + @ApiModelProperty("单位数量") + @Excel(name = "单位数量") + private BigDecimal unitNumber; + + @ApiModelProperty("物料仓库控制信息id") + @Excel(name = "物料仓库控制信息id") + private Long materialWarehouseControlId; + + @ApiModelProperty("是否序列号管理: 1-是 2-否") + @Excel(name = "是否序列号管理: 1-是 2-否") + private Integer serialNumberManage; + + @ApiModelProperty("是否质检管理: 1-是 2-否") + @Excel(name = "是否质检管理: 1-是 2-否") + private Integer qualityInspectionManage; + + @ApiModelProperty("质检阶段: 1-收货前 2-收货后上架前") + @Excel(name = "质检阶段: 1-收货前 2-收货后上架前") + private Integer qualityInspectionStage; + + @ApiModelProperty("质检规则: 1-全检 2-抽检 ") + @Excel(name = "质检规则: 1-全检 2-抽检 ") + private Integer qualityInspectionRule; + + @ApiModelProperty("抽检比例") + @Excel(name = "抽检比例") + private BigDecimal qualityInspectionRatio; + + @ApiModelProperty("质检项: 1-包装 2-纯度") + @Excel(name = "质检项: 1-包装 2-纯度") + private Integer qualityInspectionTerm; + + @ApiModelProperty("质检结果: 1-正常 2-异常") + @Excel(name = "质检结果: 1-正常 2-异常") + private Integer qualityInspectionResults; + + @ApiModelProperty("是否允许超收: 1-是 2-否") + @Excel(name = "是否允许超收: 1-是 2-否") + private Integer allowOvercharge; + + @ApiModelProperty("超收比例") + @Excel(name = "超收比例") + private BigDecimal overchargeRatio; + + @ApiModelProperty("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @ApiModelProperty("分配规则id") + @Excel(name = "分配规则id") + private Long distributeRuleId; + + @ApiModelProperty("分配规则编码") + @Excel(name = "分配规则编码") + private String distributeRuleCode; + + @ApiModelProperty("分配规则名称") + @Excel(name = "分配规则名称") + private String distributeRuleName; + + @ApiModelProperty("容器id") + @Excel(name = "容器id") + private Long containerId; + + @ApiModelProperty("容器编码") + @Excel(name = "容器编码") + private String containerCode; + + @ApiModelProperty("容器类型 数据字典") + @Excel(name = "容器类型 数据字典") + private String containerType; + + @ApiModelProperty("容器类型名称 数据字典") + @Excel(name = "容器类型名称 数据字典") + private String containerTypeName; + + @ApiModelProperty("上架仓库id") + private Long warehouseId; + + @ApiModelProperty("上架仓库编码") + @Excel(name = "上架仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("上架库区id") + @Excel(name = "上架库区id") + private Long storageSectionId; + + @ApiModelProperty("上架库区编码") + @Excel(name = "上架库区编码") + private String storageCode; + + @ApiModelProperty("上架库区名称") + @Excel(name = "上架库区名称") + private String storageName; + + @ApiModelProperty("上架库位id") + @Excel(name = "上架库位id") + private Long storageLocationId; + + @ApiModelProperty("上架库位编码") + @Excel(name = "上架库位编码") + private String storageLocationCode; + + @ApiModelProperty("上架库位名称") + @Excel(name = "上架库位名称") + private String storageLocationName; + + @ApiModelProperty("层级深度,从一级开始递增") + private Integer level; + + @ApiModelProperty("父级唯一Id") + private Long parentUniqueId; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty("物料明细子集") + private List children; + +// @ApiModelProperty("更多属性") +// private List materialMoreDetailList; + +// @ApiModelProperty("序列号") +// private List materialDetailSerialNumberList; + + @ApiModelProperty("入库单号集合") + @Excel(name = "入库单号集合") + private List inOrderNumberList; + + // ========== 报关相关明细字段 ========== + @ApiModelProperty("规格型号(选择物料后自动带出,不可编辑)") + @Excel(name = "规格型号/ITEM") + private String specificationModel; + + @ApiModelProperty("SKU码(选择物料后自动带出,不可编辑)") + @Excel(name = "SKU码") + private String skuCode; + + @ApiModelProperty("Invoice No.") + @Excel(name = "Invoice No.") + private String invoiceNo; + + @ApiModelProperty("升(输入大于等于0的数字,可以为小数)") + @Excel(name = "升") + private BigDecimal liter; + + @ApiModelProperty("尺寸") + @Excel(name = "尺寸") + private String dimensions; + + @ApiModelProperty("申报单位") + @Excel(name = "申报单位") + private String declarationUnit; + + @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 originCountry; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("币制") + @Excel(name = "币制") + private String currency; + + @ApiModelProperty("单位(数据字典下拉选择框)") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("申报数量(输入大于等于0的数字,可以为小数)") + @Excel(name = "申报数量") + private BigDecimal declaredQuantity; + + @ApiModelProperty("箱数(输入大于等于0的数字,可以为小数)") + @Excel(name = "箱数") + private BigDecimal boxCount; + + @ApiModelProperty("件数(输入大于等于0的数字,可以为小数)") + @Excel(name = "件数") + private BigDecimal pieceCount; + + @ApiModelProperty("入库数量(输入大于等于0的数字,可以为小数)") + @Excel(name = "ruku数量") + private BigDecimal inboundQuantity; + + @ApiModelProperty("总净重(KG)(输入大于等于0的数字,可以为小数)") + @Excel(name = "总净重(KG)") + private BigDecimal totalNetWeight; + + @ApiModelProperty("总毛重(KG)(输入大于等于0的数字,可以为小数)") + @Excel(name = "总毛重(KG)") + private BigDecimal totalGrossWeight; + + @ApiModelProperty("总体积(CBM)(输入大于等于0的数字,可以为小数)") + @Excel(name = "总体积(CBM)") + private BigDecimal totalVolume; + + @ApiModelProperty("总面积(SQM)(输入大于等于0的数字,可以为小数)") + @Excel(name = "总面积(SQM)") + private BigDecimal totalArea; + + @ApiModelProperty("总价(输入大于等于0的数字,可以为小数)") + @Excel(name = "总价") + private BigDecimal totalPrice; + + + @ApiModelProperty("合同收费") + @Excel(name = "合同收费") + private BigDecimal contractFee; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseFee; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWhFee; + + @ApiModelProperty("折扣(%)") + @Excel(name = "折扣(%)") + private BigDecimal discountRate; + + @ApiModelProperty("单体积(CBM)") + @Excel(name = "单体积(CBM)") + private BigDecimal singleVolume; + + @ApiModelProperty("单毛重(KG)") + @Excel(name = "单毛重(KG)") + private BigDecimal singleGrossWeight; + + @ApiModelProperty("lot编号") + @Excel(name = "lot编号") + private String lotNo; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDTO.java new file mode 100644 index 000000000..5b250bbb2 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDTO.java @@ -0,0 +1,381 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.repository.todo; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 物料明细对象 material_detail + * + * @author gen + * @date 2024-05-21 + */ + +@Data +public class ReservationInMaterialDetailDTO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("订单物料明细id") + private Long materialDetailId; + + @ApiModelProperty("业务唯一id") + @JsonSerialize(using = ToStringSerializer.class) + private Long uniqueId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("物料库存id") + @Excel(name = "物料库存id") + private Long materialInventoryId; + + @ApiModelProperty("物料基础信息id") + @Excel(name = "物料基础信息id") + private Long materialBaseInfoId; + + @ApiModelProperty("物料编码") + @Excel(name = "物料编码") + private String materialCode; + + @ApiModelProperty("物料名称") + @Excel(name = "物料名称") + private String materialName; + + @ApiModelProperty("物料条形码") + @Excel(name = "物料条形码") + private String barCode; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; + + @ApiModelProperty("收货数量") + @Excel(name = "收货数量") + private BigDecimal receiptQuantity; + + @ApiModelProperty("上架数量") + @Excel(name = "上架数量") + private BigDecimal shelvesQuantity; + + @ApiModelProperty("作业数量(例如:收货数量 上架数量)") + @Excel(name = "作业数量(例如:收货数量 上架数量)") + private BigDecimal actualQuantity; + + @ApiModelProperty("收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)") + @Excel(name = "收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)") + private Integer receiptStatus; + + @ApiModelProperty("上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)") + @Excel(name = "上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)") + private Integer shelvesStatus; + + @ApiModelProperty("包装规格id") + @Excel(name = "包装规格id") + private Long packId; + + @ApiModelProperty("包装规格编码") + @Excel(name = "包装规格编码") + private String packCode; + + @ApiModelProperty("包装规格名称") + @Excel(name = "包装规格名称") + private String packName; + + @ApiModelProperty("包装详情id") + @Excel(name = "包装详情id") + private Long packDetailId; + + @ApiModelProperty("单位代码:EA IP CS PL OT") + @Excel(name = "单位代码:EA IP CS PL OT") + private String unitCode; + + @ApiModelProperty("单位名称") + @Excel(name = "单位名称") + private String unitName; + + @ApiModelProperty("单位数量") + @Excel(name = "单位数量") + private BigDecimal unitNumber; + + @ApiModelProperty("物料仓库控制信息id") + @Excel(name = "物料仓库控制信息id") + private Long materialWarehouseControlId; + + @ApiModelProperty("是否序列号管理: 1-是 2-否") + @Excel(name = "是否序列号管理: 1-是 2-否") + private Integer serialNumberManage; + + @ApiModelProperty("是否质检管理: 1-是 2-否") + @Excel(name = "是否质检管理: 1-是 2-否") + private Integer qualityInspectionManage; + + @ApiModelProperty("质检阶段: 1-收货前 2-收货后上架前") + @Excel(name = "质检阶段: 1-收货前 2-收货后上架前") + private Integer qualityInspectionStage; + + @ApiModelProperty("质检规则: 1-全检 2-抽检 ") + @Excel(name = "质检规则: 1-全检 2-抽检 ") + private Integer qualityInspectionRule; + + @ApiModelProperty("抽检比例") + @Excel(name = "抽检比例") + private BigDecimal qualityInspectionRatio; + + @ApiModelProperty("质检项: 1-包装 2-纯度") + @Excel(name = "质检项: 1-包装 2-纯度") + private Integer qualityInspectionTerm; + + @ApiModelProperty("质检结果: 1-正常 2-异常") + @Excel(name = "质检结果: 1-正常 2-异常") + private Integer qualityInspectionResults; + + @ApiModelProperty("是否允许超收: 1-是 2-否") + @Excel(name = "是否允许超收: 1-是 2-否") + private Integer allowOvercharge; + + @ApiModelProperty("超收比例") + @Excel(name = "超收比例") + private BigDecimal overchargeRatio; + + @ApiModelProperty("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @ApiModelProperty("分配规则id") + @Excel(name = "分配规则id") + private Long distributeRuleId; + + @ApiModelProperty("分配规则编码") + @Excel(name = "分配规则编码") + private String distributeRuleCode; + + @ApiModelProperty("分配规则名称") + @Excel(name = "分配规则名称") + private String distributeRuleName; + + @ApiModelProperty("容器id") + @Excel(name = "容器id") + private Long containerId; + + @ApiModelProperty("容器编码") + @Excel(name = "容器编码") + private String containerCode; + + @ApiModelProperty("容器类型 数据字典") + @Excel(name = "容器类型 数据字典") + private String containerType; + + @ApiModelProperty("容器类型名称 数据字典") + @Excel(name = "容器类型名称 数据字典") + private String containerTypeName; + + @ApiModelProperty("上架仓库id") + private Long warehouseId; + + @ApiModelProperty("上架仓库编码") + @Excel(name = "上架仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("上架库区id") + @Excel(name = "上架库区id") + private Long storageSectionId; + + @ApiModelProperty("上架库区编码") + @Excel(name = "上架库区编码") + private String storageCode; + + @ApiModelProperty("上架库区名称") + @Excel(name = "上架库区名称") + private String storageName; + + @ApiModelProperty("上架库位id") + @Excel(name = "上架库位id") + private Long storageLocationId; + + @ApiModelProperty("上架库位编码") + @Excel(name = "上架库位编码") + private String storageLocationCode; + + @ApiModelProperty("上架库位名称") + @Excel(name = "上架库位名称") + private String storageLocationName; + + @ApiModelProperty("层级深度,从一级开始递增") + private Integer level; + + @ApiModelProperty("父级唯一Id") + @JsonSerialize(using = ToStringSerializer.class) + private Long parentUniqueId; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + +// @ApiModelProperty("更多属性") +// private List materialMoreDetailList; + +// @ApiModelProperty("序列号") +// private List materialDetailSerialNumberList; + + @ApiModelProperty("入库单号集合") + @Excel(name = "入库单号集合") + private List inOrderNumberList; + + @ApiModelProperty("是否是差异单") + private Integer isDifferentType; + + // ========== 报关相关明细字段 ========== + @ApiModelProperty("规格型号(选择物料后自动带出,不可编辑)") + @Excel(name = "规格型号/ITEM") + private String specificationModel; + + @ApiModelProperty("SKU码(选择物料后自动带出,不可编辑)") + @Excel(name = "SKU码") + private String skuCode; + + @ApiModelProperty("Invoice No.") + @Excel(name = "Invoice No.") + private String invoiceNo; + + @ApiModelProperty("升(输入大于等于0的数字,可以为小数)") + @Excel(name = "升") + private BigDecimal liter; + + @ApiModelProperty("尺寸") + @Excel(name = "尺寸") + private String dimensions; + + @ApiModelProperty("申报单位") + @Excel(name = "申报单位") + private String declarationUnit; + + @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 originCountry; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("币制") + @Excel(name = "币制") + private String currency; + + @ApiModelProperty("单位(数据字典下拉选择框)") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("申报数量(输入大于等于0的数字,可以为小数)") + @Excel(name = "申报数量") + private BigDecimal declaredQuantity; + + @ApiModelProperty("箱数(输入大于等于0的数字,可以为小数)") + @Excel(name = "箱数") + private BigDecimal boxCount; + + @ApiModelProperty("件数(输入大于等于0的数字,可以为小数)") + @Excel(name = "件数") + private BigDecimal pieceCount; + + @ApiModelProperty("入库数量(输入大于等于0的数字,可以为小数)") + @Excel(name = "入库数量") + private BigDecimal inboundQuantity; + + @ApiModelProperty("出库数量(输入大于等于0的数字,可以为小数)") + @Excel(name = "出库数量") + private BigDecimal outboundQuantity; + + @ApiModelProperty("总净重(KG)(输入大于等于0的数字,可以为小数)") + @Excel(name = "总净重(KG)") + private BigDecimal totalNetWeight; + + @ApiModelProperty("总毛重(KG)(输入大于等于0的数字,可以为小数)") + @Excel(name = "总毛重(KG)") + private BigDecimal totalGrossWeight; + + @ApiModelProperty("总体积(CBM)(输入大于等于0的数字,可以为小数)") + @Excel(name = "总体积(CBM)") + private BigDecimal totalVolume; + + @ApiModelProperty("总面积(SQM)(输入大于等于0的数字,可以为小数)") + @Excel(name = "总面积(SQM)") + private BigDecimal totalArea; + + @ApiModelProperty("总价(输入大于等于0的数字,可以为小数)") + @Excel(name = "总价") + private BigDecimal totalPrice; + + @ApiModelProperty("合同收费") + @Excel(name = "合同收费") + private BigDecimal contractFee; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseFee; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWhFee; + + @ApiModelProperty("折扣(%)") + @Excel(name = "折扣(%)") + private BigDecimal discountRate; + + @ApiModelProperty("单体积(CBM)") + @Excel(name = "单体积(CBM)") + private BigDecimal singleVolume; + + @ApiModelProperty("单毛重(KG)") + @Excel(name = "单毛重(KG)") + private BigDecimal singleGrossWeight; + + @ApiModelProperty("lot编号") + @Excel(name = "lot编号") + private String lotNo; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailApplicationService.java new file mode 100644 index 000000000..ada2e5401 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailApplicationService.java @@ -0,0 +1,72 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.service; + +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO; +import com.mhd.system.api.model.LoginUser; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 物料明细ApplicationService + * + * @author gen + * @date 2024-05-21 + */ +@Service +@Slf4j +public class ReservationInMaterialDetailApplicationService { + @Autowired + private ReservationInMaterialDetailDomainService inMaterialDetailDomainService; + + + /** + * 分页查询物料明细列表 + */ + + public List queryList(ReservationInMaterialDetailDO inMaterialDetailDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null){ + Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); + if (topOrganizationId != null && topOrganizationId != 1){ + inMaterialDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + } + } + return inMaterialDetailDomainService.queryList(inMaterialDetailDO); + } + + + /** + * 新增物料明细 + */ + public Boolean insert(ReservationInMaterialDetailDO inMaterialDetailDO) { + + return inMaterialDetailDomainService.insert(inMaterialDetailDO); + } + + /** + * 修改物料明细 + */ + public Boolean update(ReservationInMaterialDetailDO inMaterialDetailDO) { + return inMaterialDetailDomainService.update(inMaterialDetailDO); + } + + /** + * 批量删除物料明细 + */ + public boolean delete(Long[] materialDetailIds) { + return inMaterialDetailDomainService.delete(materialDetailIds); + } + + /** + * 获取物料明细详细信息 + */ + public ReservationInMaterialDetailPO getInfo(Long materialDetailId) + { + return inMaterialDetailDomainService.getInfo(materialDetailId); + } + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailAssembler.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailAssembler.java new file mode 100644 index 000000000..4b3c59a4a --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailAssembler.java @@ -0,0 +1,65 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.service; + +import cn.hutool.core.util.ObjectUtil; +import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException; +import com.mhd.common.core.exception.digitalLogisticsException.UserError; +import com.mhd.common.core.utils.IgnoreNullUtil; +import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDTO; +import com.mhd.system.api.model.LoginUser; +import org.springframework.stereotype.Component; + +import java.util.Date; + +/** + * 物料明细Assembler + * + * @author gen + * @date 2024-05-21 + */ +@Component +public class ReservationInMaterialDetailAssembler { + + /** + * 转换实体 + */ + public ReservationInMaterialDetailDO toDO(ReservationInMaterialDetailDTO inMaterialDetailDTO) { + ReservationInMaterialDetailDO inMaterialDetailDO = new ReservationInMaterialDetailDO(); + // 拷贝 + BeanUtils.copyProperties(inMaterialDetailDTO, inMaterialDetailDO, IgnoreNullUtil.getNullPropertyNames(inMaterialDetailDTO)); + return inMaterialDetailDO; + } + + /** + * 转换实体 + */ + public ReservationInMaterialDetailDO toDOByEdit(ReservationInMaterialDetailDTO inMaterialDetailDTO) { + ReservationInMaterialDetailDO inMaterialDetailDO = new ReservationInMaterialDetailDO(); + // 拷贝 + BeanUtils.copyProperties(inMaterialDetailDTO, inMaterialDetailDO, IgnoreNullUtil.getNullPropertyNames(inMaterialDetailDTO)); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + String userName = loginUser.getUsername(); + // 获取登录人id + Long userId = loginUser.getUserid(); + if(inMaterialDetailDTO.getMaterialDetailId() != null){ + inMaterialDetailDO.setUpdateBy(userId); + inMaterialDetailDO.setUpdateByName(userName); + inMaterialDetailDO.setUpdateTime(new Date()); + }else { + inMaterialDetailDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); + inMaterialDetailDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + inMaterialDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + inMaterialDetailDO.setCreateBy(userId); + inMaterialDetailDO.setCreateByName(userName); + inMaterialDetailDO.setCreateTime(new Date()); + inMaterialDetailDO.setDelFlag(1); + } + return inMaterialDetailDO; + } + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailDomainService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailDomainService.java new file mode 100644 index 000000000..df52f32fb --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/service/ReservationInMaterialDetailDomainService.java @@ -0,0 +1,64 @@ +package com.mhd.oms.domain.reservationInMaterialDetail.service; + +import com.mhd.oms.domain.reservationInMaterialDetail.repository.facade.IReservationInMaterialDetailService; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 物料明细 + * + * @author gen + * @date 2024-05-21 + */ +@Service +@Slf4j +public class ReservationInMaterialDetailDomainService { + + @Autowired + private IReservationInMaterialDetailService materialDetailService; + + + /** + * 分页查询物料明细列表 + */ + public List queryList(ReservationInMaterialDetailDO inMaterialDetailDO) { + return materialDetailService.queryList(inMaterialDetailDO); + } + + + /** + * 新增物料明细 + */ + public Boolean insert(ReservationInMaterialDetailDO inMaterialDetailDO) { + + return materialDetailService.insert(inMaterialDetailDO); + } + + /** + * 修改物料明细 + */ + public Boolean update(ReservationInMaterialDetailDO inMaterialDetailDO) { + return materialDetailService.update(inMaterialDetailDO); + } + + /** + * 批量删除物料明细 + */ + public Boolean delete(Long[] materialDetailIds) { + return materialDetailService.delete(materialDetailIds); + } + + /** + * 获取物料明细详细信息 + */ + public com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO getInfo(Long materialDetailId) + { + return materialDetailService.getInfo(materialDetailId); + } + + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/entity/ReservationStockInOrder.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/entity/ReservationStockInOrder.java new file mode 100644 index 000000000..08c0626fb --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/entity/ReservationStockInOrder.java @@ -0,0 +1,355 @@ +package com.mhd.oms.domain.reservationStockInOrder.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; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; + + +/** + * 入库单对象 stock_in_order + * + * @author gen + * @date 2024-05-21 + */ + +@Data +public class ReservationStockInOrder extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("入库单id") + @TableId(type = IdType.AUTO) + private Long inOrderId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("仓库id") + @Excel(name = "仓库id") + private Long warehouseId; + + @ApiModelProperty("仓库编码") + @Excel(name = "仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("通知单号") + @Excel(name = "通知单号") + private String noticeNumber; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭") + @Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭") + private Integer status; + + @ApiModelProperty("入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + @Excel(name = "入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + private Integer auditStatus; + + @ApiModelProperty("入库单审核备注") + @Excel(name = "入库单审核备注") + private String auditRemark; + + @ApiModelProperty("入库单审核人") + @Excel(name = "入库单审核人") + private Long auditBy; + + @ApiModelProperty("入库单审核人姓名") + @Excel(name = "入库单审核人姓名") + private String auditByName; + + @ApiModelProperty("入库单审核时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "入库单审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date auditTime; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @ApiModelProperty("入库单类型编码") + @Excel(name = "入库单类型编码") + private String orderTypeCode; + + @ApiModelProperty("入库单类型名称") + @Excel(name = "入库单类型名称") + private String orderTypeName; + + @ApiModelProperty("供应商id") + @Excel(name = "供应商id") + private Long supplierId; + + @ApiModelProperty("供应商编码") + @Excel(name = "供应商编码") + private String supplierCode; + + @ApiModelProperty("供应商名称") + @Excel(name = "供应商名称") + private String supplierName; + + @ApiModelProperty("预计到货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expectTime; + + @ApiModelProperty("供应链订单号") + @Excel(name = "供应链订单号") + private String supplyChainNumber; + + @ApiModelProperty("优先级别编码") + @Excel(name = "优先级别编码") + private String priorityLevelCode; + + @ApiModelProperty("优先级别名称") + @Excel(name = "优先级别名称") + private String priorityLevelName; + + @ApiModelProperty("是否直接入库: 1-是 2-否") + @Excel(name = "是否直接入库: 1-是 2-否") + private Integer directWarehouse; + + @ApiModelProperty("附件url") + @Excel(name = "附件url") + private String annexUrl; + + @ApiModelProperty("物料种数") + @Excel(name = "物料种数") + private Integer materialQuantity; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; + + @ApiModelProperty("净重 单位:千克") + @Excel(name = "净重 单位:千克") + private BigDecimal weightLimit; + + @ApiModelProperty("体积 单位:立方米") + @Excel(name = "体积 单位:立方米") + private BigDecimal volumeLimit; + + @ApiModelProperty("是否取消订单: 1-是 2-否") + @Excel(name = "是否取消订单: 1-是 2-否") + private Integer cancelOrder; + + @ApiModelProperty("取消订单备注") + @Excel(name = "取消订单备注") + private String cancelRemark; + + @ApiModelProperty("取消订单人") + @Excel(name = "取消订单人") + private Long cancelBy; + + @ApiModelProperty("取消订单人姓名") + @Excel(name = "取消订单人姓名") + private String cancelByName; + + @ApiModelProperty("取消订单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "取消订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date cancelTime; + + @ApiModelProperty("是否关闭订单: 1-是 2-否") + @Excel(name = "是否关闭订单: 1-是 2-否") + private Integer closeOrder; + + @ApiModelProperty("关闭订单备注") + @Excel(name = "关闭订单备注") + private String closeRemark; + + @ApiModelProperty("关闭订单人") + @Excel(name = "关闭订单人") + private Long closeBy; + + @ApiModelProperty("关闭订单人姓名") + @Excel(name = "关闭订单人姓名") + private String closeByName; + + @ApiModelProperty("关闭订单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "关闭订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date closeTime; + + @ApiModelProperty("入库单来源: 1-正常录入 2-通知单生成 3-无单收货") + @Excel(name = "入库单来源: 1-正常录入 2-通知单生成 3-无单收货") + private Integer orderSource; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("调度单号") + private String mobilizeCode; + + @ApiModelProperty("越库单id") + private Long overStockId; + + @ApiModelProperty("越库单状态 0:无状态 1:处理中 2:越库完成") + @Excel(name = "越库单状态 0:无状态 1:处理中 2:越库完成") + private Integer overStockStatus; + + @ApiModelProperty("越库类型:1-直接越库 2-分拨越库") + @Excel(name = "越库类型:1-直接越库 2-分拨越库") + private Long overStockType; + + // ========== 报关相关字段 ========== + @ApiModelProperty("To") + @Excel(name = "To") + @TableField(value = "\"TO\"") + private String to; + + @ApiModelProperty("联系人") + @Excel(name = "联系人") + private String contactPerson; + + @ApiModelProperty("车型及车牌") + @Excel(name = "车型及车牌") + private String vehicleInfo; + + @ApiModelProperty("委托编号NO") + @Excel(name = "委托编号NO") + private String consignmentNo; + + @ApiModelProperty("Tel") + @Excel(name = "Tel") + private String tel; + + @ApiModelProperty("司机签名") + @Excel(name = "司机签名") + private String driverSignature; + + @ApiModelProperty("Fax") + @Excel(name = "Fax") + private String fax; + + @ApiModelProperty("申报地关区") + @Excel(name = "申报地关区") + private String declarationArea; + + @ApiModelProperty("生产商") + @Excel(name = "生产商") + private String manufacturer; + + @ApiModelProperty("报关员姓名及联系方式") + @Excel(name = "报关员姓名及联系方式") + private String customsBrokerInfo; + + @ApiModelProperty("送货地址") + @Excel(name = "送货地址") + private String deliveryAddress; + + @ApiModelProperty("进出境关别") + @Excel(name = "进出境关别") + private String entryExitCustoms; + + @ApiModelProperty("起运/运抵国(地区)") + @Excel(name = "起运/运抵国(地区)") + private String originDestinationCountry; + + @ApiModelProperty("承运商") + @Excel(name = "承运商") + private String carrier; + + @ApiModelProperty("柜号") + @Excel(name = "柜号") + private String containerNo; + + @ApiModelProperty("运输方式") + @Excel(name = "运输方式") + private String transportMethod; + + @ApiModelProperty("监管方式") + @Excel(name = "监管方式") + private String supervisionMethod; + + @ApiModelProperty("海关是否查验货物") + @Excel(name = "海关是否查验货物") + private Integer customsInspection; + + @ApiModelProperty("是否需要报关") + @Excel(name = "是否需要报关") + private Integer needCustomsDeclaration; + + @ApiModelProperty("是否需要运输") + @Excel(name = "是否需要运输") + private Integer needTransport; + + @ApiModelProperty("入仓日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入仓日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date warehouseDate; + + @ApiModelProperty("完成时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date completionTime; + + @ApiModelProperty("下单日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date orderDate; + + @ApiModelProperty("业务单号") + @Excel(name = "业务单号") + private String businessOrderNo; + + @ApiModelProperty("业务类型") + @Excel(name = "业务类型") + private String businessType; + + @ApiModelProperty("制单人") + @Excel(name = "制单人") + private String documentCreator; + + @ApiModelProperty("制单人名称") + @Excel(name = "制单人名称") + private String documentCreatorName; + + @ApiModelProperty("制单日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date documentDate; + + @ApiModelProperty("订单状态") + @Excel(name = "订单状态") + private String orderStatus; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java new file mode 100644 index 000000000..973534596 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java @@ -0,0 +1,44 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.facade; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mhd.oms.domain.reservationStockInOrder.entity.ReservationStockInOrder; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.ReservationStockInOrderPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDO; + + +import java.util.List; + +/** + * 入库单Service接口 + * + * @author gen + * @date 2024-05-21 + */ +public interface IReservationStockInOrderService extends IService +{ + /** + * 分页查询入库单列表 + */ + public List queryList(ReservationStockInOrderDO stockInOrderDO); + + /** + * 新增入库单 + */ + public Boolean insert(ReservationStockInOrderDO stockInOrderDO); + + /** + * 修改入库单 + */ + public Boolean update(ReservationStockInOrderDO stockInOrderDO); + + /** + * 批量删除入库单 + */ + public Boolean delete(Long[] inOrderIds); + + + /** + * 查询入库单 + */ + public ReservationStockInOrderPO getInfo(Long inOrderId); +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java new file mode 100644 index 000000000..bef7b9a50 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java @@ -0,0 +1,33 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.oms.domain.reservationStockInOrder.entity.ReservationStockInOrder; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialGoodsRulePO; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialWarehouseControlPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.ReservationStockInOrderPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 入库单Mapper接口 + * + * @author gen + * @date 2024-05-21 + */ +public interface ReservationStockInOrderMapper extends BaseMapper +{ + /** + * 查询入库单列表 + */ + public List queryList(ReservationStockInOrderDO stockInOrderDO); + + public MaterialBaseInfoPO getinfo(@Param("id") Long id); + + public MaterialWarehouseControlPO getInfoByMaterialBaseInfoIds(@Param("id") Long id); + + public MaterialGoodsRulePO getGoodsInfoByMaterialBaseInfoIds(@Param("id") Long id); + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java new file mode 100644 index 000000000..6dc46ea43 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java @@ -0,0 +1,84 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.persistence; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mhd.oms.domain.reservationStockInOrder.entity.ReservationStockInOrder; +import com.mhd.oms.domain.reservationStockInOrder.repository.facade.IReservationStockInOrderService; +import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.ReservationStockInOrderPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * 入库单Service业务层处理 + * + * @author gen + * @date 2024-05-21 + */ +@Service +public class ReservationStockInOrderImpl extends ServiceImpl implements IReservationStockInOrderService { + @Autowired + private ReservationStockInOrderMapper stockInOrderMapper; + + /** + * 查询入库单列表 + */ + @Override + public List queryList(ReservationStockInOrderDO stockInOrderDO) + { + return stockInOrderMapper.queryList(stockInOrderDO); + } + + /** + * 新增入库单 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public Boolean insert(ReservationStockInOrderDO stockInOrderDO) { + ReservationStockInOrder stockInOrder = new ReservationStockInOrder(); + BeanUtils.copyProperties(stockInOrderDO,stockInOrder); + return this.save(stockInOrder); + } + + /** + * 修改入库单 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public Boolean update(ReservationStockInOrderDO stockInOrderDO) { + ReservationStockInOrder stockInOrder = new ReservationStockInOrder(); + BeanUtils.copyProperties(stockInOrderDO,stockInOrder); + return this.updateById(stockInOrder); + } + + /** + * 批量删除入库单 + */ + @Override + public Boolean delete(Long[] inOrderIds ) { + List list = new ArrayList<>(); + for (Long id : inOrderIds) { + ReservationStockInOrder stockInOrder = new ReservationStockInOrder(); + stockInOrder.setInOrderId(id); + stockInOrder.setDelFlag(2); + list.add(stockInOrder); + } + return this.updateBatchById(list); + } + + /** + * 修改入库单 + */ + @Override + public ReservationStockInOrderPO getInfo(Long inOrderId) { + ReservationStockInOrder stockInOrder = this.getById(inOrderId); + ReservationStockInOrderPO stockInOrderPO = new ReservationStockInOrderPO(); + BeanUtils.copyProperties(stockInOrder,stockInOrderPO); + return stockInOrderPO; + } +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialBaseInfoPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialBaseInfoPO.java new file mode 100644 index 000000000..7d3b8965b --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialBaseInfoPO.java @@ -0,0 +1,242 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.po; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.handler.ListTypeHandler; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + + +/** + * 物料基础信息对象 material_base_info + * + * @author gen + * @date 2024-05-07 + */ + +@Data +@ApiModel(value = "物料基础信息对象", description = "物料基础信息响应对象") +public class MaterialBaseInfoPO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料基础信息id") + private Long materialBaseInfoId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @ApiModelProperty("物料编码") + @Excel(name = "物料编码") + private String materialCode; + + @ApiModelProperty("物料名称") + @Excel(name = "物料名称") + private String materialName; + + @ApiModelProperty("物料条形码") + @Excel(name = "物料条形码") + private String barCode; + + @ApiModelProperty("物料分类编码") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyCode; + + @ApiModelProperty("物料分类名称") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyName; + + @ApiModelProperty("物料分类编码(导出用,逗号分隔)") + @Excel(name = "物料分类编码") + private String materialClassifyCodeStr; + + @ApiModelProperty("物料分类名称(导出用,逗号分隔)") + @Excel(name = "物料分类名称") + private String materialClassifyNameStr; + + @ApiModelProperty("物料种类编码 数据字典") + @Excel(name = "物料种类编码 数据字典") + private String materialType; + + @ApiModelProperty("物料种类名称 数据字典") + @Excel(name = "物料种类名称 数据字典") + private String materialTypeName; + + @ApiModelProperty("包装规格id") + @Excel(name = "包装规格id") + private Long packId; + + @ApiModelProperty("包装规格编码") + @Excel(name = "包装规格编码") + private String packCode; + + @ApiModelProperty("包装规格名称") + @Excel(name = "包装规格名称") + private String packName; + + @ApiModelProperty("包装单位编码") + @Excel(name = "包装单位编码") + private String unitCode; + + @ApiModelProperty("包装单位名称") + @Excel(name = "包装单位名称") + private String unitName; + + @ApiModelProperty("品牌id") + @Excel(name = "品牌id") + private Long brandId; + + @ApiModelProperty("品牌编码") + @Excel(name = "品牌编码") + private String brandCode; + + @ApiModelProperty("品牌名称") + @Excel(name = "品牌名称") + private String brandName; + + @ApiModelProperty("保质期 单位:天") + @Excel(name = "保质期 单位:天") + private Long shelfLife; + + @ApiModelProperty("净重 单位:千克") + @Excel(name = "净重 单位:千克") + private BigDecimal weightLimit; + + @ApiModelProperty("体积 单位:立方米") + @Excel(name = "体积 单位:立方米") + private BigDecimal volumeLimit; + + @ApiModelProperty("商品形态编码 数据字典") + @Excel(name = "商品形态编码 数据字典") + private String materialShape; + + @ApiModelProperty("商品形态名称 数据字典") + @Excel(name = "商品形态名称 数据字典") + private String materialShapeName; + + @ApiModelProperty("物料大小 长*宽*高 单位:米") + @Excel(name = "物料大小 长*宽*高 单位:米") + private String materialSize; + + @ApiModelProperty("物料大小-长 单位:米") + @Excel(name = "物料大小-长 单位:米") + private BigDecimal materialLength; + + @ApiModelProperty("物料大小-宽 单位:米") + @Excel(name = "物料大小-宽 单位:米") + private BigDecimal materialWidth; + + @ApiModelProperty("物料大小-高 单位:米") + @Excel(name = "物料大小-高 单位:米") + private BigDecimal materialHeight; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("是否作废: 1-是 2-否") + @Excel(name = "是否作废: 1-是 2-否") + private Integer nullify; + + @ApiModelProperty("单位数量") + @Excel(name = "单位数量") + private BigDecimal unitNumber; + + @ApiModelProperty("商品规则") + private MaterialGoodsRulePO materialGoodsRule; +// +// @ApiModelProperty("公共信息") +// private MaterialCommonPO materialCommon; + + @ApiModelProperty("仓库控制信息") + private MaterialWarehouseControlPO materialWarehouseControl; +// +// @ApiModelProperty("库存预警信息") +// private List materialInventoryWarningList; + +// @ApiModelProperty("条码信息") +// private List materialBarCodeList; +// +// @ApiModelProperty("物料批次属性") +// private List materialMoreDetailList; + + @ApiModelProperty("是否公用: 1-是 2-否") + @Excel(name = "是否公用: 1-是 2-否") + private Integer common; + + + @ApiModelProperty("SKU码") + private String skuCode; + + @ApiModelProperty("单价") + private BigDecimal unitPrice; + + @ApiModelProperty("币制") + private String currency; + + @ApiModelProperty("原产国") + private String originCountry; + + @ApiModelProperty("HS码") + private String hsCode; + + @ApiModelProperty("申报单位") + private String declarationUnit; + + @ApiModelProperty("法定单位") + private String statutoryUnit; + + @ApiModelProperty("法定第二单位") + private String statutorySecondUnit; + + @ApiModelProperty("规格型号") + private String specificationModel; + + @ApiModelProperty("批次ID") + @Excel(name = "批次ID") + private Long batchId; + + @ApiModelProperty("批次编码") + @Excel(name = "批次编码") + private String batchCode; + + @ApiModelProperty("批次名称") + @Excel(name = "批次名称") + private String batchName; + + @ApiModelProperty("库存预警数量") + @Excel(name = "库存预警数量") + private Integer inventoryWarningCount; + + @ApiModelProperty("临期预警数量") + @Excel(name = "临期预警数量") + private Integer expirationWarningCount; + //库存件数 + private BigDecimal stockQuantity; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialGoodsRulePO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialGoodsRulePO.java new file mode 100644 index 000000000..936aaa467 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialGoodsRulePO.java @@ -0,0 +1,131 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.po; + +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * 物料商品规则对象 material_goods_rule + * + * @author gen + * @date 2024-05-07 + */ + +@Data +@ApiModel(value = "物料商品规则对象", description = "物料商品规则响应对象") +public class MaterialGoodsRulePO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("商品规则id") + private Long materialGoodsRuleId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("物料基础信息id") + @Excel(name = "物料基础信息id") + private Long materialBaseInfoId; + + @ApiModelProperty("批次id") + @Excel(name = "批次id") + private Long batchId; + + @ApiModelProperty("批次编码") + @Excel(name = "批次编码") + private String batchCode; + + @ApiModelProperty("批次名称") + @Excel(name = "批次名称") + private String batchName; + + @ApiModelProperty("上架库区id") + @Excel(name = "上架库区id") + private Long storageSectionId; + + @ApiModelProperty("上架库区编码") + @Excel(name = "上架库区编码") + private String storageCode; + + @ApiModelProperty("上架库区名称") + @Excel(name = "上架库区名称") + private String storageName; + + @ApiModelProperty("上架库位id") + @Excel(name = "上架库位id") + private Long storageLocationId; + + @ApiModelProperty("上架库位编码") + @Excel(name = "上架库位编码") + private String storageLocationCode; + + @ApiModelProperty("上架库位名称") + @Excel(name = "上架库位名称") + private String storageLocationName; + + @ApiModelProperty("上架规则id") + @Excel(name = "上架规则id") + private Long ruleId; + + @ApiModelProperty("上架规则编码") + @Excel(name = "上架规则编码") + private String ruleCode; + + @ApiModelProperty("上架规则名称") + @Excel(name = "上架规则名称") + private String ruleName; + + @ApiModelProperty("上架库位指定规则id") + @Excel(name = "上架库位指定规则id") + private Long specifyRuleId; + + @ApiModelProperty("上架库位指定规则编码") + @Excel(name = "上架库位指定规则编码") + private String specifyRuleCode; + + @ApiModelProperty("上架库位指定规则名称") + @Excel(name = "上架库位指定规则名称") + private String specifyRuleName; + + @ApiModelProperty("周转规则id") + @Excel(name = "周转规则id") + private Long turnoverRuleId; + + @ApiModelProperty("周转规则编码") + @Excel(name = "周转规则编码") + private String turnoverRuleCode; + + @ApiModelProperty("周转规则名称") + @Excel(name = "周转规则名称") + private String turnoverRuleName; + + @ApiModelProperty("分配规则id") + @Excel(name = "分配规则id") + private Long distributeRuleId; + + @ApiModelProperty("分配规则编码") + @Excel(name = "分配规则编码") + private String distributeRuleCode; + + @ApiModelProperty("分配规则名称") + @Excel(name = "分配规则名称") + private String distributeRuleName; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialWarehouseControlPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialWarehouseControlPO.java new file mode 100644 index 000000000..7a988e715 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialWarehouseControlPO.java @@ -0,0 +1,97 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.po; + +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + + +/** + * 仓库控制信息对象 material_warehouse_control + * + * @author gen + * @date 2024-05-07 + */ + +@Data +@ApiModel(value = "仓库控制信息对象", description = "仓库控制信息响应对象") +public class MaterialWarehouseControlPO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("商品规则id") + private Long materialWarehouseControlId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("物料基础信息id") + @Excel(name = "物料基础信息id") + private Long materialBaseInfoId; + + @ApiModelProperty("是否效期控制: 1-是 2-否") + @Excel(name = "是否效期控制: 1-是 2-否") + private Integer temperatureControl; + + @ApiModelProperty("周期类型: 1-生产日期 2-失效日期") + @Excel(name = "周期类型: 1-生产日期 2-失效日期") + private Integer cycleType; + + @ApiModelProperty("入库效期 单位:天") + @Excel(name = "入库效期 单位:天") + private Integer inValidityPeriod; + + @ApiModelProperty("入库效期 单位:天") + @Excel(name = "入库效期 单位:天") + private Integer outValidityPeriod; + + @ApiModelProperty("是否允许超收: 1-是 2-否") + @Excel(name = "是否允许超收: 1-是 2-否") + private Integer allowOvercharge; + + @ApiModelProperty("超收比例") + @Excel(name = "超收比例") + private BigDecimal overchargeRatio; + + @ApiModelProperty("ABC分类:A-A类 B-B类 C-C类") + @Excel(name = "ABC分类:A-A类 B-B类 C-C类") + private String classify; + + @ApiModelProperty("是否序列号管理: 1-是 2-否") + @Excel(name = "是否序列号管理: 1-是 2-否") + private Integer serialNumberManage; + + @ApiModelProperty("是否质检管理: 1-是 2-否") + @Excel(name = "是否质检管理: 1-是 2-否") + private Integer qualityInspectionManage; + + @ApiModelProperty("质检阶段: 1-收货前 2-收货后上架前") + @Excel(name = "质检阶段: 1-收货前 2-收货后上架前") + private Integer qualityInspectionStage; + + @ApiModelProperty("质检规则: 1-全检 2-抽检 ") + @Excel(name = "质检规则: 1-全检 2-抽检 ") + private Integer qualityInspectionRule; + + @ApiModelProperty("质检项: 1-包装 2-纯度") + @Excel(name = "质检项: 1-包装 2-纯度") + private Integer qualityInspectionTerm; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/ReservationStockInOrderBasePO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/ReservationStockInOrderBasePO.java new file mode 100644 index 000000000..a6b208248 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/ReservationStockInOrderBasePO.java @@ -0,0 +1,116 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.po; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author ZhouGY + * @title StockInOrderBasePO + * @description: TODO + * @date 2024/5/22 11:50 + **/ +@Data +public class ReservationStockInOrderBasePO extends BaseVOEntity { + + @ApiModelProperty("通知单号") + @Excel(name = "通知单号") + private String noticeNumber; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("仓库id") + @Excel(name = "仓库id") + private Long warehouseId; + + @ApiModelProperty("仓库编码") + @Excel(name = "仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主code") + @Excel(name = "货主code") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @ApiModelProperty("入库单类型编码") + @Excel(name = "入库单类型编码") + private String orderTypeCode; + + @ApiModelProperty("入库单类型名称") + @Excel(name = "入库单类型名称") + private String orderTypeName; + + @ApiModelProperty("供应商id") + @Excel(name = "供应商id") + private Long supplierId; + + @ApiModelProperty("供应商编码") + @Excel(name = "供应商编码") + private String supplierCode; + + @ApiModelProperty("供应商名称") + @Excel(name = "供应商名称") + private String supplierName; + + @ApiModelProperty("预计到货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expectTime; + + @ApiModelProperty("供应链订单号") + @Excel(name = "供应链订单号") + private String supplyChainNumber; + + @ApiModelProperty("优先级别编码") + @Excel(name = "优先级别编码") + private String priorityLevelCode; + + @ApiModelProperty("优先级别名称") + @Excel(name = "优先级别名称") + private String priorityLevelName; + + @ApiModelProperty("是否直接入库: 1-是 2-否") + @Excel(name = "是否直接入库: 1-是 2-否") + private Integer directWarehouse; + + @ApiModelProperty("附件url") + @Excel(name = "附件url") + private String annexUrl; + + @ApiModelProperty("物料种数") + @Excel(name = "物料种数") + private Integer materialQuantity; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; + + @ApiModelProperty("净重 单位:千克") + @Excel(name = "净重 单位:千克") + private BigDecimal weightLimit; + + @ApiModelProperty("体积 单位:立方米") + @Excel(name = "体积 单位:立方米") + private BigDecimal volumeLimit; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/ReservationStockInOrderPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/ReservationStockInOrderPO.java new file mode 100644 index 000000000..e33e68bd1 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/ReservationStockInOrderPO.java @@ -0,0 +1,376 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.po; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + + +/** + * 入库单对象 stock_in_order + * + * @author gen + * @date 2024-05-21 + */ + +@Data +@ApiModel(value = "入库单对象", description = "入库单响应对象") +public class ReservationStockInOrderPO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("入库单id") + private Long inOrderId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("仓库id") + @Excel(name = "仓库id") + private Long warehouseId; + + @ApiModelProperty("仓库编码") + @Excel(name = "仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("通知单号") + @Excel(name = "通知单号") + private String noticeNumber; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + @Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + private Integer status; + + @ApiModelProperty("入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + @Excel(name = "入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + private Integer auditStatus; + + @ApiModelProperty("入库单审核备注") + @Excel(name = "入库单审核备注") + private String auditRemark; + + @ApiModelProperty("入库单审核人") + @Excel(name = "入库单审核人") + private Long auditBy; + + @ApiModelProperty("入库单审核人姓名") + @Excel(name = "入库单审核人姓名") + private String auditByName; + + @ApiModelProperty("入库单审核时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "入库单审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date auditTime; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @ApiModelProperty("入库单类型编码") + @Excel(name = "入库单类型编码") + private String orderTypeCode; + + @ApiModelProperty("入库单类型名称") + @Excel(name = "入库单类型名称") + private String orderTypeName; + + @ApiModelProperty("供应商id") + @Excel(name = "供应商id") + private Long supplierId; + + @ApiModelProperty("供应商编码") + @Excel(name = "供应商编码") + private String supplierCode; + + @ApiModelProperty("供应商名称") + @Excel(name = "供应商名称") + private String supplierName; + + @ApiModelProperty("预计到货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expectTime; + + @ApiModelProperty("供应链订单号") + @Excel(name = "供应链订单号") + private String supplyChainNumber; + + @ApiModelProperty("优先级别编码") + @Excel(name = "优先级别编码") + private String priorityLevelCode; + + @ApiModelProperty("优先级别名称") + @Excel(name = "优先级别名称") + private String priorityLevelName; + + @ApiModelProperty("是否直接入库: 1-是 2-否") + @Excel(name = "是否直接入库: 1-是 2-否") + private Integer directWarehouse; + + @ApiModelProperty("附件url") + @Excel(name = "附件url") + private String annexUrl; + + @ApiModelProperty("物料种数") + @Excel(name = "物料种数") + private Integer materialQuantity; + + @ApiModelProperty("计划数量(原字段)") + @Excel(name = "计划数量(原字段)") + private BigDecimal quantity; + + /** + * 计划入库数量:取入库单明细中的入库数量汇总 + */ + @ApiModelProperty("计划入库数量") + @Excel(name = "计划入库数量") + private BigDecimal planInQuantity; + + /** + * 收货数量:入库单对应的收货单实际收货数量汇总 + */ + @ApiModelProperty("收货数量") + @Excel(name = "收货数量") + private BigDecimal receiptQuantity; + + /** + * 上架数量:入库单对应的上架单实际上架数量汇总 + */ + @ApiModelProperty("上架数量") + @Excel(name = "上架数量") + private BigDecimal shelvesQuantity; + + @ApiModelProperty("净重 单位:千克") + @Excel(name = "净重 单位:千克") + private BigDecimal weightLimit; + + @ApiModelProperty("体积 单位:立方米") + @Excel(name = "体积 单位:立方米") + private BigDecimal volumeLimit; + + @ApiModelProperty("是否取消订单: 1-是 2-否") + @Excel(name = "是否取消订单: 1-是 2-否") + private Integer cancelOrder; + + @ApiModelProperty("取消订单备注") + @Excel(name = "取消订单备注") + private String cancelRemark; + + @ApiModelProperty("取消订单人") + @Excel(name = "取消订单人") + private Long cancelBy; + + @ApiModelProperty("取消订单人姓名") + @Excel(name = "取消订单人姓名") + private String cancelByName; + + @ApiModelProperty("取消订单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "取消订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date cancelTime; + + @ApiModelProperty("是否关闭订单: 1-是 2-否") + @Excel(name = "是否关闭订单: 1-是 2-否") + private Integer closeOrder; + + @ApiModelProperty("关闭订单备注") + @Excel(name = "关闭订单备注") + private String closeRemark; + + @ApiModelProperty("关闭订单人") + @Excel(name = "关闭订单人") + private Long closeBy; + + @ApiModelProperty("关闭订单人姓名") + @Excel(name = "关闭订单人姓名") + private String closeByName; + + @ApiModelProperty("关闭订单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "关闭订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date closeTime; + + @ApiModelProperty("入库单来源: 1-正常录入 2-通知单生成 3-无单收货") + @Excel(name = "入库单来源: 1-正常录入 2-通知单生成 3-无单收货") + private Integer orderSource; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("物料明细") + private List materialDetailList; + + @ApiModelProperty("越库单id") + private Long overStockId; + + @ApiModelProperty("越库单状态 0:无状态 1:处理中 2:越库完成") + @Excel(name = "越库单状态 0:无状态 1:处理中 2:越库完成") + private Integer overStockStatus; + + @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 vehicleInfo; + + @ApiModelProperty("委托编号NO") + @Excel(name = "委托编号NO") + private String consignmentNo; + + @ApiModelProperty("Tel") + @Excel(name = "Tel") + private String tel; + + @ApiModelProperty("司机签名") + @Excel(name = "司机签名") + private String driverSignature; + + @ApiModelProperty("Fax") + @Excel(name = "Fax") + private String fax; + + @ApiModelProperty("申报地关区") + @Excel(name = "申报地关区") + private String declarationArea; + + @ApiModelProperty("生产商") + @Excel(name = "生产商") + private String manufacturer; + + @ApiModelProperty("报关员姓名及联系方式") + @Excel(name = "报关员姓名及联系方式") + private String customsBrokerInfo; + + @ApiModelProperty("送货地址") + @Excel(name = "送货地址") + private String deliveryAddress; + + @ApiModelProperty("进出境关别") + @Excel(name = "进出境关别") + private String entryExitCustoms; + + @ApiModelProperty("起运/运抵国(地区)") + @Excel(name = "起运/运抵国(地区)") + private String originDestinationCountry; + + @ApiModelProperty("承运商") + @Excel(name = "承运商") + private String carrier; + + @ApiModelProperty("柜号") + @Excel(name = "柜号") + private String containerNo; + + @ApiModelProperty("运输方式") + @Excel(name = "运输方式") + private String transportMethod; + + @ApiModelProperty("监管方式") + @Excel(name = "监管方式") + private String supervisionMethod; + + @ApiModelProperty("海关是否查验货物") + @Excel(name = "海关是否查验货物") + private Integer customsInspection; + + @ApiModelProperty("是否需要报关") + @Excel(name = "是否需要报关") + private Integer needCustomsDeclaration; + + @ApiModelProperty("是否需要运输") + @Excel(name = "是否需要运输") + private Integer needTransport; + + @ApiModelProperty("入仓日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入仓日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date warehouseDate; + + @ApiModelProperty("完成时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date completionTime; + + @ApiModelProperty("下单日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date orderDate; + + + @ApiModelProperty("业务单号") + @Excel(name = "业务单号") + private String businessOrderNo; + + @ApiModelProperty("业务类型") + @Excel(name = "业务类型") + private String businessType; + + @ApiModelProperty("制单人") + @Excel(name = "制单人") + private String documentCreator; + + @ApiModelProperty("制单人名称") + @Excel(name = "制单人名称") + private String documentCreatorName; + + @ApiModelProperty("制单日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date documentDate; + + @ApiModelProperty("订单状态") + @Excel(name = "订单状态") + private String orderStatus; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderBaseDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderBaseDO.java new file mode 100644 index 000000000..5a1cc0c07 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderBaseDO.java @@ -0,0 +1,111 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.todo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author ZhouGY + * @title StockInOrderBasePO + * @description: TODO + * @date 2024/5/22 11:50 + **/ +@Data +public class ReservationStockInOrderBaseDO extends BaseVOEntity { + + @ApiModelProperty("通知单号") + @Excel(name = "通知单号") + private String noticeNumber; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("仓库id") + @Excel(name = "仓库id") + private Long warehouseId; + + @ApiModelProperty("仓库编码") + @Excel(name = "仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @ApiModelProperty("入库单类型编码") + @Excel(name = "入库单类型编码") + private String orderTypeCode; + + @ApiModelProperty("入库单类型名称") + @Excel(name = "入库单类型名称") + private String orderTypeName; + + @ApiModelProperty("供应商id") + @Excel(name = "供应商id") + private Long supplierId; + + @ApiModelProperty("供应商编码") + @Excel(name = "供应商编码") + private String supplierCode; + + @ApiModelProperty("供应商名称") + @Excel(name = "供应商名称") + private String supplierName; + + @ApiModelProperty("预计到货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expectTime; + + @ApiModelProperty("供应链订单号") + @Excel(name = "供应链订单号") + private String supplyChainNumber; + + @ApiModelProperty("优先级别编码") + @Excel(name = "优先级别编码") + private String priorityLevelCode; + + @ApiModelProperty("优先级别名称") + @Excel(name = "优先级别名称") + private String priorityLevelName; + + @ApiModelProperty("是否直接入库: 1-是 2-否") + @Excel(name = "是否直接入库: 1-是 2-否") + private Integer directWarehouse; + + @ApiModelProperty("附件url") + @Excel(name = "附件url") + private String annexUrl; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; + + @ApiModelProperty("净重 单位:千克") + @Excel(name = "净重 单位:千克") + private BigDecimal weightLimit; + + @ApiModelProperty("体积 单位:立方米") + @Excel(name = "体积 单位:立方米") + private BigDecimal volumeLimit; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderBaseDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderBaseDTO.java new file mode 100644 index 000000000..7bc1b9071 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderBaseDTO.java @@ -0,0 +1,110 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.todo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author ZhouGY + * @title StockInOrderBasePO + * @description: TODO + * @date 2024/5/22 11:50 + **/ +@Data +public class ReservationStockInOrderBaseDTO extends BaseVOEntity { + + @ApiModelProperty("通知单号") + @Excel(name = "通知单号") + private String noticeNumber; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("仓库id") + @Excel(name = "仓库id") + private Long warehouseId; + + @ApiModelProperty("仓库编码") + @Excel(name = "仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + /** + * 兼容前端使用 userName 作为货主名称字段: + * 如果请求体中只传了 userName,将在组装器中自动回填到 shipperName。 + */ + @ApiModelProperty("货主名称(兼容字段:userName)") + private String userName; + + @ApiModelProperty("入库单类型编码") + @Excel(name = "入库单类型编码") + private String orderTypeCode; + + @ApiModelProperty("入库单类型名称") + @Excel(name = "入库单类型名称") + private String orderTypeName; + + @ApiModelProperty("供应商id") + @Excel(name = "供应商id") + private Long supplierId; + + @ApiModelProperty("供应商编码") + @Excel(name = "供应商编码") + private String supplierCode; + + @ApiModelProperty("供应商名称") + @Excel(name = "供应商名称") + private String supplierName; + + @ApiModelProperty("预计到货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expectTime; + + @ApiModelProperty("供应链订单号") + @Excel(name = "供应链订单号") + private String supplyChainNumber; + + @ApiModelProperty("优先级别编码") + @Excel(name = "优先级别编码") + private String priorityLevelCode; + + @ApiModelProperty("优先级别名称") + @Excel(name = "优先级别名称") + private String priorityLevelName; + + @ApiModelProperty("是否直接入库: 1-是 2-否") + @Excel(name = "是否直接入库: 1-是 2-否") + private Integer directWarehouse; + + @ApiModelProperty("附件url") + @Excel(name = "附件url") + private String annexUrl; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderDO.java new file mode 100644 index 000000000..4c05e31c7 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderDO.java @@ -0,0 +1,382 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.todo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + + +/** + * 入库单对象 stock_in_order + * + * @author gen + * @date 2024-05-21 + */ + +@Data +public class ReservationStockInOrderDO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("入库单id") + private Long inOrderId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("仓库id") + @Excel(name = "仓库id") + private Long warehouseId; + + @ApiModelProperty("仓库编码") + @Excel(name = "仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("通知单号") + @Excel(name = "通知单号") + private String noticeNumber; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + @Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + private Integer status; + + @ApiModelProperty("入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + @Excel(name = "入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + private Integer auditStatus; + + @ApiModelProperty("入库单审核备注") + @Excel(name = "入库单审核备注") + private String auditRemark; + + @ApiModelProperty("入库单审核人") + @Excel(name = "入库单审核人") + private Long auditBy; + + @ApiModelProperty("入库单审核人姓名") + @Excel(name = "入库单审核人姓名") + private String auditByName; + + @ApiModelProperty("入库单审核时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "入库单审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date auditTime; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @ApiModelProperty("入库单类型编码") + @Excel(name = "入库单类型编码") + private String orderTypeCode; + + @ApiModelProperty("入库单类型名称") + @Excel(name = "入库单类型名称") + private String orderTypeName; + + @ApiModelProperty("供应商id") + @Excel(name = "供应商id") + private Long supplierId; + + @ApiModelProperty("供应商编码") + @Excel(name = "供应商编码") + private String supplierCode; + + @ApiModelProperty("供应商名称") + @Excel(name = "供应商名称") + private String supplierName; + + @ApiModelProperty("预计到货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expectTime; + + @ApiModelProperty("供应链订单号") + @Excel(name = "供应链订单号") + private String supplyChainNumber; + + @ApiModelProperty("优先级别编码") + @Excel(name = "优先级别编码") + private String priorityLevelCode; + + @ApiModelProperty("优先级别名称") + @Excel(name = "优先级别名称") + private String priorityLevelName; + + @ApiModelProperty("是否直接入库: 1-是 2-否") + @Excel(name = "是否直接入库: 1-是 2-否") + private Integer directWarehouse; + + @ApiModelProperty("附件url") + @Excel(name = "附件url") + private String annexUrl; + + @ApiModelProperty("物料种数") + @Excel(name = "物料种数") + private Integer materialQuantity; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; + + @ApiModelProperty("净重 单位:千克") + @Excel(name = "净重 单位:千克") + private BigDecimal weightLimit; + + @ApiModelProperty("体积 单位:立方米") + @Excel(name = "体积 单位:立方米") + private BigDecimal volumeLimit; + + @ApiModelProperty("是否取消订单: 1-是 2-否") + @Excel(name = "是否取消订单: 1-是 2-否") + private Integer cancelOrder; + + @ApiModelProperty("取消订单备注") + @Excel(name = "取消订单备注") + private String cancelRemark; + + @ApiModelProperty("取消订单人") + @Excel(name = "取消订单人") + private Long cancelBy; + + @ApiModelProperty("取消订单人姓名") + @Excel(name = "取消订单人姓名") + private String cancelByName; + + @ApiModelProperty("取消订单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "取消订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date cancelTime; + + @ApiModelProperty("是否关闭订单: 1-是 2-否") + @Excel(name = "是否关闭订单: 1-是 2-否") + private Integer closeOrder; + + @ApiModelProperty("关闭订单备注") + @Excel(name = "关闭订单备注") + private String closeRemark; + + @ApiModelProperty("关闭订单人") + @Excel(name = "关闭订单人") + private Long closeBy; + + @ApiModelProperty("关闭订单人姓名") + @Excel(name = "关闭订单人姓名") + private String closeByName; + + @ApiModelProperty("关闭订单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "关闭订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date closeTime; + + @ApiModelProperty("入库单来源: 1-正常录入 2-通知单生成 3-无单收货") + @Excel(name = "入库单来源: 1-正常录入 2-通知单生成 3-无单收货") + private Integer orderSource; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty("入库单id集合") + private List inOrderIds; + + @ApiModelProperty("物料明细") + private List materialDetailList; + + @ApiModelProperty("小于某个入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + @Excel(name = "小于某个入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + private Integer ltStatus; + + @ApiModelProperty("大于某个入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + @Excel(name = "大于某个入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + private Integer gtStatus; + + @ApiModelProperty("小于入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + @Excel(name = "小于入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + private Integer ltAuditStatus; + + @ApiModelProperty("小于入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + @Excel(name = "小于入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + private Integer gtAuditStatus; + + @ApiModelProperty("调度单号") + private String mobilizeCode; + + // ========== 报关相关字段 ========== + @ApiModelProperty("To") + @Excel(name = "To") + private String to; + + @ApiModelProperty("联系人") + @Excel(name = "联系人") + private String contactPerson; + + @ApiModelProperty("车型及车牌") + @Excel(name = "车型及车牌") + private String vehicleInfo; + + @ApiModelProperty("委托编号NO") + @Excel(name = "委托编号NO") + private String consignmentNo; + + @ApiModelProperty("Tel") + @Excel(name = "Tel") + private String tel; + + @ApiModelProperty("司机签名") + @Excel(name = "司机签名") + private String driverSignature; + + @ApiModelProperty("Fax") + @Excel(name = "Fax") + private String fax; + + @ApiModelProperty("申报地关区") + @Excel(name = "申报地关区") + private String declarationArea; + + @ApiModelProperty("生产商") + @Excel(name = "生产商") + private String manufacturer; + + @ApiModelProperty("报关员姓名及联系方式") + @Excel(name = "报关员姓名及联系方式") + private String customsBrokerInfo; + + @ApiModelProperty("送货地址") + @Excel(name = "送货地址") + private String deliveryAddress; + + @ApiModelProperty("进出境关别") + @Excel(name = "进出境关别") + private String entryExitCustoms; + + @ApiModelProperty("起运/运抵国(地区)") + @Excel(name = "起运/运抵国(地区)") + private String originDestinationCountry; + + @ApiModelProperty("承运商(先做成输入框,待定)") + @Excel(name = "承运商") + private String carrier; + + @ApiModelProperty("柜号(数据字典:20尺/40尺)") + @Excel(name = "柜号") + private String containerNo; + + @ApiModelProperty("运输方式(数据字典:公路运输/其他运输)") + @Excel(name = "运输方式") + private String transportMethod; + + @ApiModelProperty("监管方式(数据字典:一般贸易)") + @Excel(name = "监管方式") + private String supervisionMethod; + + @ApiModelProperty("海关是否查验货物(默认:否)") + @Excel(name = "海关是否查验货物") + private Integer customsInspection; + + @ApiModelProperty("是否需要报关(默认:是)") + @Excel(name = "是否需要报关") + private Integer needCustomsDeclaration; + + @ApiModelProperty("是否需要运输(默认:否)") + @Excel(name = "是否需要运输") + private Integer needTransport; + + @ApiModelProperty("入仓日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入仓日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date warehouseDate; + + @ApiModelProperty("完成时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date completionTime; + + @ApiModelProperty("下单日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date orderDate; + + + @ApiModelProperty("业务单号") + @Excel(name = "业务单号") + private String businessOrderNo; + + @ApiModelProperty("业务类型") + @Excel(name = "业务类型") + private String businessType; + + @ApiModelProperty("制单人") + @Excel(name = "制单人") + private String documentCreator; + + @ApiModelProperty("制单人名称") + @Excel(name = "制单人名称") + private String documentCreatorName; + + @ApiModelProperty("制单日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date documentDate; + + @ApiModelProperty("订单状态") + @Excel(name = "订单状态") + private String orderStatus; + + @ApiModelProperty(name = "创建时间查询条件开始日期") + private String createTimeStart; + + @ApiModelProperty(name = "创建时间查询条件结束日期") + private String createTimeEnd; + + @ApiModelProperty("入库明细-物料名称(商品名称),模糊匹配") + private String materialName; + + @ApiModelProperty("入库明细-物料编码,模糊匹配") + private String materialCode; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderDTO.java new file mode 100644 index 000000000..a0d9715f2 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderDTO.java @@ -0,0 +1,379 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.todo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 入库单对象 stock_in_order + * + * @author gen + * @date 2024-05-21 + */ + +@Data +public class ReservationStockInOrderDTO extends ReservationStockInOrderBaseDTO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("入库单id") + private Long inOrderId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("仓库id") + @Excel(name = "仓库id") + private Long warehouseId; + + @ApiModelProperty("仓库编码") + @Excel(name = "仓库编码") + private String warehouseCode; + + @ApiModelProperty("仓库名称") + @Excel(name = "仓库名称") + private String warehouseName; + + @ApiModelProperty("通知单号") + @Excel(name = "通知单号") + private String noticeNumber; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + @Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + private Integer status; + + @ApiModelProperty("入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + @Excel(name = "入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + private Integer auditStatus; + + @ApiModelProperty("入库单审核备注") + @Excel(name = "入库单审核备注") + private String auditRemark; + + @ApiModelProperty("入库单审核人") + @Excel(name = "入库单审核人") + private Long auditBy; + + @ApiModelProperty("入库单审核人姓名") + @Excel(name = "入库单审核人姓名") + private String auditByName; + + @ApiModelProperty("入库单审核时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "入库单审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date auditTime; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @ApiModelProperty("入库单类型编码") + @Excel(name = "入库单类型编码") + private String orderTypeCode; + + @ApiModelProperty("入库单类型名称") + @Excel(name = "入库单类型名称") + private String orderTypeName; + + @ApiModelProperty("供应商id") + @Excel(name = "供应商id") + private Long supplierId; + + @ApiModelProperty("供应商编码") + @Excel(name = "供应商编码") + private String supplierCode; + + @ApiModelProperty("供应商名称") + @Excel(name = "供应商名称") + private String supplierName; + + @ApiModelProperty("预计到货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "预计到货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expectTime; + + @ApiModelProperty("供应链订单号") + @Excel(name = "供应链订单号") + private String supplyChainNumber; + + @ApiModelProperty("优先级别编码") + @Excel(name = "优先级别编码") + private String priorityLevelCode; + + @ApiModelProperty("优先级别名称") + @Excel(name = "优先级别名称") + private String priorityLevelName; + + @ApiModelProperty("是否直接入库: 1-是 2-否") + @Excel(name = "是否直接入库: 1-是 2-否") + private Integer directWarehouse; + + @ApiModelProperty("附件url") + @Excel(name = "附件url") + private String annexUrl; + + @ApiModelProperty("物料种数") + @Excel(name = "物料种数") + private Integer materialQuantity; + + @ApiModelProperty("计划数量") + @Excel(name = "计划数量") + private BigDecimal quantity; + + @ApiModelProperty("净重 单位:千克") + @Excel(name = "净重 单位:千克") + private BigDecimal weightLimit; + + @ApiModelProperty("体积 单位:立方米") + @Excel(name = "体积 单位:立方米") + private BigDecimal volumeLimit; + + @ApiModelProperty("是否取消订单: 1-是 2-否") + @Excel(name = "是否取消订单: 1-是 2-否") + private Integer cancelOrder; + + @ApiModelProperty("取消订单备注") + @Excel(name = "取消订单备注") + private String cancelRemark; + + @ApiModelProperty("取消订单人") + @Excel(name = "取消订单人") + private Long cancelBy; + + @ApiModelProperty("取消订单人姓名") + @Excel(name = "取消订单人姓名") + private String cancelByName; + + @ApiModelProperty("取消订单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "取消订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date cancelTime; + + @ApiModelProperty("是否关闭订单: 1-是 2-否") + @Excel(name = "是否关闭订单: 1-是 2-否") + private Integer closeOrder; + + @ApiModelProperty("关闭订单备注") + @Excel(name = "关闭订单备注") + private String closeRemark; + + @ApiModelProperty("关闭订单人") + @Excel(name = "关闭订单人") + private Long closeBy; + + @ApiModelProperty("关闭订单人姓名") + @Excel(name = "关闭订单人姓名") + private String closeByName; + + @ApiModelProperty("关闭订单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "关闭订单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date closeTime; + + @ApiModelProperty("入库单来源: 1-正常录入 2-通知单生成 3-无单收货") + @Excel(name = "入库单来源: 1-正常录入 2-通知单生成 3-无单收货") + private Integer orderSource; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty("入库单id集合") + private List inOrderIds; + + @ApiModelProperty("物料明细") + private List materialDetailList; + + @ApiModelProperty("小于某个入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + @Excel(name = "小于某个入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + private Integer ltStatus; + + @ApiModelProperty("大于某个入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + @Excel(name = "大于某个入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库") + private Integer gtStatus; + + @ApiModelProperty("小于入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + @Excel(name = "小于入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + private Integer ltAuditStatus; + + @ApiModelProperty("小于入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + @Excel(name = "小于入库单审核状态: 1-未审核 2-审核不通过 3-审核通过") + private Integer gtAuditStatus; + + // ========== 报关相关字段 ========== + @ApiModelProperty("To") + @Excel(name = "To") + private String to; + + @ApiModelProperty("联系人") + @Excel(name = "联系人") + private String contactPerson; + + @ApiModelProperty("车型及车牌") + @Excel(name = "车型及车牌") + private String vehicleInfo; + + @ApiModelProperty("委托编号NO") + @Excel(name = "委托编号NO") + private String consignmentNo; + + @ApiModelProperty("Tel") + @Excel(name = "Tel") + private String tel; + + @ApiModelProperty("司机签名") + @Excel(name = "司机签名") + private String driverSignature; + + @ApiModelProperty("Fax") + @Excel(name = "Fax") + private String fax; + + @ApiModelProperty("申报地关区") + @Excel(name = "申报地关区") + private String declarationArea; + + + @ApiModelProperty("生产商") + @Excel(name = "生产商") + private String manufacturer; + + @ApiModelProperty("报关员姓名及联系方式") + @Excel(name = "报关员姓名及联系方式") + private String customsBrokerInfo; + + @ApiModelProperty("送货地址") + @Excel(name = "送货地址") + private String deliveryAddress; + + @ApiModelProperty("进出境关别") + @Excel(name = "进出境关别") + private String entryExitCustoms; + + @ApiModelProperty("起运/运抵国(地区)") + @Excel(name = "起运/运抵国(地区)") + private String originDestinationCountry; + + @ApiModelProperty("承运商(先做成输入框,待定)") + @Excel(name = "承运商") + private String carrier; + + @ApiModelProperty("柜号(数据字典:20尺/40尺)") + @Excel(name = "柜号") + private String containerNo; + + @ApiModelProperty("运输方式(数据字典:公路运输/其他运输)") + @Excel(name = "运输方式") + private String transportMethod; + + @ApiModelProperty("监管方式(数据字典:一般贸易)") + @Excel(name = "监管方式") + private String supervisionMethod; + + @ApiModelProperty("海关是否查验货物(默认:否)") + @Excel(name = "海关是否查验货物") + private Integer customsInspection; + + @ApiModelProperty("是否需要报关(默认:是)") + @Excel(name = "是否需要报关") + private Integer needCustomsDeclaration; + + @ApiModelProperty("是否需要运输(默认:否)") + @Excel(name = "是否需要运输") + private Integer needTransport; + + @ApiModelProperty("入仓日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入仓日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date warehouseDate; + + @ApiModelProperty("完成时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date completionTime; + + @ApiModelProperty("下单日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date orderDate; + + + @ApiModelProperty("业务单号") + @Excel(name = "业务单号") + private String businessOrderNo; + + @ApiModelProperty("业务类型") + @Excel(name = "业务类型") + private String businessType; + + @ApiModelProperty("制单人") + @Excel(name = "制单人") + private String documentCreator; + + @ApiModelProperty("制单人名称") + @Excel(name = "制单人名称") + private String documentCreatorName; + + @ApiModelProperty("制单日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date documentDate; + + @ApiModelProperty("订单状态") + @Excel(name = "订单状态") + private String orderStatus; + + @ApiModelProperty(name = "创建时间查询条件开始日期") + private String createTimeStart; + + @ApiModelProperty(name = "创建时间查询条件结束日期") + private String createTimeEnd; + + @ApiModelProperty("入库明细-物料名称(商品名称),模糊匹配,与前端参数 materialName 一致") + private String materialName; + + @ApiModelProperty("入库明细-物料编码,模糊匹配,与前端参数 materialCode 一致") + private String materialCode; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderImportRowDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderImportRowDTO.java new file mode 100644 index 000000000..ccf0695c9 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/todo/ReservationStockInOrderImportRowDTO.java @@ -0,0 +1,211 @@ +package com.mhd.oms.domain.reservationStockInOrder.repository.todo; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 入库单导入行DTO(一个Excel行=一个明细行;表头字段可重复) + * + * 约定:以【委托编号NO】作为同一张入库单的分组键(同一个委托编号可导入多条物料明细) + */ +@Data +public class ReservationStockInOrderImportRowDTO { + + // ====== 分组/表头基础字段(建议在Excel中每行重复填写) ====== + // @Excel(name = "仓库ID") + // private Long warehouseId; + + // @Excel(name = "货主ID") + // private Long shipperId; + + @Excel(name = "货主编号") + private String shipperCode; + + // @Excel(name = "供应商ID") + // private Long supplierId; + + // @Excel(name = "入库单据类型") + // private String orderTypeCode; + + @Excel(name = "委托编号NO") + private String consignmentNo; + + // ====== 表头报关字段(与页面一致) ====== + @Excel(name = "To") + private String to; + + @Excel(name = "联系人") + private String contactPerson; + + @Excel(name = "车型及车牌") + private String vehicleInfo; + + @Excel(name = "Tel") + private String tel; + + @Excel(name = "司机签名") + private String driverSignature; + + @Excel(name = "Fax") + private String fax; + + @Excel(name = "申报地关区") + private String declarationArea; + + @Excel(name = "生产商") + private String manufacturer; + + @Excel(name = "报关员姓名及联系方式") + private String customsBrokerInfo; + + @Excel(name = "送货地址") + private String deliveryAddress; + + @Excel(name = "进出境关别") + private String entryExitCustoms; + + @Excel(name = "起运/运抵国(地区)") + private String originDestinationCountry; + + // 客户名称只在表头中,明细行不需要此字段(代码会从表头读取并应用到此字段) + @Excel(name = "客户名称") + private String shipperName; + + @Excel(name = "承运商") + private String carrier; + + @Excel(name = "柜号") + private String containerNo; + + @Excel(name = "运输方式") + private String transportMethod; + + @Excel(name = "监管方式") + private String supervisionMethod; + + @Excel(name = "海关是否查验货物") + private Integer customsInspection; + + @Excel(name = "是否需要报关") + private Integer needCustomsDeclaration; + + @Excel(name = "是否需要运输") + private Integer needTransport; + + @Excel(name = "入仓日期") + private String warehouseDate; // 导入先按字符串,后端可根据需要转Date(当前入库单服务未强制使用) + + @Excel(name = "完成时间") + private String completionTime; + + @Excel(name = "下单日期") + private String orderDate; + + @Excel(name = "备注") + private String remark; + + // ====== 明细字段(一个Excel行=一个明细) ====== + @Excel(name = "序号") + private Integer serialNumber; + + @Excel(name = "商品名称") + private String materialName; + + @Excel(name = "料号") + private String materialCode; + + // @Excel(name = "物料基础信息ID") + // private Long materialBaseInfoId; + + // 模板中没有此字段,注释掉 + // @Excel(name = "计划数量") + private BigDecimal quantity; + + @Excel(name = "仓库数量") + private BigDecimal warehouseQuantity; + + // 支持"入库数量"列名(与"仓库数量"映射到同一个字段) + @Excel(name = "入库数量") + private BigDecimal inboundQuantity; + + @Excel(name = "规格型号/ITEM") + private String specificationModel; + + @Excel(name = "商品SKU码") + private String skuCode; + + @Excel(name = "Invoice No.") + private String invoiceNo; + + @Excel(name = "申报数量") + private BigDecimal declaredQuantity; + + @Excel(name = "申报单位") + private String declarationUnit; + + @Excel(name = "升") + private BigDecimal liter; + + @Excel(name = "箱数") + private BigDecimal boxCount; + + @Excel(name = "件数") + private BigDecimal pieceCount; + + @Excel(name = "尺寸") + private String dimensions; + + // @Excel(name = "出库数量") + private BigDecimal outboundQuantity; + + @Excel(name = "单位") + private String unit; + + // 支持多种列名格式(处理换行符、空格、括号等) + @Excel(name = "总净重(KG)") + private BigDecimal totalNetWeight; + + @Excel(name = "总净重\n(KG)") + private BigDecimal totalNetWeight2; + + @Excel(name = "总毛重(KG)") + private BigDecimal totalGrossWeight; + + @Excel(name = "总毛重 (KG)") + private BigDecimal totalGrossWeight2; + + @Excel(name = "总体积(CBM)") + private BigDecimal totalVolume; + + @Excel(name = "总体积\n(CBM)") + private BigDecimal totalVolume2; + + @Excel(name = "总面积(SQM)") + private BigDecimal totalArea; + + @Excel(name = "总面积(SQM)") + private BigDecimal totalArea2; + + @Excel(name = "Batch Ref NO's") + private String batchRefNo; + + @Excel(name = "Sheet Ref NO's") + private String sheetRefNo; + + @Excel(name = "原产国") + private String originCountry; + + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @Excel(name = "总价") + private BigDecimal totalPrice; + + @Excel(name = "币制") + private String currency; + + @Excel(name = "备注") + private String detailRemark; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java new file mode 100644 index 000000000..98f4e80c0 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java @@ -0,0 +1,1859 @@ +package com.mhd.oms.domain.reservationStockInOrder.service; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.mhd.common.core.domain.po.UserPo; +import com.mhd.common.core.enums.DictCode; +import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.utils.StringUtils; +import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.ReservationStockInOrderPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDO; +import com.mhd.system.api.SystemServiceFeign; +import com.mhd.system.api.UserServiceFeign; +import com.mhd.system.api.domain.SysDictData; +import com.mhd.system.api.domain.WarehouseFeignPO; +import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO; +import com.mhd.system.api.domain.cache.SystemServiceCacheUtil; +import com.mhd.system.api.model.LoginUser; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.InputStream; +import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 入库单ApplicationService + * + * @author gen + * @date 2024-05-21 + */ +@Service +@Slf4j +public class ReservationStockInOrderApplicationService { + @Autowired + private ReservationStockInOrderDomainService stockInOrderDomainService; + @Autowired + private UserServiceFeign userServiceFeign; + @Autowired + private SystemServiceFeign systemServiceFeign; +// @Autowired +// private IMaterialBaseInfoService materialBaseInfoService; + + + /** + * 分页查询入库单列表 + */ + + public List queryList(ReservationStockInOrderDO stockInOrderDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null && loginUser.getUserPo() != null){ + Long userOrganizationId = loginUser.getUserPo().getOrganizationId(); + Long frontendOrganizationId = stockInOrderDO.getOrganizationId(); // 前端传递的 organizationId + + // 数据权限:根据 organizationId 来设置查询权限 + // 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己 + if (userOrganizationId != null && userOrganizationId == 2827L) { + // 南光组织(organizationId=2827):可以查询所有组织的数据 + // 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤 + // 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据 + if (frontendOrganizationId != null) { + // 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤 + stockInOrderDO.setOrganizationId(frontendOrganizationId); + stockInOrderDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件 + } else { + // 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据 + stockInOrderDO.setOrganizationId(null); + stockInOrderDO.setTopOrganizationId(null); + } + } else { + // 其他组织:设置organizationId,只查询当前组织的数据 + // 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致 + if (frontendOrganizationId != null && userOrganizationId != null) { + // 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致 + if (!frontendOrganizationId.equals(userOrganizationId)) { + // 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询 + stockInOrderDO.setOrganizationId(userOrganizationId); + } + // 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值 + } else { + // 前端没有传递 organizationId,使用当前登录用户的组织ID + if (userOrganizationId != null) { + stockInOrderDO.setOrganizationId(userOrganizationId); + } + } + // 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件 + // 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId + if (stockInOrderDO.getOrganizationId() == null) { + Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); + if (topOrganizationId != null && topOrganizationId != 1) { + stockInOrderDO.setTopOrganizationId(topOrganizationId); + } + } else { + // 对于非2827组织,必须设置 topOrganizationId=2827 + stockInOrderDO.setTopOrganizationId(2827L); + } + } + // 前端有传warehouseId则优先使用传参;未传时才使用"用户关联仓库"作为默认值 + if (stockInOrderDO.getWarehouseId() == null) { + AssociationWarehouseCacheDO associationWarehouseCacheDO = + SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid()); + if (associationWarehouseCacheDO != null) { + stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId()); + } + } + } + + // 库管角色过滤:不展示已创建(status=1)的入库单 + // 说明:部分场景下角色码可能不在 userPo.roleCode 中,而在 loginUser.roles/roleList 中。 + if (loginUser != null) { + String targetRoleCode = "KGY-001"; + boolean isKuGuan = false; + + String roleCode = loginUser.getUserPo() != null ? loginUser.getUserPo().getRoleCode() : null; + if (StringUtils.isNotBlank(roleCode) && roleCode.contains(targetRoleCode)) { + isKuGuan = true; + } + + if (!isKuGuan && loginUser.getRoleList() != null) { + isKuGuan = loginUser.getRoleList().stream() + .anyMatch(rc -> StringUtils.isNotBlank(rc) && rc.contains(targetRoleCode)); + } + + if (!isKuGuan && loginUser.getRoles() != null) { + isKuGuan = loginUser.getRoles().stream() + .anyMatch(rc -> StringUtils.isNotBlank(rc) && rc.contains(targetRoleCode)); + } + + if (isKuGuan) { + Integer currentGtStatus = stockInOrderDO.getGtStatus(); + if (currentGtStatus == null || currentGtStatus < 1) { + stockInOrderDO.setGtStatus(1); // status > 1 + } + } + } + return stockInOrderDomainService.queryList(stockInOrderDO); + } + + + /** + * 新增入库单 + */ + public Boolean insert(ReservationStockInOrderDO stockInOrderDO) { +// 如果仓库ID为空,从当前登录用户的关联仓库中获取 + if (stockInOrderDO.getWarehouseId() == null) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser == null) { + throw new ServiceException("登录已失效,请重新登录"); + } + AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid()); + if (associationWarehouseCacheDO == null || associationWarehouseCacheDO.getWarehouseId() == null) { + throw new ServiceException("当前用户未配置关联仓库,请先配置仓库"); + } + stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId()); + } + //设置仓库 + setWarehouseInfo(stockInOrderDO); +// 设置货主信息 + shipperParam(stockInOrderDO); +// 设置供应商信息 + supplierParam(stockInOrderDO); +// 设置数据字典键值 + setDataDict(stockInOrderDO); + return stockInOrderDomainService.insert(stockInOrderDO); + } + + /** + * 修改入库单 + */ + public Boolean update(ReservationStockInOrderDO stockInOrderDO) { + //设置仓库 + setWarehouseInfo(stockInOrderDO); + //设置货主信息 + shipperParam(stockInOrderDO); + //设置供应商信息 + supplierParam(stockInOrderDO); + //设置数据字典键值 + setDataDict(stockInOrderDO); + return stockInOrderDomainService.update(stockInOrderDO); + } + + /** + * 批量删除入库单 + * 只有已创建状态(status = 1)的入库单可以删除 + */ + public boolean delete(Long[] inOrderIds) { + if (inOrderIds == null || inOrderIds.length == 0) { + throw new ServiceException("删除的入库单ID不能为空"); + } + + // 查询入库单信息,检查状态 + for (Long inOrderId : inOrderIds) { + ReservationStockInOrderPO stockInOrderPO = stockInOrderDomainService.getInfo(inOrderId); + if (stockInOrderPO == null) { + throw new ServiceException("入库单不存在,入库单ID:" + inOrderId); + } + // 只有已创建状态(status = 1)的入库单可以删除 + if (stockInOrderPO.getStatus() == null || !stockInOrderPO.getStatus().equals(1)) { + throw new ServiceException("只有已创建状态的入库单可以删除,入库单号:" + stockInOrderPO.getInOrderNumber() + ",当前状态:" + getStatusName(stockInOrderPO.getStatus())); + } + } + + return stockInOrderDomainService.delete(inOrderIds); + } + + /** + * 获取入库状态名称 + */ + private String getStatusName(Integer status) { + if (status == null) { + return "未知"; + } + switch (status) { + case 1: return "已创建"; + case 2: return "已审核"; + case 3: return "收货中"; + case 4: return "上架中"; + case 5: return "已入库"; + case 6: return "已取消"; + case 7: return "已关闭"; + default: return "未知"; + } + } + + /** + * 获取入库单详细信息 + */ + public ReservationStockInOrderPO getInfo(Long inOrderId) + { + return stockInOrderDomainService.getInfo(inOrderId); + } + + + + /** + * @description 审核入库单 + * @author ZhouGY + * @date 2024/5/21 13:53 + * @param stockInOrderDO + * @return Boolean + */ + public Boolean auditState(ReservationStockInOrderDO stockInOrderDO){ + return stockInOrderDomainService.auditState(stockInOrderDO); + } + + /** + * @description 取消入库单 + * @author ZhouGY + * @date 2024/5/21 13:53 + * @param stockInOrderDO + * @return Boolean + */ + public Boolean cancelOrder(ReservationStockInOrderDO stockInOrderDO){ + return stockInOrderDomainService.cancelOrder(stockInOrderDO); + } + + + /** + * @description 关闭入库单 + * @author ZhouGY + * @date 2024/5/21 13:53 + * @param stockInOrderDO + * @return Boolean + */ + public Boolean closeOrder(ReservationStockInOrderDO stockInOrderDO){ + return stockInOrderDomainService.closeOrder(stockInOrderDO); + } + + /** + * 导入入库单(根据Excel模板:表头在第1-12行,明细表从第13行开始) + * Excel模板结构: + * - 第1-12行:表头信息(包含委托编号NO、客户名称等) + * - 第13行:明细表列名 + * - 第14行开始:明细数据 + */ +// public Boolean importData(MultipartFile file, Long warehouseId, String warehouseCode, String warehouseName) { +// if (file == null || file.isEmpty()) { +// throw new ServiceException("导入文件不能为空"); +// } +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (loginUser == null) { +// throw new ServiceException("登录已失效,请重新登录"); +// } +// +// try (InputStream is = file.getInputStream()) { +// // 明细表的列名在第13行(索引12),数据从第14行开始 +// int detailTitleRowIndex = 12; // 第13行(索引从0开始) +// +// // 先读取表头信息(第1-12行),提取所有表头字段 +// ReservationStockInOrderImportRowDTO headerInfo = new ReservationStockInOrderImportRowDTO(); +// try (InputStream isForHeader = file.getInputStream()) { +// Workbook wb = WorkbookFactory.create(isForHeader); +// Sheet sheet = wb.getSheetAt(0); +// +// // 从表头部分(第1-12行)读取所有字段信息 +// for (int rowIdx = 0; rowIdx < 12; rowIdx++) { +// Row row = sheet.getRow(rowIdx); +// if (row != null) { +// for (int colIdx = 0; colIdx < row.getPhysicalNumberOfCells(); colIdx++) { +// Cell labelCell = row.getCell(colIdx); +// if (labelCell != null) { +// String labelValue = getCellValueAsString(labelCell); +// if (StringUtils.isNotBlank(labelValue)) { +// // 调试日志:打印所有非空单元格内容 +// log.info("表头第{}行第{}列: {}", rowIdx + 1, colIdx + 1, labelValue); +// String value = null; +// +// // 先尝试从同一单元格提取值(如果包含冒号) +// String extractedFromSameCell = null; +// if (labelValue.contains(":")) { +// String[] parts = labelValue.split(":", 2); +// if (parts.length > 1) { +// extractedFromSameCell = parts[1].trim(); +// } +// } +// +// // 跳过空单元格,查找下一个非空单元格作为值(最多向后查找10列) +// String nextCellValue = null; +// for (int searchColIdx = colIdx + 1; searchColIdx < colIdx + 10 && searchColIdx < row.getPhysicalNumberOfCells(); searchColIdx++) { +// Cell valueCell = row.getCell(searchColIdx); +// if (valueCell != null) { +// String cellValue = getCellValueAsString(valueCell); +// if (StringUtils.isNotBlank(cellValue)) { +// nextCellValue = cellValue; +// log.info("表头第{}行,标签'{}'在第{}列,找到值'{}'在第{}列", rowIdx + 1, labelValue, colIdx + 1, nextCellValue, searchColIdx + 1); +// break; +// } +// } +// } +// +// // 优先使用下一个非空单元格的值(如果存在且不为空) +// // 如果下一个单元格为空,且同一单元格有冒号后的值,则使用冒号后的值 +// // 但如果冒号后的值是选项列表(如"3T、5T、8T、10T"),则应该使用下一个单元格的值 +// if (StringUtils.isNotBlank(nextCellValue)) { +// // 如果冒号后的值是选项列表(包含顿号、逗号等),优先使用下一个单元格的值 +// if (extractedFromSameCell != null && (extractedFromSameCell.contains("、") || extractedFromSameCell.contains(","))) { +// value = nextCellValue; +// } else { +// // 否则优先使用下一个单元格的值 +// value = nextCellValue; +// } +// } else if (StringUtils.isNotBlank(extractedFromSameCell)) { +// // 如果下一个单元格为空,使用同一单元格冒号后的值 +// value = extractedFromSameCell; +// } +// +// // 根据标签匹配字段 +// if (StringUtils.isNotBlank(value)) { +// // 委托编号NO(支持"委托编号NO"、"委托编号"等格式) +// if (labelValue.contains("委托编号") && StringUtils.isBlank(headerInfo.getConsignmentNo())) { +// // 排除标签本身和包含"NO"的标签文本 +// if (!value.contains("委托编号") && !value.contains("NO") && !value.equals("委托编号NO") && !value.equals("委托编号")) { +// headerInfo.setConsignmentNo(value); +// log.info("从表头第{}行读取到委托编号NO: {}", rowIdx + 1, value); +// } +// } +// // 客户名称 +// else if (labelValue.contains("客户名称") && StringUtils.isBlank(headerInfo.getShipperName())) { +// if (!value.contains("客户") && !value.equals("客户名称")) { +// headerInfo.setShipperName(value); +// log.info("从表头第{}行读取到客户名称: {}", rowIdx + 1, value); +// } +// } +// // To(需要精确匹配,避免误匹配) +// else if ((labelValue.equals("To") || labelValue.equals("To:") || labelValue.equals("To:") || labelValue.startsWith("To:") || labelValue.startsWith("To:")) && StringUtils.isBlank(headerInfo.getTo())) { +// // 如果值是"To"或"To:",说明可能是标签本身,继续查找下一个值 +// if (value.equals("To") || value.equals("To:") || value.equals("To:")) { +// // 继续向后查找,跳过标签(包含冒号的文本) +// boolean found = false; +// for (int searchColIdx = colIdx + 2; searchColIdx < colIdx + 10 && searchColIdx < row.getPhysicalNumberOfCells(); searchColIdx++) { +// Cell nextValueCell = row.getCell(searchColIdx); +// if (nextValueCell != null) { +// String nextValue = getCellValueAsString(nextValueCell); +// // 跳过标签文本(包含冒号、等于"To"等,以及常见的标签关键词) +// if (StringUtils.isNotBlank(nextValue) && +// !nextValue.equals("To") && !nextValue.equals("To:") && !nextValue.equals("To:") && +// !nextValue.contains(":") && !nextValue.contains(":") && +// !nextValue.contains("联系人") && !nextValue.contains("Tel") && !nextValue.contains("Fax") && +// !nextValue.contains("客户") && !nextValue.contains("地址") && !nextValue.contains("日期") && +// !nextValue.contains("方式") && !nextValue.contains("关区") && !nextValue.contains("关别")) { +// headerInfo.setTo(nextValue); +// log.info("从表头第{}行读取到To: {}", rowIdx + 1, nextValue); +// found = true; +// break; +// } +// } +// } +// // 如果没找到合适的值,尝试查找下一行的同一列 +// if (!found) { +// Row nextRow = sheet.getRow(rowIdx + 1); +// if (nextRow != null) { +// Cell nextRowCell = nextRow.getCell(colIdx); +// if (nextRowCell != null) { +// String nextRowValue = getCellValueAsString(nextRowCell); +// if (StringUtils.isNotBlank(nextRowValue) && +// !nextRowValue.contains(":") && !nextRowValue.contains(":") && +// !nextRowValue.equals("To") && !nextRowValue.equals("To:") && !nextRowValue.equals("To:")) { +// headerInfo.setTo(nextRowValue); +// log.info("从表头第{}行(下一行)读取到To: {}", rowIdx + 2, nextRowValue); +// } +// } +// } +// } +// } else if (!value.contains(":") && !value.contains(":") && +// !value.contains("联系人") && !value.contains("Tel") && !value.contains("Fax") && +// !value.contains("客户") && !value.contains("地址") && !value.contains("日期") && +// !value.contains("方式") && !value.contains("关区") && !value.contains("关别")) { +// // 值不是标签(不包含冒号和常见标签关键词),可以使用 +// headerInfo.setTo(value); +// log.info("从表头第{}行读取到To: {}", rowIdx + 1, value); +// } +// } else if (labelValue.contains("联系人") && StringUtils.isBlank(headerInfo.getContactPerson())) { +// headerInfo.setContactPerson(value); +// log.info("从表头第{}行读取到联系人: {}", rowIdx + 1, value); +// } else if ((labelValue.contains("车型") || labelValue.contains("车牌")) && StringUtils.isBlank(headerInfo.getVehicleInfo())) { +// // 过滤掉标签文本(包含冒号、常见标签关键词等) +// if (StringUtils.isNotBlank(value) && +// !value.contains(":") && !value.contains(":") && +// !value.contains("委托编号") && !value.contains("NO") && !value.contains("司机签名") && +// !value.contains("完成时间") && !value.contains("下单日期") && !value.contains("入仓日期") && +// !value.contains("联系人") && !value.contains("Tel") && !value.contains("Fax") && +// !value.contains("客户") && !value.contains("地址") && !value.contains("日期") && +// !value.contains("方式") && !value.contains("关区") && !value.contains("关别") && +// !value.contains("报关员") && !value.contains("生产商") && !value.contains("承运方") && +// !value.contains("柜号") && !value.contains("车型") && !value.contains("车牌")) { +// headerInfo.setVehicleInfo(value); +// log.info("从表头第{}行读取到车型及车牌: {}", rowIdx + 1, value); +// } else { +// // 如果找到的值是标签,继续向后查找 +// boolean found = false; +// boolean stopSearch = false; // 是否遇到下一个标签,需要停止搜索 +// for (int searchColIdx = colIdx + 2; searchColIdx < colIdx + 10 && searchColIdx < row.getPhysicalNumberOfCells(); searchColIdx++) { +// Cell nextValueCell = row.getCell(searchColIdx); +// if (nextValueCell != null) { +// String nextValue = getCellValueAsString(nextValueCell); +// if (StringUtils.isNotBlank(nextValue)) { +// // 检查是否遇到下一个标签(如"委托编号NO"),如果遇到则停止搜索 +// if (nextValue.contains("委托编号") || (nextValue.contains("NO") && nextValue.contains(":")) || +// nextValue.contains("司机签名") || nextValue.contains("完成时间") || nextValue.contains("下单日期") || +// nextValue.contains("入仓日期") || nextValue.contains("联系人") || nextValue.contains("Tel") || +// nextValue.contains("Fax") || nextValue.contains("客户名称") || nextValue.contains("送货地址") || +// nextValue.contains("申报地关区") || nextValue.contains("进出境关别") || nextValue.contains("起运") || +// nextValue.contains("运抵国") || nextValue.contains("柜号") || nextValue.contains("运输方式") || +// nextValue.contains("监管方式") || nextValue.contains("海关是否查验货物") || nextValue.contains("报关员")) { +// // 遇到下一个标签,停止搜索 +// stopSearch = true; +// log.warn("表头第{}行,标签'{}'在第{}列,向后搜索到第{}列时遇到下一个标签'{}',停止搜索,车型及车牌字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, searchColIdx + 1, nextValue); +// break; +// } +// // 跳过标签文本(包含冒号、常见标签关键词等) +// if (!nextValue.contains(":") && !nextValue.contains(":") && +// !nextValue.contains("委托编号") && !nextValue.contains("NO") && !nextValue.contains("司机签名") && +// !nextValue.contains("完成时间") && !nextValue.contains("下单日期") && !nextValue.contains("入仓日期") && +// !nextValue.contains("联系人") && !nextValue.contains("Tel") && !nextValue.contains("Fax") && +// !nextValue.contains("客户") && !nextValue.contains("地址") && !nextValue.contains("日期") && +// !nextValue.contains("方式") && !nextValue.contains("关区") && !nextValue.contains("关别") && +// !nextValue.contains("报关员") && !nextValue.contains("生产商") && !nextValue.contains("承运方") && +// !nextValue.contains("柜号") && !nextValue.contains("车型") && !nextValue.contains("车牌")) { +// headerInfo.setVehicleInfo(nextValue); +// log.info("从表头第{}行读取到车型及车牌: {}", rowIdx + 1, nextValue); +// found = true; +// break; +// } +// } +// } +// } +// // 如果没找到合适的值且未遇到下一个标签,尝试查找下一行的同一列 +// if (!found && !stopSearch) { +// Row nextRow = sheet.getRow(rowIdx + 1); +// if (nextRow != null) { +// Cell nextRowCell = nextRow.getCell(colIdx); +// if (nextRowCell != null) { +// String nextRowValue = getCellValueAsString(nextRowCell); +// if (StringUtils.isNotBlank(nextRowValue) && +// !nextRowValue.contains(":") && !nextRowValue.contains(":") && +// !nextRowValue.contains("委托编号") && !nextRowValue.contains("NO") && !nextRowValue.contains("司机签名") && +// !nextRowValue.contains("完成时间") && !nextRowValue.contains("下单日期") && !nextRowValue.contains("入仓日期") && +// !nextRowValue.contains("联系人") && !nextRowValue.contains("Tel") && !nextRowValue.contains("Fax") && +// !nextRowValue.contains("客户") && !nextRowValue.contains("地址") && !nextRowValue.contains("日期") && +// !nextRowValue.contains("方式") && !nextRowValue.contains("关区") && !nextRowValue.contains("关别") && +// !nextRowValue.contains("报关员") && !nextRowValue.contains("生产商") && !nextRowValue.contains("承运方") && +// !nextRowValue.contains("柜号") && !nextRowValue.contains("车型") && !nextRowValue.contains("车牌")) { +// headerInfo.setVehicleInfo(nextRowValue); +// log.info("从表头第{}行(下一行)读取到车型及车牌: {}", rowIdx + 2, nextRowValue); +// found = true; +// } +// } +// } +// } +// // 如果最终都没找到实际的值,不设置字段(保持为空) +// if (!found && !stopSearch) { +// log.warn("表头第{}行,标签'{}'在第{}列,找到的值是标签'{}',继续向后查找未找到实际值,车型及车牌字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, value); +// } +// } +// } else if ((labelValue.contains("承运方") || labelValue.contains("承运商")) && StringUtils.isBlank(headerInfo.getCarrier())) { +// headerInfo.setCarrier(value); +// log.info("从表头第{}行读取到承运方: {}", rowIdx + 1, value); +// } else if (labelValue.contains("Tel") && StringUtils.isBlank(headerInfo.getTel())) { +// headerInfo.setTel(value); +// log.info("从表头第{}行读取到Tel: {}", rowIdx + 1, value); +// } else if (labelValue.contains("司机签名") && StringUtils.isBlank(headerInfo.getDriverSignature())) { +// headerInfo.setDriverSignature(value); +// log.info("从表头第{}行读取到司机签名: {}", rowIdx + 1, value); +// } else if (labelValue.contains("入仓日期") && StringUtils.isBlank(headerInfo.getWarehouseDate())) { +// headerInfo.setWarehouseDate(value); +// log.info("从表头第{}行读取到入仓日期: {}", rowIdx + 1, value); +// } else if (labelValue.contains("Fax") && StringUtils.isBlank(headerInfo.getFax())) { +// headerInfo.setFax(value); +// log.info("从表头第{}行读取到Fax: {}", rowIdx + 1, value); +// } else if (labelValue.contains("申报地关区") && StringUtils.isBlank(headerInfo.getDeclarationArea())) { +// headerInfo.setDeclarationArea(value); +// log.info("从表头第{}行读取到申报地关区: {}", rowIdx + 1, value); +// } else if (labelValue.contains("生产商") && StringUtils.isBlank(headerInfo.getManufacturer())) { +// headerInfo.setManufacturer(value); +// log.info("从表头第{}行读取到生产商: {}", rowIdx + 1, value); +// } else if (labelValue.contains("报关员") && StringUtils.isBlank(headerInfo.getCustomsBrokerInfo())) { +// // 过滤掉标签文本(包含冒号、常见标签关键词等) +// if (StringUtils.isNotBlank(value) && +// !value.contains(":") && !value.contains(":") && +// !value.contains("完成时间") && !value.contains("下单日期") && !value.contains("入仓日期") && +// !value.contains("联系人") && !value.contains("Tel") && !value.contains("Fax") && +// !value.contains("客户") && !value.contains("地址") && !value.contains("日期") && +// !value.contains("方式") && !value.contains("关区") && !value.contains("关别") && +// !value.contains("报关员") && !value.contains("生产商") && !value.contains("承运方")) { +// headerInfo.setCustomsBrokerInfo(value); +// log.info("从表头第{}行读取到报关员姓名及联系方式: {}", rowIdx + 1, value); +// } else { +// // 如果找到的值是标签,继续向后查找 +// boolean found = false; +// for (int searchColIdx = colIdx + 2; searchColIdx < colIdx + 10 && searchColIdx < row.getPhysicalNumberOfCells(); searchColIdx++) { +// Cell nextValueCell = row.getCell(searchColIdx); +// if (nextValueCell != null) { +// String nextValue = getCellValueAsString(nextValueCell); +// // 跳过标签文本(包含冒号、常见标签关键词等) +// if (StringUtils.isNotBlank(nextValue) && +// !nextValue.contains(":") && !nextValue.contains(":") && +// !nextValue.contains("完成时间") && !nextValue.contains("下单日期") && !nextValue.contains("入仓日期") && +// !nextValue.contains("联系人") && !nextValue.contains("Tel") && !nextValue.contains("Fax") && +// !nextValue.contains("客户") && !nextValue.contains("地址") && !nextValue.contains("日期") && +// !nextValue.contains("方式") && !nextValue.contains("关区") && !nextValue.contains("关别") && +// !nextValue.contains("报关员") && !nextValue.contains("生产商") && !nextValue.contains("承运方")) { +// headerInfo.setCustomsBrokerInfo(nextValue); +// log.info("从表头第{}行读取到报关员姓名及联系方式: {}", rowIdx + 1, nextValue); +// found = true; +// break; +// } +// } +// } +// // 如果没找到合适的值,尝试查找下一行的同一列 +// if (!found) { +// Row nextRow = sheet.getRow(rowIdx + 1); +// if (nextRow != null) { +// Cell nextRowCell = nextRow.getCell(colIdx); +// if (nextRowCell != null) { +// String nextRowValue = getCellValueAsString(nextRowCell); +// if (StringUtils.isNotBlank(nextRowValue) && +// !nextRowValue.contains(":") && !nextRowValue.contains(":") && +// !nextRowValue.contains("完成时间") && !nextRowValue.contains("下单日期") && !nextRowValue.contains("入仓日期") && +// !nextRowValue.contains("联系人") && !nextRowValue.contains("Tel") && !nextRowValue.contains("Fax") && +// !nextRowValue.contains("客户") && !nextRowValue.contains("地址") && !nextRowValue.contains("日期") && +// !nextRowValue.contains("方式") && !nextRowValue.contains("关区") && !nextRowValue.contains("关别") && +// !nextRowValue.contains("报关员") && !nextRowValue.contains("生产商") && !nextRowValue.contains("承运方")) { +// headerInfo.setCustomsBrokerInfo(nextRowValue); +// log.info("从表头第{}行(下一行)读取到报关员姓名及联系方式: {}", rowIdx + 2, nextRowValue); +// found = true; +// } +// } +// } +// // 如果最终都没找到实际的值,不设置字段(保持为空) +// if (!found) { +// log.warn("表头第{}行,标签'{}'在第{}列,找到的值是标签'{}',继续向后查找未找到实际值,报关员姓名及联系方式字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, value); +// } +// } +// } +// } else if (labelValue.contains("送货地址") && StringUtils.isBlank(headerInfo.getDeliveryAddress())) { +// headerInfo.setDeliveryAddress(value); +// log.info("从表头第{}行读取到送货地址: {}", rowIdx + 1, value); +// } else if (labelValue.contains("进出境关别") && StringUtils.isBlank(headerInfo.getEntryExitCustoms())) { +// headerInfo.setEntryExitCustoms(value); +// log.info("从表头第{}行读取到进出境关别: {}", rowIdx + 1, value); +// } else if ((labelValue.contains("起运") || labelValue.contains("运抵国")) && StringUtils.isBlank(headerInfo.getOriginDestinationCountry())) { +// headerInfo.setOriginDestinationCountry(value); +// log.info("从表头第{}行读取到起运/运抵国(地区): {}", rowIdx + 1, value); +// } else if (labelValue.contains("柜号") && StringUtils.isBlank(headerInfo.getContainerNo())) { +// // 过滤掉标签文本(包含冒号、常见标签关键词等) +// if (StringUtils.isNotBlank(value) && +// !value.contains(":") && !value.contains(":") && +// !value.contains("司机签名") && !value.contains("委托编号") && !value.contains("NO") && +// !value.contains("完成时间") && !value.contains("下单日期") && !value.contains("入仓日期") && +// !value.contains("联系人") && !value.contains("Tel") && !value.contains("Fax") && +// !value.contains("客户") && !value.contains("地址") && !value.contains("日期") && +// !value.contains("方式") && !value.contains("关区") && !value.contains("关别") && +// !value.contains("报关员") && !value.contains("生产商") && !value.contains("承运方") && +// !value.contains("车型") && !value.contains("车牌")) { +// headerInfo.setContainerNo(value); +// log.info("从表头第{}行读取到柜号: {}", rowIdx + 1, value); +// } else { +// // 如果找到的值是标签,继续向后查找 +// boolean found = false; +// boolean stopSearch = false; // 是否遇到下一个标签,需要停止搜索 +// for (int searchColIdx = colIdx + 2; searchColIdx < colIdx + 10 && searchColIdx < row.getPhysicalNumberOfCells(); searchColIdx++) { +// Cell nextValueCell = row.getCell(searchColIdx); +// if (nextValueCell != null) { +// String nextValue = getCellValueAsString(nextValueCell); +// if (StringUtils.isNotBlank(nextValue)) { +// // 检查是否遇到下一个标签(如"委托编号NO"、"司机签名"等),如果遇到则停止搜索 +// if (nextValue.contains("委托编号") || (nextValue.contains("NO") && nextValue.contains(":")) || +// nextValue.contains("司机签名") || nextValue.contains("完成时间") || nextValue.contains("下单日期") || +// nextValue.contains("入仓日期") || nextValue.contains("联系人") || nextValue.contains("Tel") || +// nextValue.contains("Fax") || nextValue.contains("客户名称") || nextValue.contains("送货地址") || +// nextValue.contains("申报地关区") || nextValue.contains("进出境关别") || nextValue.contains("起运") || +// nextValue.contains("运抵国") || nextValue.contains("运输方式") || nextValue.contains("监管方式") || +// nextValue.contains("海关是否查验货物") || nextValue.contains("报关员")) { +// // 遇到下一个标签,停止搜索 +// stopSearch = true; +// log.warn("表头第{}行,标签'{}'在第{}列,向后搜索到第{}列时遇到下一个标签'{}',停止搜索,柜号字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, searchColIdx + 1, nextValue); +// break; +// } +// // 跳过标签文本(包含冒号、常见标签关键词等) +// if (!nextValue.contains(":") && !nextValue.contains(":") && +// !nextValue.contains("司机签名") && !nextValue.contains("委托编号") && !nextValue.contains("NO") && +// !nextValue.contains("完成时间") && !nextValue.contains("下单日期") && !nextValue.contains("入仓日期") && +// !nextValue.contains("联系人") && !nextValue.contains("Tel") && !nextValue.contains("Fax") && +// !nextValue.contains("客户") && !nextValue.contains("地址") && !nextValue.contains("日期") && +// !nextValue.contains("方式") && !nextValue.contains("关区") && !nextValue.contains("关别") && +// !nextValue.contains("报关员") && !nextValue.contains("生产商") && !nextValue.contains("承运方") && +// !nextValue.contains("车型") && !nextValue.contains("车牌")) { +// headerInfo.setContainerNo(nextValue); +// log.info("从表头第{}行读取到柜号: {}", rowIdx + 1, nextValue); +// found = true; +// break; +// } +// } +// } +// } +// // 如果没找到合适的值且未遇到下一个标签,尝试查找下一行的同一列 +// if (!found && !stopSearch) { +// Row nextRow = sheet.getRow(rowIdx + 1); +// if (nextRow != null) { +// Cell nextRowCell = nextRow.getCell(colIdx); +// if (nextRowCell != null) { +// String nextRowValue = getCellValueAsString(nextRowCell); +// if (StringUtils.isNotBlank(nextRowValue) && +// !nextRowValue.contains(":") && !nextRowValue.contains(":") && +// !nextRowValue.contains("司机签名") && !nextRowValue.contains("委托编号") && !nextRowValue.contains("NO") && +// !nextRowValue.contains("完成时间") && !nextRowValue.contains("下单日期") && !nextRowValue.contains("入仓日期") && +// !nextRowValue.contains("联系人") && !nextRowValue.contains("Tel") && !nextRowValue.contains("Fax") && +// !nextRowValue.contains("客户") && !nextRowValue.contains("地址") && !nextRowValue.contains("日期") && +// !nextRowValue.contains("方式") && !nextRowValue.contains("关区") && !nextRowValue.contains("关别") && +// !nextRowValue.contains("报关员") && !nextRowValue.contains("生产商") && !nextRowValue.contains("承运方") && +// !nextRowValue.contains("车型") && !nextRowValue.contains("车牌")) { +// headerInfo.setContainerNo(nextRowValue); +// log.info("从表头第{}行(下一行)读取到柜号: {}", rowIdx + 2, nextRowValue); +// found = true; +// } +// } +// } +// } +// // 如果最终都没找到实际的值,不设置字段(保持为空) +// if (!found && !stopSearch) { +// log.warn("表头第{}行,标签'{}'在第{}列,找到的值是标签'{}',继续向后查找未找到实际值,柜号字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, value); +// } +// } +// } else if (labelValue.contains("运输方式") && StringUtils.isBlank(headerInfo.getTransportMethod())) { +// headerInfo.setTransportMethod(value); +// log.info("从表头第{}行读取到运输方式: {}", rowIdx + 1, value); +// } else if (labelValue.contains("监管方式") && StringUtils.isBlank(headerInfo.getSupervisionMethod())) { +// headerInfo.setSupervisionMethod(value); +// log.info("从表头第{}行读取到监管方式: {}", rowIdx + 1, value); +// } else if (labelValue.contains("海关是否查验货物")) { +// // 过滤掉标签文本(包含冒号、常见标签关键词等) +// if (StringUtils.isNotBlank(value) && +// !value.contains(":") && !value.contains(":") && +// !value.contains("进出境关别") && !value.contains("委托编号") && !value.contains("NO") && +// !value.contains("司机签名") && !value.contains("完成时间") && !value.contains("下单日期") && +// !value.contains("入仓日期") && !value.contains("联系人") && !value.contains("Tel") && +// !value.contains("Fax") && !value.contains("客户") && !value.contains("地址") && +// !value.contains("日期") && !value.contains("方式") && !value.contains("关区") && +// !value.contains("报关员") && !value.contains("生产商") && !value.contains("承运方") && +// !value.contains("车型") && !value.contains("车牌") && !value.contains("柜号")) { +// if (value.contains("是") || value.equals("1")) { +// headerInfo.setCustomsInspection(1); +// } else if (value.contains("否") || value.equals("0")) { +// headerInfo.setCustomsInspection(0); +// } +// log.info("从表头第{}行读取到海关是否查验货物: {}", rowIdx + 1, value); +// } else { +// // 如果找到的值是标签,继续向后查找 +// boolean found = false; +// boolean stopSearch = false; // 是否遇到下一个标签,需要停止搜索 +// for (int searchColIdx = colIdx + 2; searchColIdx < colIdx + 10 && searchColIdx < row.getPhysicalNumberOfCells(); searchColIdx++) { +// Cell nextValueCell = row.getCell(searchColIdx); +// if (nextValueCell != null) { +// String nextValue = getCellValueAsString(nextValueCell); +// if (StringUtils.isNotBlank(nextValue)) { +// // 检查是否遇到下一个标签(如"委托编号NO"、"进出境关别"等),如果遇到则停止搜索 +// if (nextValue.contains("委托编号") || (nextValue.contains("NO") && nextValue.contains(":")) || +// nextValue.contains("司机签名") || nextValue.contains("完成时间") || nextValue.contains("下单日期") || +// nextValue.contains("入仓日期") || nextValue.contains("联系人") || nextValue.contains("Tel") || +// nextValue.contains("Fax") || nextValue.contains("客户名称") || nextValue.contains("送货地址") || +// nextValue.contains("申报地关区") || nextValue.contains("进出境关别") || nextValue.contains("起运") || +// nextValue.contains("运抵国") || nextValue.contains("柜号") || nextValue.contains("运输方式") || +// nextValue.contains("监管方式") || nextValue.contains("报关员")) { +// // 遇到下一个标签,停止搜索 +// stopSearch = true; +// log.warn("表头第{}行,标签'{}'在第{}列,向后搜索到第{}列时遇到下一个标签'{}',停止搜索,海关是否查验货物字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, searchColIdx + 1, nextValue); +// break; +// } +// // 跳过标签文本(包含冒号、常见标签关键词等) +// if (!nextValue.contains(":") && !nextValue.contains(":") && +// !nextValue.contains("进出境关别") && !nextValue.contains("委托编号") && !nextValue.contains("NO") && +// !nextValue.contains("司机签名") && !nextValue.contains("完成时间") && !nextValue.contains("下单日期") && +// !nextValue.contains("入仓日期") && !nextValue.contains("联系人") && !nextValue.contains("Tel") && +// !nextValue.contains("Fax") && !nextValue.contains("客户") && !nextValue.contains("地址") && +// !nextValue.contains("日期") && !nextValue.contains("方式") && !nextValue.contains("关区") && +// !nextValue.contains("报关员") && !nextValue.contains("生产商") && !nextValue.contains("承运方") && +// !nextValue.contains("车型") && !nextValue.contains("车牌") && !nextValue.contains("柜号")) { +// if (nextValue.contains("是") || nextValue.equals("1")) { +// headerInfo.setCustomsInspection(1); +// } else if (nextValue.contains("否") || nextValue.equals("0")) { +// headerInfo.setCustomsInspection(0); +// } +// log.info("从表头第{}行读取到海关是否查验货物: {}", rowIdx + 1, nextValue); +// found = true; +// break; +// } +// } +// } +// } +// // 如果没找到合适的值且未遇到下一个标签,尝试查找下一行的同一列 +// if (!found && !stopSearch) { +// Row nextRow = sheet.getRow(rowIdx + 1); +// if (nextRow != null) { +// Cell nextRowCell = nextRow.getCell(colIdx); +// if (nextRowCell != null) { +// String nextRowValue = getCellValueAsString(nextRowCell); +// if (StringUtils.isNotBlank(nextRowValue) && +// !nextRowValue.contains(":") && !nextRowValue.contains(":") && +// !nextRowValue.contains("进出境关别") && !nextRowValue.contains("委托编号") && !nextRowValue.contains("NO") && +// !nextRowValue.contains("司机签名") && !nextRowValue.contains("完成时间") && !nextRowValue.contains("下单日期") && +// !nextRowValue.contains("入仓日期") && !nextRowValue.contains("联系人") && !nextRowValue.contains("Tel") && +// !nextRowValue.contains("Fax") && !nextRowValue.contains("客户") && !nextRowValue.contains("地址") && +// !nextRowValue.contains("日期") && !nextRowValue.contains("方式") && !nextRowValue.contains("关区") && +// !nextRowValue.contains("报关员") && !nextRowValue.contains("生产商") && !nextRowValue.contains("承运方") && +// !nextRowValue.contains("车型") && !nextRowValue.contains("车牌") && !nextRowValue.contains("柜号")) { +// if (nextRowValue.contains("是") || nextRowValue.equals("1")) { +// headerInfo.setCustomsInspection(1); +// } else if (nextRowValue.contains("否") || nextRowValue.equals("0")) { +// headerInfo.setCustomsInspection(0); +// } +// log.info("从表头第{}行(下一行)读取到海关是否查验货物: {}", rowIdx + 2, nextRowValue); +// found = true; +// } +// } +// } +// } +// // 如果最终都没找到实际的值,不设置字段(保持为空) +// if (!found && !stopSearch) { +// log.warn("表头第{}行,标签'{}'在第{}列,找到的值是标签'{}',继续向后查找未找到实际值,海关是否查验货物字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, value); +// } +// } +// } else if (labelValue.contains("是否需要报关")) { +// if (value.contains("是") || value.equals("1")) { +// headerInfo.setNeedCustomsDeclaration(1); +// } else if (value.contains("否") || value.equals("0")) { +// headerInfo.setNeedCustomsDeclaration(0); +// } +// log.info("从表头第{}行读取到是否需要报关: {}", rowIdx + 1, value); +// } else if (labelValue.contains("是否需要运输")) { +// if (value.contains("是") || value.equals("1")) { +// headerInfo.setNeedTransport(1); +// } else if (value.contains("否") || value.equals("0")) { +// headerInfo.setNeedTransport(0); +// } +// log.info("从表头第{}行读取到是否需要运输: {}", rowIdx + 1, value); +// } else if (labelValue.contains("完成时间") && StringUtils.isBlank(headerInfo.getCompletionTime())) { +// // 过滤掉标签文本(包含冒号、常见标签关键词等) +// if (StringUtils.isNotBlank(value) && +// !value.contains(":") && !value.contains(":") && +// !value.contains("下单日期") && !value.contains("入仓日期") && +// !value.contains("起运") && !value.contains("运抵国") && !value.contains("地区") && +// !value.contains("联系人") && !value.contains("Tel") && !value.contains("Fax") && +// !value.contains("客户") && !value.contains("地址") && !value.contains("日期") && +// !value.contains("方式") && !value.contains("关区") && !value.contains("关别") && +// !value.contains("报关员") && !value.contains("生产商") && !value.contains("承运方")) { +// headerInfo.setCompletionTime(value); +// log.info("从表头第{}行读取到完成时间: {}", rowIdx + 1, value); +// } else { +// // 如果找到的值是标签,继续向后查找 +// boolean found = false; +// boolean stopSearch = false; // 是否遇到下一个标签,需要停止搜索 +// for (int searchColIdx = colIdx + 2; searchColIdx < colIdx + 10 && searchColIdx < row.getPhysicalNumberOfCells(); searchColIdx++) { +// Cell nextValueCell = row.getCell(searchColIdx); +// if (nextValueCell != null) { +// String nextValue = getCellValueAsString(nextValueCell); +// if (StringUtils.isNotBlank(nextValue)) { +// // 检查是否遇到下一个标签(如"委托编号NO"、"下单日期"等),如果遇到则停止搜索 +// if (nextValue.contains("委托编号") || (nextValue.contains("NO") && nextValue.contains(":")) || +// nextValue.contains("司机签名") || nextValue.contains("下单日期") || +// nextValue.contains("入仓日期") || nextValue.contains("联系人") || nextValue.contains("Tel") || +// nextValue.contains("Fax") || nextValue.contains("客户名称") || nextValue.contains("送货地址") || +// nextValue.contains("申报地关区") || nextValue.contains("进出境关别") || nextValue.contains("起运") || +// nextValue.contains("运抵国") || nextValue.contains("柜号") || nextValue.contains("运输方式") || +// nextValue.contains("监管方式") || nextValue.contains("海关是否查验货物") || nextValue.contains("报关员")) { +// // 遇到下一个标签,停止搜索 +// stopSearch = true; +// log.warn("表头第{}行,标签'{}'在第{}列,向后搜索到第{}列时遇到下一个标签'{}',停止搜索,完成时间字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, searchColIdx + 1, nextValue); +// break; +// } +// // 跳过标签文本(包含冒号、常见标签关键词等) +// if (!nextValue.contains(":") && !nextValue.contains(":") && +// !nextValue.contains("下单日期") && !nextValue.contains("入仓日期") && +// !nextValue.contains("起运") && !nextValue.contains("运抵国") && !nextValue.contains("地区") && +// !nextValue.contains("联系人") && !nextValue.contains("Tel") && !nextValue.contains("Fax") && +// !nextValue.contains("客户") && !nextValue.contains("地址") && !nextValue.contains("日期") && +// !nextValue.contains("方式") && !nextValue.contains("关区") && !nextValue.contains("关别") && +// !nextValue.contains("报关员") && !nextValue.contains("生产商") && !nextValue.contains("承运方")) { +// headerInfo.setCompletionTime(nextValue); +// log.info("从表头第{}行读取到完成时间: {}", rowIdx + 1, nextValue); +// found = true; +// break; +// } +// } +// } +// } +// // 如果没找到合适的值且未遇到下一个标签,尝试查找下一行的同一列 +// if (!found && !stopSearch) { +// Row nextRow = sheet.getRow(rowIdx + 1); +// if (nextRow != null) { +// Cell nextRowCell = nextRow.getCell(colIdx); +// if (nextRowCell != null) { +// String nextRowValue = getCellValueAsString(nextRowCell); +// if (StringUtils.isNotBlank(nextRowValue) && +// !nextRowValue.contains(":") && !nextRowValue.contains(":") && +// !nextRowValue.contains("下单日期") && !nextRowValue.contains("入仓日期") && +// !nextRowValue.contains("起运") && !nextRowValue.contains("运抵国") && !nextRowValue.contains("地区") && +// !nextRowValue.contains("联系人") && !nextRowValue.contains("Tel") && !nextRowValue.contains("Fax") && +// !nextRowValue.contains("客户") && !nextRowValue.contains("地址") && !nextRowValue.contains("日期") && +// !nextRowValue.contains("方式") && !nextRowValue.contains("关区") && !nextRowValue.contains("关别") && +// !nextRowValue.contains("报关员") && !nextRowValue.contains("生产商") && !nextRowValue.contains("承运方")) { +// headerInfo.setCompletionTime(nextRowValue); +// log.info("从表头第{}行(下一行)读取到完成时间: {}", rowIdx + 2, nextRowValue); +// found = true; +// } +// } +// } +// } +// // 如果最终都没找到实际的值,不设置字段(保持为空) +// if (!found && !stopSearch) { +// log.warn("表头第{}行,标签'{}'在第{}列,找到的值是标签'{}',继续向后查找未找到实际值,完成时间字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, value); +// } +// } +// } else if (labelValue.contains("下单日期") && StringUtils.isBlank(headerInfo.getOrderDate())) { +// // 过滤掉标签文本(包含冒号、常见标签关键词等) +// if (StringUtils.isNotBlank(value) && +// !value.contains(":") && !value.contains(":") && +// !value.contains("起运") && !value.contains("运抵国") && !value.contains("地区") && +// !value.contains("完成时间") && !value.contains("入仓日期") && +// !value.contains("联系人") && !value.contains("Tel") && !value.contains("Fax") && +// !value.contains("客户") && !value.contains("地址") && !value.contains("日期") && +// !value.contains("方式") && !value.contains("关区") && !value.contains("关别") && +// !value.contains("报关员") && !value.contains("生产商") && !value.contains("承运方")) { +// headerInfo.setOrderDate(value); +// log.info("从表头第{}行读取到下单日期: {}", rowIdx + 1, value); +// } else { +// // 如果找到的值是标签,继续向后查找 +// boolean found = false; +// boolean stopSearch = false; // 是否遇到下一个标签,需要停止搜索 +// for (int searchColIdx = colIdx + 2; searchColIdx < colIdx + 10 && searchColIdx < row.getPhysicalNumberOfCells(); searchColIdx++) { +// Cell nextValueCell = row.getCell(searchColIdx); +// if (nextValueCell != null) { +// String nextValue = getCellValueAsString(nextValueCell); +// if (StringUtils.isNotBlank(nextValue)) { +// // 检查是否遇到下一个标签(如"委托编号NO"、"起运/运抵国"等),如果遇到则停止搜索 +// if (nextValue.contains("委托编号") || (nextValue.contains("NO") && nextValue.contains(":")) || +// nextValue.contains("司机签名") || nextValue.contains("完成时间") || +// nextValue.contains("入仓日期") || nextValue.contains("联系人") || nextValue.contains("Tel") || +// nextValue.contains("Fax") || nextValue.contains("客户名称") || nextValue.contains("送货地址") || +// nextValue.contains("申报地关区") || nextValue.contains("进出境关别") || nextValue.contains("起运") || +// nextValue.contains("运抵国") || nextValue.contains("柜号") || nextValue.contains("运输方式") || +// nextValue.contains("监管方式") || nextValue.contains("海关是否查验货物") || nextValue.contains("报关员")) { +// // 遇到下一个标签,停止搜索 +// stopSearch = true; +// log.warn("表头第{}行,标签'{}'在第{}列,向后搜索到第{}列时遇到下一个标签'{}',停止搜索,下单日期字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, searchColIdx + 1, nextValue); +// break; +// } +// // 跳过标签文本(包含冒号、常见标签关键词等) +// if (!nextValue.contains(":") && !nextValue.contains(":") && +// !nextValue.contains("起运") && !nextValue.contains("运抵国") && !nextValue.contains("地区") && +// !nextValue.contains("完成时间") && !nextValue.contains("入仓日期") && +// !nextValue.contains("联系人") && !nextValue.contains("Tel") && !nextValue.contains("Fax") && +// !nextValue.contains("客户") && !nextValue.contains("地址") && !nextValue.contains("日期") && +// !nextValue.contains("方式") && !nextValue.contains("关区") && !nextValue.contains("关别") && +// !nextValue.contains("报关员") && !nextValue.contains("生产商") && !nextValue.contains("承运方")) { +// headerInfo.setOrderDate(nextValue); +// log.info("从表头第{}行读取到下单日期: {}", rowIdx + 1, nextValue); +// found = true; +// break; +// } +// } +// } +// } +// // 如果没找到合适的值且未遇到下一个标签,尝试查找下一行的同一列 +// if (!found && !stopSearch) { +// Row nextRow = sheet.getRow(rowIdx + 1); +// if (nextRow != null) { +// Cell nextRowCell = nextRow.getCell(colIdx); +// if (nextRowCell != null) { +// String nextRowValue = getCellValueAsString(nextRowCell); +// if (StringUtils.isNotBlank(nextRowValue) && +// !nextRowValue.contains(":") && !nextRowValue.contains(":") && +// !nextRowValue.contains("起运") && !nextRowValue.contains("运抵国") && !nextRowValue.contains("地区") && +// !nextRowValue.contains("完成时间") && !nextRowValue.contains("入仓日期") && +// !nextRowValue.contains("联系人") && !nextRowValue.contains("Tel") && !nextRowValue.contains("Fax") && +// !nextRowValue.contains("客户") && !nextRowValue.contains("地址") && !nextRowValue.contains("日期") && +// !nextRowValue.contains("方式") && !nextRowValue.contains("关区") && !nextRowValue.contains("关别") && +// !nextRowValue.contains("报关员") && !nextRowValue.contains("生产商") && !nextRowValue.contains("承运方")) { +// headerInfo.setOrderDate(nextRowValue); +// log.info("从表头第{}行(下一行)读取到下单日期: {}", rowIdx + 2, nextRowValue); +// found = true; +// } +// } +// } +// } +// // 如果最终都没找到实际的值,不设置字段(保持为空) +// if (!found && !stopSearch) { +// log.warn("表头第{}行,标签'{}'在第{}列,找到的值是标签'{}',继续向后查找未找到实际值,下单日期字段将保持为空", +// rowIdx + 1, labelValue, colIdx + 1, value); +// } +// } +// } else if (labelValue.contains("备注") && StringUtils.isBlank(headerInfo.getRemark())) { +// headerInfo.setRemark(value); +// log.info("从表头第{}行读取到备注: {}", rowIdx + 1, value); +// } +// } +// } +// } +// } +// } +// } +// log.info("表头信息读取完成 - 委托编号NO: {}, 客户名称: {}, To: {}, 联系人: {}, Tel: {}, Fax: {}, 送货地址: {}, 起运/运抵国: {}, 车型及车牌: {}, 承运方: {}, 司机签名: {}, 入仓日期: {}, 申报地关区: {}, 生产商: {}, 报关员: {}, 完成时间: {}, 进出境关别: {}, 下单日期: {}, 备注: {}", +// headerInfo.getConsignmentNo(), headerInfo.getShipperName(), headerInfo.getTo(), +// headerInfo.getContactPerson(), headerInfo.getTel(), headerInfo.getFax(), +// headerInfo.getDeliveryAddress(), headerInfo.getOriginDestinationCountry(), +// headerInfo.getVehicleInfo(), headerInfo.getCarrier(), headerInfo.getDriverSignature(), +// headerInfo.getWarehouseDate(), headerInfo.getDeclarationArea(), headerInfo.getManufacturer(), +// headerInfo.getCustomsBrokerInfo(), headerInfo.getCompletionTime(), headerInfo.getEntryExitCustoms(), +// headerInfo.getOrderDate(), headerInfo.getRemark()); +// } catch (Exception e) { +// log.error("读取Excel表头信息失败", e); +// // 不抛出异常,继续尝试从明细行读取 +// } +// +// // 为了兼容旧代码,保留这两个变量 +// String headerConsignmentNo = headerInfo.getConsignmentNo(); +// String headerCustomerName = headerInfo.getShipperName(); +// +// // 先读取Excel第13行的列名,用于调试 +// try (InputStream isForDebug = file.getInputStream()) { +// Workbook wbDebug = WorkbookFactory.create(isForDebug); +// Sheet sheetDebug = wbDebug.getSheetAt(0); +// Row headerRow = sheetDebug.getRow(detailTitleRowIndex); +// if (headerRow != null) { +// log.info("Excel第{}行(明细表列名行)的列名:", detailTitleRowIndex + 1); +// for (int colIdx = 0; colIdx < headerRow.getPhysicalNumberOfCells(); colIdx++) { +// Cell cell = headerRow.getCell(colIdx); +// if (cell != null) { +// String colName = getCellValueAsString(cell); +// if (StringUtils.isNotBlank(colName)) { +// // 打印列名及其长度、字符编码等信息,便于排查 +// log.info(" 第{}列: [{}] (长度: {}, 包含换行: {}, 包含空格: {})", +// colIdx + 1, colName, colName.length(), +// colName.contains("\n"), colName.contains(" ")); +// } +// } +// } +// } +// } catch (Exception e) { +// log.warn("读取Excel列名失败,继续导入", e); +// } +// +// ExcelUtil util = new ExcelUtil<>(ReservationStockInOrderImportRowDTO.class); +// // 从第13行(索引12)读取明细数据 +// List rows = null; +// try { +// rows = util.importExcel(is, detailTitleRowIndex); +// log.info("成功读取 {} 行明细数据", rows != null ? rows.size() : 0); +// // 调试:打印第一行数据的关键字段 +// if (rows != null && !rows.isEmpty()) { +// ReservationStockInOrderImportRowDTO firstRow = rows.get(0); +// log.info("第一行明细数据 - 规格型号: [{}], SKU码: [{}], 升: [{}], 箱数: [{}], 尺寸: [{}], 仓库数量: [{}], 入库数量: [{}], 单位: [{}], 总净重: [{}], 总净重2: [{}], 总毛重: [{}], 总毛重2: [{}], 总体积: [{}], 总体积2: [{}], 总面积: [{}], 总面积2: [{}], 原产国: [{}], 币制: [{}]", +// firstRow.getSpecificationModel(), firstRow.getSkuCode(), firstRow.getLiter(), +// firstRow.getBoxCount(), firstRow.getDimensions(), firstRow.getWarehouseQuantity(), +// firstRow.getInboundQuantity(), firstRow.getUnit(), +// firstRow.getTotalNetWeight(), firstRow.getTotalNetWeight2(), +// firstRow.getTotalGrossWeight(), firstRow.getTotalGrossWeight2(), +// firstRow.getTotalVolume(), firstRow.getTotalVolume2(), +// firstRow.getTotalArea(), firstRow.getTotalArea2(), +// firstRow.getOriginCountry(), firstRow.getCurrency()); +// } +// } catch (Exception e) { +// log.error("读取Excel明细数据失败", e); +// throw new ServiceException("读取Excel明细数据失败:" + e.getMessage() + "。请检查Excel第13行是否为明细表列名,第14行开始是否为数据行"); +// } +// if (rows == null || rows.isEmpty()) { +// throw new ServiceException("导入数据为空。请检查Excel第13行是否为明细表列名(包含'商品名称'列),第14行开始是否为数据行"); +// } +// log.info("成功读取 {} 行明细数据", rows.size()); +// +// // 将表头信息应用到每一行明细数据 +// for (ReservationStockInOrderImportRowDTO row : rows) { +// if (row != null) { +// // 应用表头中的委托编号NO +// if (StringUtils.isBlank(row.getConsignmentNo()) && StringUtils.isNotBlank(headerInfo.getConsignmentNo())) { +// row.setConsignmentNo(headerInfo.getConsignmentNo()); +// } +// // 应用表头中的客户名称(表头有客户名称时,强制应用到所有明细行) +// if (StringUtils.isNotBlank(headerInfo.getShipperName())) { +// row.setShipperName(headerInfo.getShipperName()); +// } +// // 应用表头中的货主编号(表头有货主编号时,强制应用到所有明细行) +// if (StringUtils.isNotBlank(headerInfo.getShipperCode())) { +// row.setShipperCode(headerInfo.getShipperCode()); +// } +// // 应用其他表头字段(如果明细行为空,则使用表头值) +// if (StringUtils.isBlank(row.getTo()) && StringUtils.isNotBlank(headerInfo.getTo())) { +// row.setTo(headerInfo.getTo()); +// } +// if (StringUtils.isBlank(row.getContactPerson()) && StringUtils.isNotBlank(headerInfo.getContactPerson())) { +// row.setContactPerson(headerInfo.getContactPerson()); +// } +// if (StringUtils.isBlank(row.getVehicleInfo()) && StringUtils.isNotBlank(headerInfo.getVehicleInfo())) { +// row.setVehicleInfo(headerInfo.getVehicleInfo()); +// } +// if (StringUtils.isBlank(row.getCarrier()) && StringUtils.isNotBlank(headerInfo.getCarrier())) { +// row.setCarrier(headerInfo.getCarrier()); +// } +// if (StringUtils.isBlank(row.getTel()) && StringUtils.isNotBlank(headerInfo.getTel())) { +// row.setTel(headerInfo.getTel()); +// } +// if (StringUtils.isBlank(row.getDriverSignature()) && StringUtils.isNotBlank(headerInfo.getDriverSignature())) { +// row.setDriverSignature(headerInfo.getDriverSignature()); +// } +// if (StringUtils.isBlank(row.getFax()) && StringUtils.isNotBlank(headerInfo.getFax())) { +// row.setFax(headerInfo.getFax()); +// } +// if (StringUtils.isBlank(row.getDeclarationArea()) && StringUtils.isNotBlank(headerInfo.getDeclarationArea())) { +// row.setDeclarationArea(headerInfo.getDeclarationArea()); +// } +// if (StringUtils.isBlank(row.getManufacturer()) && StringUtils.isNotBlank(headerInfo.getManufacturer())) { +// row.setManufacturer(headerInfo.getManufacturer()); +// } +// if (StringUtils.isBlank(row.getCustomsBrokerInfo()) && StringUtils.isNotBlank(headerInfo.getCustomsBrokerInfo())) { +// row.setCustomsBrokerInfo(headerInfo.getCustomsBrokerInfo()); +// } +// if (StringUtils.isBlank(row.getDeliveryAddress()) && StringUtils.isNotBlank(headerInfo.getDeliveryAddress())) { +// row.setDeliveryAddress(headerInfo.getDeliveryAddress()); +// } +// if (StringUtils.isBlank(row.getEntryExitCustoms()) && StringUtils.isNotBlank(headerInfo.getEntryExitCustoms())) { +// row.setEntryExitCustoms(headerInfo.getEntryExitCustoms()); +// } +// if (StringUtils.isBlank(row.getOriginDestinationCountry()) && StringUtils.isNotBlank(headerInfo.getOriginDestinationCountry())) { +// row.setOriginDestinationCountry(headerInfo.getOriginDestinationCountry()); +// } +// if (StringUtils.isBlank(row.getContainerNo()) && StringUtils.isNotBlank(headerInfo.getContainerNo())) { +// row.setContainerNo(headerInfo.getContainerNo()); +// } +// if (StringUtils.isBlank(row.getTransportMethod()) && StringUtils.isNotBlank(headerInfo.getTransportMethod())) { +// row.setTransportMethod(headerInfo.getTransportMethod()); +// } +// if (StringUtils.isBlank(row.getSupervisionMethod()) && StringUtils.isNotBlank(headerInfo.getSupervisionMethod())) { +// row.setSupervisionMethod(headerInfo.getSupervisionMethod()); +// } +// if (row.getCustomsInspection() == null && headerInfo.getCustomsInspection() != null) { +// row.setCustomsInspection(headerInfo.getCustomsInspection()); +// } +// if (row.getNeedCustomsDeclaration() == null && headerInfo.getNeedCustomsDeclaration() != null) { +// row.setNeedCustomsDeclaration(headerInfo.getNeedCustomsDeclaration()); +// } +// if (row.getNeedTransport() == null && headerInfo.getNeedTransport() != null) { +// row.setNeedTransport(headerInfo.getNeedTransport()); +// } +// if (StringUtils.isBlank(row.getWarehouseDate()) && StringUtils.isNotBlank(headerInfo.getWarehouseDate())) { +// row.setWarehouseDate(headerInfo.getWarehouseDate()); +// } +// if (StringUtils.isBlank(row.getCompletionTime()) && StringUtils.isNotBlank(headerInfo.getCompletionTime())) { +// row.setCompletionTime(headerInfo.getCompletionTime()); +// } +// if (StringUtils.isBlank(row.getOrderDate()) && StringUtils.isNotBlank(headerInfo.getOrderDate())) { +// row.setOrderDate(headerInfo.getOrderDate()); +// } +// if (StringUtils.isBlank(row.getRemark()) && StringUtils.isNotBlank(headerInfo.getRemark())) { +// row.setRemark(headerInfo.getRemark()); +// } +// } +// } +// +// // 过滤掉关键字段都为空的空行(只需要商品名称不为空即可) +// List validRows = rows.stream() +// .filter(r -> r != null && StringUtils.isNotBlank(r.getMaterialName())) +// .collect(Collectors.toList()); +// if (validRows.isEmpty()) { +// String errorMsg = String.format("导入数据为空(可能全为空行)。共读取 %d 行数据,但商品名称都为空。\n" + +// "请检查Excel第13行是否为明细表列名(包含'商品名称'列),第14行开始是否为数据行。", rows.size()); +// throw new ServiceException(errorMsg); +// } +// +// // 以委托编号NO分组;若为空则归到同一组 +// Map> groupMap = validRows.stream() +// .collect(Collectors.groupingBy(r -> StringUtils.isBlank(r.getConsignmentNo()) ? "__EMPTY_CONSIGNMENT__" : r.getConsignmentNo())); +// +// List orderList = new ArrayList<>(); +// for (Map.Entry> entry : groupMap.entrySet()) { +// List groupRows = entry.getValue(); +// ReservationStockInOrderImportRowDTO h = groupRows.get(0); +// +// // 使用传入的仓库信息(与出库单导入保持一致) +// if (warehouseId == null) { +// throw new ServiceException("导入失败:仓库ID不能为空"); +// } +// if (StringUtils.isBlank(warehouseCode)) { +// throw new ServiceException("导入失败:仓库编码不能为空"); +// } +// if (StringUtils.isBlank(warehouseName)) { +// throw new ServiceException("导入失败:仓库名称不能为空"); +// } +// +// // 客户名称应该从表头获取(优先使用表头,如果表头为空则使用明细行) +// String customerName = StringUtils.isNotBlank(headerInfo.getShipperName()) ? headerInfo.getShipperName() : h.getShipperName(); +// if (StringUtils.isBlank(customerName)) { +// throw new ServiceException("导入失败:客户名称不能为空(委托编号NO=" + h.getConsignmentNo() + ")。请确保Excel表头(第1-12行)中包含'客户名称'字段"); +// } +// // 如果明细行的客户名称为空,使用表头的客户名称 +// if (StringUtils.isBlank(h.getShipperName()) && StringUtils.isNotBlank(headerInfo.getShipperName())) { +// h.setShipperName(headerInfo.getShipperName()); +// } +// +// ReservationStockInOrderDO order = new ReservationStockInOrderDO(); +// // 组织/审计字段 +// order.setOrganizationId(loginUser.getUserPo().getOrganizationId()); +// order.setOrganizationName(loginUser.getUserPo().getOrganizationName()); +// order.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); +// order.setCreateBy(loginUser.getUserid()); +// // 获取用户姓名(优先从UserPo获取,如果为空则使用realname,最后使用username作为兜底) +// String userRealName = null; +// if (loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null +// && !loginUser.getUserPo().getUserName().trim().isEmpty()) { +// // 优先使用UserPo中的userName(用户真实姓名) +// userRealName = loginUser.getUserPo().getUserName(); +// } else if (loginUser.getRealname() != null && !loginUser.getRealname().trim().isEmpty()) { +// // 其次使用realname +// userRealName = loginUser.getRealname(); +// } else { +// // 最后使用username(账号)作为兜底 +// userRealName = loginUser.getUsername(); +// } +// order.setCreateByName(userRealName); +// // 设置创建时间为当前时间 +// order.setCreateTime(new Date()); +// +// // 必填/基础字段(使用传入的仓库信息,与出库单导入保持一致) +// order.setWarehouseId(warehouseId); +// order.setWarehouseCode(warehouseCode); +// order.setWarehouseName(warehouseName); +// // 货主信息:优先使用表头,如果表头为空则使用明细行 +// String shipperName = StringUtils.isNotBlank(headerInfo.getShipperName()) ? headerInfo.getShipperName() : h.getShipperName(); +// String shipperCode = StringUtils.isNotBlank(headerInfo.getShipperCode()) ? headerInfo.getShipperCode() : h.getShipperCode(); +// // 提前获取货主ID,用于查询物料基础信息时过滤 +// Long shipperId = getShipperIdByNameOrCode(shipperName, shipperCode); +// // 货主ID先设置为获取到的值,后续在shipperParam方法中会再次确认 +// order.setShipperId(shipperId); +// if (StringUtils.isNotBlank(shipperName)) { +// order.setShipperName(shipperName); +// } +// if (StringUtils.isNotBlank(shipperCode)) { +// order.setShipperCode(shipperCode); +// } +//// order.setSupplierId(h.getSupplierId()); +//// order.setOrderTypeCode(h.getOrderTypeCode()); +// order.setConsignmentNo(h.getConsignmentNo()); +// order.setRemark(h.getRemark()); +// // 导入入库单时,如果入库单类型为空,默认设置为普通入库 +// if (StringUtils.isBlank(order.getOrderTypeCode())) { +// order.setOrderTypeCode("pu_tong_ru_ku"); +// } +// if (StringUtils.isBlank(order.getOrderTypeName())) { +// order.setOrderTypeName("普通入库单"); +// } +// +// // 报关表头字段(优先使用表头字段,如果表头为空则使用明细行字段) +// order.setTo(StringUtils.isNotBlank(headerInfo.getTo()) ? headerInfo.getTo() : h.getTo()); +// order.setContactPerson(StringUtils.isNotBlank(headerInfo.getContactPerson()) ? headerInfo.getContactPerson() : h.getContactPerson()); +// order.setVehicleInfo(StringUtils.isNotBlank(headerInfo.getVehicleInfo()) ? headerInfo.getVehicleInfo() : h.getVehicleInfo()); +// order.setTel(StringUtils.isNotBlank(headerInfo.getTel()) ? headerInfo.getTel() : h.getTel()); +// order.setDriverSignature(StringUtils.isNotBlank(headerInfo.getDriverSignature()) ? headerInfo.getDriverSignature() : h.getDriverSignature()); +// order.setFax(StringUtils.isNotBlank(headerInfo.getFax()) ? headerInfo.getFax() : h.getFax()); +// order.setDeclarationArea(StringUtils.isNotBlank(headerInfo.getDeclarationArea()) ? headerInfo.getDeclarationArea() : h.getDeclarationArea()); +// order.setManufacturer(StringUtils.isNotBlank(headerInfo.getManufacturer()) ? headerInfo.getManufacturer() : h.getManufacturer()); +// order.setCustomsBrokerInfo(StringUtils.isNotBlank(headerInfo.getCustomsBrokerInfo()) ? headerInfo.getCustomsBrokerInfo() : h.getCustomsBrokerInfo()); +// order.setDeliveryAddress(StringUtils.isNotBlank(headerInfo.getDeliveryAddress()) ? headerInfo.getDeliveryAddress() : h.getDeliveryAddress()); +// order.setEntryExitCustoms(StringUtils.isNotBlank(headerInfo.getEntryExitCustoms()) ? headerInfo.getEntryExitCustoms() : h.getEntryExitCustoms()); +// order.setOriginDestinationCountry(StringUtils.isNotBlank(headerInfo.getOriginDestinationCountry()) ? headerInfo.getOriginDestinationCountry() : h.getOriginDestinationCountry()); +// order.setCarrier(StringUtils.isNotBlank(headerInfo.getCarrier()) ? headerInfo.getCarrier() : h.getCarrier()); +// order.setContainerNo(StringUtils.isNotBlank(headerInfo.getContainerNo()) ? headerInfo.getContainerNo() : h.getContainerNo()); +// order.setTransportMethod(StringUtils.isNotBlank(headerInfo.getTransportMethod()) ? headerInfo.getTransportMethod() : h.getTransportMethod()); +// order.setSupervisionMethod(StringUtils.isNotBlank(headerInfo.getSupervisionMethod()) ? headerInfo.getSupervisionMethod() : h.getSupervisionMethod()); +// +// // 报关字段默认值(优先使用表头字段) +// Integer customsInspection = headerInfo.getCustomsInspection() != null ? headerInfo.getCustomsInspection() : h.getCustomsInspection(); +// if (customsInspection == null) { +// order.setCustomsInspection(0); // 默认:否 +// } else { +// order.setCustomsInspection(customsInspection); +// } +// Integer needCustomsDeclaration = headerInfo.getNeedCustomsDeclaration() != null ? headerInfo.getNeedCustomsDeclaration() : h.getNeedCustomsDeclaration(); +// if (needCustomsDeclaration == null) { +// order.setNeedCustomsDeclaration(1); // 默认:是 +// } else { +// order.setNeedCustomsDeclaration(needCustomsDeclaration); +// } +// Integer needTransport = headerInfo.getNeedTransport() != null ? headerInfo.getNeedTransport() : h.getNeedTransport(); +// if (needTransport == null) { +// order.setNeedTransport(0); // 默认:否 +// } else { +// order.setNeedTransport(needTransport); +// } +// +// // 日期字段(优先使用表头字段,如果表头为空则使用明细行字段) +// String warehouseDateStr = StringUtils.isNotBlank(headerInfo.getWarehouseDate()) ? headerInfo.getWarehouseDate() : h.getWarehouseDate(); +// if (StringUtils.isNotBlank(warehouseDateStr)) { +// Date warehouseDate = parseDateString(warehouseDateStr); +// if (warehouseDate != null) { +// order.setWarehouseDate(warehouseDate); +// log.info("设置入仓日期: {}", warehouseDate); +// } +// } +// +// String completionTimeStr = StringUtils.isNotBlank(headerInfo.getCompletionTime()) ? headerInfo.getCompletionTime() : h.getCompletionTime(); +// if (StringUtils.isNotBlank(completionTimeStr)) { +// Date completionTime = parseDateString(completionTimeStr); +// if (completionTime != null) { +// order.setCompletionTime(completionTime); +// log.info("设置完成时间: {}", completionTime); +// } +// } +// +// String orderDateStr = StringUtils.isNotBlank(headerInfo.getOrderDate()) ? headerInfo.getOrderDate() : h.getOrderDate(); +// if (StringUtils.isNotBlank(orderDateStr)) { +// Date orderDate = parseDateString(orderDateStr); +// if (orderDate != null) { +// order.setOrderDate(orderDate); +// log.info("设置下单日期: {}", orderDate); +// } +// } +// +// // 明细 +// List details = new ArrayList<>(); +// for (ReservationStockInOrderImportRowDTO r : groupRows) { +// // 记录当前明细行的关键信息,用于调试 +// log.info("处理明细行 - 委托编号NO: {}, 商品名称: [{}], 料号: [{}], SKU码: [{}], 仓库数量: [{}], 入库数量: [{}]", +// h.getConsignmentNo(), r.getMaterialName(), r.getMaterialCode(), r.getSkuCode(), +// r.getWarehouseQuantity(), r.getInboundQuantity()); +// +// // 先检查数量,如果数量为空,直接跳过该明细行(不需要检查物料) +// BigDecimal quantity = r.getWarehouseQuantity(); +// if (quantity == null) { +// quantity = r.getInboundQuantity(); +// } +// if (quantity == null) { +// log.warn("跳过明细行:仓库数量或入库数量不能为空 - 委托编号NO: [{}], 商品名称: [{}], 料号: [{}], SKU码: [{}]", +// h.getConsignmentNo(), r.getMaterialName(), r.getMaterialCode(), r.getSkuCode()); +// continue; // 跳过该明细行,继续处理下一行 +// } +// +// // 检查是否为容器类型等非物料信息,如果是则跳过 +// String materialName = r.getMaterialName(); +// if (StringUtils.isNotBlank(materialName)) { +// String lowerName = materialName.trim(); +// // 常见的容器类型关键词(不区分大小写) +// if (lowerName.contains("尺柜") || lowerName.contains("尺集装箱") || +// lowerName.contains("Container") || lowerName.contains("container") || +// (lowerName.contains("柜") && (lowerName.contains("20") || lowerName.contains("40") || lowerName.contains("45")))) { +// log.info("跳过明细行:识别为容器类型信息,非实际物料 - 委托编号NO: [{}], 商品名称: [{}]", +// h.getConsignmentNo(), materialName); +// continue; // 跳过该明细行,继续处理下一行 +// } +// } +// +// // 导入文件中必须填写料号,根据料号获取商品信息,必须是货主下有的才可以匹配 +// // 如果没有填写,提示用户:请在导入文件中填写正确的料号 +// if (StringUtils.isBlank(r.getMaterialCode())) { +// String errorMsg = String.format("导入失败:请在导入文件中填写正确的料号", +// r.getMaterialName()); +// log.error(errorMsg); +// throw new ServiceException(errorMsg); +// } +// +// // 根据料号查询物料基础信息,必须是货主下有的才可以匹配 +// Long materialBaseInfoId = null; +// LoginUser currentLoginUser = SecurityUtils.getLoginUser(); +// Long topOrganizationId = currentLoginUser != null && currentLoginUser.getUserPo() != null +// ? currentLoginUser.getUserPo().getTopOrganizationId() : null; +// +// // 使用料号查询,必须加上货主ID条件,确保查询到的是该货主绑定的物料 +// MaterialBaseInfoDO queryDO = new MaterialBaseInfoDO(); +// queryDO.setMaterialCode(r.getMaterialCode()); +// if (topOrganizationId != null) { +// queryDO.setTopOrganizationId(topOrganizationId); +// } +// // 加上货主ID条件,确保查询到的是该货主绑定的物料 +// if (shipperId != null) { +// queryDO.setShipperId(shipperId); +// } +// log.info("尝试通过料号查询物料基础信息,料号: [{}], topOrganizationId: {}, shipperId: {}", +// r.getMaterialCode(), topOrganizationId, shipperId); +// List materialList = materialBaseInfoService.queryList(queryDO); +// log.info("料号查询结果,查询到 {} 条记录", materialList != null ? materialList.size() : 0); +// MaterialBaseInfoPO materialBaseInfoPO = null; +// if (materialList != null && !materialList.isEmpty()) { +// materialBaseInfoPO = materialList.get(0); +// materialBaseInfoId = materialBaseInfoPO.getMaterialBaseInfoId(); +// log.info("通过料号查询到物料基础信息,料号: {}, 物料ID: {}, 货主ID: {}", +// r.getMaterialCode(), materialBaseInfoId, shipperId); +// } else { +// // 如果提供了料号但查询不到(或不属于该货主),直接报错,不允许导入 +// String errorMsg = String.format("导入失败:该货主下不存在该料号(货主名称=%s,料号=%s)。请确保该料号已在物料管理中创建,且属于该货主", +// order.getShipperName(), r.getMaterialCode()); +// log.error(errorMsg); +// throw new ServiceException(errorMsg); +// } +// +// // 数量已在前面检查过,这里直接使用 +// log.info("数量字段检查 - 仓库数量: [{}], 入库数量: [{}], 使用数量: [{}]", +// r.getWarehouseQuantity(), r.getInboundQuantity(), quantity); +// +// InMaterialDetailDO d = new InMaterialDetailDO(); +// d.setMaterialBaseInfoId(materialBaseInfoId); +// if (materialBaseInfoId != null){ +// //从数据库获取名称 +// MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getById(materialBaseInfoId); +// d.setMaterialName(materialBaseInfo.getMaterialName()); +// }else { +// // 设置商品名称和料号(从Excel读取) +// d.setMaterialName(r.getMaterialName()); +// } +// // 如果料号为空但物料ID有值,根据物料ID查询并补充料号 +// String materialCode = r.getMaterialCode(); +// if (StringUtils.isBlank(materialCode) && materialBaseInfoId != null) { +// try { +// MaterialBaseInfoPO materialBaseInfo = materialBaseInfoService.getInfo(materialBaseInfoId); +// if (materialBaseInfo != null && StringUtils.isNotBlank(materialBaseInfo.getMaterialCode())) { +// materialCode = materialBaseInfo.getMaterialCode(); +// log.info("根据物料ID自动补充料号,物料ID: {}, 料号: {}", materialBaseInfoId, materialCode); +// } +// } catch (Exception e) { +// log.warn("根据物料ID查询料号失败,物料ID: {}, 错误: {}", materialBaseInfoId, e.getMessage()); +// } +// } +// d.setMaterialCode(materialCode); +// d.setQuantity(quantity); +// d.setSpecificationModel(r.getSpecificationModel()); +// d.setSkuCode(r.getSkuCode()); +// d.setInvoiceNo(r.getInvoiceNo()); +// d.setDeclaredQuantity(r.getDeclaredQuantity()); +// d.setDeclarationUnit(r.getDeclarationUnit()); +// d.setLiter(r.getLiter()); +// d.setBoxCount(r.getBoxCount()); +// d.setPieceCount(r.getPieceCount()); +// d.setDimensions(r.getDimensions()); +// // 入库数量:优先使用入库数量,如果为空则使用仓库数量 +// BigDecimal inboundQuantity = r.getInboundQuantity(); +// if (inboundQuantity == null) { +// inboundQuantity = r.getWarehouseQuantity(); +// if (inboundQuantity != null) { +// log.info("入库数量为空,使用仓库数量作为入库数量: [{}]", inboundQuantity); +// } +// } +// d.setInboundQuantity(inboundQuantity); +// // 单位:优先使用Excel中的"单位"字段,如果为空则使用"申报单位",如果还为空则从物料主数据获取 +// String unit = StringUtils.isNotBlank(r.getUnit()) ? r.getUnit() : null; +// if (StringUtils.isBlank(unit) && StringUtils.isNotBlank(r.getDeclarationUnit())) { +// unit = r.getDeclarationUnit(); +// log.info("单位字段为空,使用申报单位: {}", unit); +// } +// // 如果Excel中单位仍为空,从物料主数据获取 +// if (StringUtils.isBlank(unit) && materialBaseInfoPO != null && StringUtils.isNotBlank(materialBaseInfoPO.getUnitName())) { +// unit = materialBaseInfoPO.getUnitName(); +// log.info("Excel中单位为空,从物料主数据自动填充单位: {}", unit); +// } +// d.setUnit(unit); +// // 总净重:优先使用主字段,如果为空则使用备用字段 +// d.setTotalNetWeight(r.getTotalNetWeight() != null ? r.getTotalNetWeight() : r.getTotalNetWeight2()); +// // 总毛重:优先使用主字段,如果为空则使用备用字段 +// d.setTotalGrossWeight(r.getTotalGrossWeight() != null ? r.getTotalGrossWeight() : r.getTotalGrossWeight2()); +// // 总体积:优先使用主字段,如果为空则使用备用字段 +// d.setTotalVolume(r.getTotalVolume() != null ? r.getTotalVolume() : r.getTotalVolume2()); +// // 总面积:优先使用主字段,如果为空则使用备用字段 +// d.setTotalArea(r.getTotalArea() != null ? r.getTotalArea() : r.getTotalArea2()); +// d.setBatchRefNo(r.getBatchRefNo()); +// d.setSheetRefNo(r.getSheetRefNo()); +// // 原产国:优先使用Excel中的数据,如果为空则从物料主数据获取 +// String originCountry = StringUtils.isNotBlank(r.getOriginCountry()) ? r.getOriginCountry() : null; +// if (StringUtils.isBlank(originCountry) && materialBaseInfoPO != null && StringUtils.isNotBlank(materialBaseInfoPO.getOriginCountry())) { +// originCountry = materialBaseInfoPO.getOriginCountry(); +// log.info("Excel中原产国为空,从物料主数据自动填充原产国: {}", originCountry); +// } +// d.setOriginCountry(originCountry); +// d.setBoxPalletNo(r.getBoxPalletNo()); +// d.setTotalPrice(r.getTotalPrice()); +// // 币制:优先使用Excel中的数据,如果为空则从物料主数据获取 +// String currency = StringUtils.isNotBlank(r.getCurrency()) ? r.getCurrency() : null; +// if (StringUtils.isBlank(currency) && materialBaseInfoPO != null && StringUtils.isNotBlank(materialBaseInfoPO.getCurrency())) { +// currency = materialBaseInfoPO.getCurrency(); +// log.info("Excel中币制为空,从物料主数据自动填充币制: {}", currency); +// } +// d.setCurrency(currency); +// d.setRemark(r.getDetailRemark()); +// +// // 记录即将保存的明细数据,用于调试 +// log.info("准备保存明细数据 - 商品名称: [{}], 料号: [{}], SKU码: [{}], 规格型号: [{}], 入库数量: [{}], 数量: [{}], 单位: [{}], 总净重: [{}], 总毛重: [{}], 总体积: [{}], 总面积: [{}], 原产国: [{}], 币制: [{}], 备注: [{}]", +// r.getMaterialName(), r.getMaterialCode(), r.getSkuCode(), r.getSpecificationModel(), +// r.getInboundQuantity(), quantity, unit, d.getTotalNetWeight(), d.getTotalGrossWeight(), +// d.getTotalVolume(), d.getTotalArea(), r.getOriginCountry(), r.getCurrency(), r.getDetailRemark()); +// +// details.add(d); +// } +// +// // 如果该订单的所有明细行都被跳过(details为空),跳过该订单 +// if (details.isEmpty()) { +// log.warn("跳过入库单:委托编号NO [{}] 的所有明细行都因数据不完整被跳过,该入库单将不会被导入", h.getConsignmentNo()); +// continue; // 跳过该订单,继续处理下一个订单 +// } +// +// order.setMaterialDetailList(details); +// +// // 导入入库单时,计划数量取所有明细行的入库数量之和 +// if (!CollectionUtils.isEmpty(details)) { +// BigDecimal totalInboundQuantity = details.stream() +// .map(detail -> detail.getInboundQuantity() != null ? detail.getInboundQuantity() : BigDecimal.ZERO) +// .reduce(BigDecimal.ZERO, BigDecimal::add); +// order.setQuantity(totalInboundQuantity); +// log.info("计算计划数量 - 委托编号NO: [{}], 明细行数: {}, 计划数量(入库数量之和): [{}]", +// h.getConsignmentNo(), details.size(), totalInboundQuantity); +// } +// +// // 在导入时,需要调用shipperParam、supplierParam和setDataDict方法,确保货主信息被正确填充 +// // 注意:这里只调用shipperParam,因为导入时只提供了货主名称,需要根据名称查找货主ID和编号 +// try { +// shipperParam(order); +// } catch (Exception e) { +// log.error("导入入库单时设置货主信息失败,委托编号NO:{},货主名称:{},错误:{}", +// h.getConsignmentNo(), order.getShipperName(), e.getMessage()); +// throw new ServiceException("导入失败:设置货主信息失败(委托编号NO=" + h.getConsignmentNo() + ",货主名称=" + order.getShipperName() + ")。" + e.getMessage()); +// } +// // 设置供应商信息(如果提供了供应商ID) +// supplierParam(order); +// // 设置数据字典键值 +// setDataDict(order); +// +// orderList.add(order); +// } +// +// // 如果所有订单都被跳过(orderList为空),抛出异常提示用户 +// if (orderList.isEmpty()) { +// throw new ServiceException("导入失败:所有入库单的明细行都因数据不完整(数量为空或物料基础信息缺失)被跳过,请检查Excel数据"); +// } +// +// return stockInOrderDomainService.batchInsert(orderList); +// } catch (ServiceException e) { +// throw e; +// } catch (Exception e) { +// log.error("导入入库单失败", e); +// throw new ServiceException("导入入库单失败:" + e.getMessage()); +// } +// } + + /** + * 解析日期字符串为Date对象 + * 支持多种日期格式:yyyy-MM-dd, yyyy/MM/dd, yyyy年MM月dd日, Date.toString()格式等 + */ + private Date parseDateString(String dateStr) { + if (StringUtils.isBlank(dateStr)) { + return null; + } + + // 如果已经是Date.toString()格式(如 "Sun Feb 01 00:00:00 CST 2026"),尝试直接解析 + if (dateStr.contains("CST") || dateStr.contains("GMT") || dateStr.contains("UTC")) { + try { + // 尝试解析标准Date.toString()格式 + SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", java.util.Locale.ENGLISH); + return sdf.parse(dateStr); + } catch (ParseException e) { + log.warn("无法解析日期格式: {}", dateStr); + } + } + + // 尝试多种日期格式 + String[] datePatterns = { + "yyyy-MM-dd", + "yyyy/MM/dd", + "yyyy.MM.dd", + "yyyy年MM月dd日", + "yyyy-MM-dd HH:mm:ss", + "yyyy/MM/dd HH:mm:ss", + "yyyy-MM-dd HH:mm", + "yyyy/MM/dd HH:mm" + }; + + for (String pattern : datePatterns) { + try { + SimpleDateFormat sdf = new SimpleDateFormat(pattern); + sdf.setLenient(false); + return sdf.parse(dateStr.trim()); + } catch (ParseException e) { + // 继续尝试下一个格式 + } + } + + // 如果所有格式都失败,记录警告 + log.warn("无法解析日期字符串: {},尝试使用DateUtils.parseDate", dateStr); + try { + // 使用DateUtils的parseDate方法(支持多种格式) + return com.mhd.common.core.utils.DateUtils.parseDate(dateStr); + } catch (Exception e) { + log.error("解析日期失败: {}", dateStr, e); + return null; + } + } + + /** + * 获取Excel单元格的字符串值 + */ + private String getCellValueAsString(Cell cell) { + if (cell == null) { + return ""; + } + switch (cell.getCellType()) { + case STRING: + return cell.getStringCellValue(); + case NUMERIC: + if (DateUtil.isCellDateFormatted(cell)) { + // 日期类型单元格,格式化为 yyyy-MM-dd 或 yyyy-MM-dd HH:mm:ss + Date dateValue = cell.getDateCellValue(); + SimpleDateFormat sdf; + // 检查是否包含时间部分 + if (dateValue.getHours() == 0 && dateValue.getMinutes() == 0 && dateValue.getSeconds() == 0) { + sdf = new SimpleDateFormat("yyyy-MM-dd"); + } else { + sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + } + return sdf.format(dateValue); + } else { + double numericValue = cell.getNumericCellValue(); + if (numericValue == (long) numericValue) { + return String.valueOf((long) numericValue); + } else { + return String.valueOf(numericValue); + } + } + case BOOLEAN: + return String.valueOf(cell.getBooleanCellValue()); + case FORMULA: + return cell.getCellFormula(); + default: + return ""; + } + } + + /** + * @description 设置仓库信息 + * @author ZhouGY + * @date 2024/4/7 10:01 + * @param stockInOrderDO + */ + private void setWarehouseInfo(ReservationStockInOrderDO stockInOrderDO) { + if (stockInOrderDO.getWarehouseId() == null) { + throw new ServiceException("仓库ID不能为空"); + } + AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(stockInOrderDO.getWarehouseId()); + if (ajaxResult == null) { + throw new ServiceException("获取仓库信息失败:返回结果为空,仓库ID:" + stockInOrderDO.getWarehouseId()); + } + Object codeObj = ajaxResult.get("code"); + if (codeObj == null || !"200".equals(String.valueOf(codeObj))) { + String errorMsg = ajaxResult.get("msg") != null ? String.valueOf(ajaxResult.get("msg")) : "未知错误"; + throw new ServiceException("获取仓库信息失败,仓库ID:" + stockInOrderDO.getWarehouseId() + ",错误信息:" + errorMsg); + } + Object dataObj = ajaxResult.get("data"); + if (dataObj == null) { + throw new ServiceException("获取仓库信息失败:返回数据为空,仓库ID:" + stockInOrderDO.getWarehouseId()); + } + WarehouseFeignPO warehouseFeignPO = JSON.parseObject(JSONObject.toJSONString(dataObj), WarehouseFeignPO.class); + if (warehouseFeignPO == null) { + throw new ServiceException("获取仓库信息失败:数据解析失败,仓库ID:" + stockInOrderDO.getWarehouseId()); + } + stockInOrderDO.setWarehouseCode(warehouseFeignPO.getWarehouseCode()); + stockInOrderDO.setWarehouseName(warehouseFeignPO.getWarehouseName()); + } + + /** + * @description 根据货主名称或编号获取货主ID(用于导入时提前获取货主ID) + * @param shipperName 货主名称 + * @param shipperCode 货主编号 + * @return 货主ID,如果找不到则返回null + */ + private Long getShipperIdByNameOrCode(String shipperName, String shipperCode) { + if (StringUtils.isBlank(shipperName) && StringUtils.isBlank(shipperCode)) { + return null; + } + + Long shipperId = null; + + // 优先尝试:如果名称是纯数字,可能是误传的ID,直接按ID查询 + if (StringUtils.isNotEmpty(shipperName) && shipperName.matches("\\d+")) { + try { + Long possibleId = Long.valueOf(shipperName); + AjaxResult ajaxResult = userServiceFeign.getInfo(possibleId); + if ("200".equals(String.valueOf(ajaxResult.get("code"))) && ajaxResult.get("data") != null) { + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); + if (userPo != null) { + shipperId = userPo.getUserId(); + log.info("根据货主名称(实际为ID)找到货主ID:{}", shipperId); + return shipperId; + } + } + } catch (Exception e) { + log.debug("尝试将货主名称作为ID查询失败,货主名称:{},错误:{}", shipperName, e.getMessage()); + } + } + + // 如果仍未找到,尝试根据名称查询 + if (shipperId == null && StringUtils.isNotEmpty(shipperName) && !shipperName.matches("\\d+")) { + try { + AjaxResult ajaxResult = userServiceFeign.getInfoByName(shipperName); + String code = String.valueOf(ajaxResult.get("code")); + if ("200".equals(code) && ajaxResult.get("data") != null) { + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); + if (userPo != null) { + shipperId = userPo.getUserId(); + log.info("根据货主名称找到货主ID,货主名称:{},货主ID:{}", shipperName, shipperId); + return shipperId; + } + } + } catch (Exception e) { + log.debug("根据货主名称查询失败,货主名称:{},错误:{}", shipperName, e.getMessage()); + } + } + + // 如果仍未找到,尝试从货主列表中根据编号或名称查找 + if (shipperId == null && (StringUtils.isNotEmpty(shipperName) || StringUtils.isNotEmpty(shipperCode))) { + try { + AjaxResult shipperListResult = userServiceFeign.userShipperListAll(); + if ("200".equals(String.valueOf(shipperListResult.get("code"))) && shipperListResult.get("data") != null) { + Object data = shipperListResult.get("data"); + List> shipperList = null; + if (data instanceof List) { + @SuppressWarnings("unchecked") + List rawList = (List) data; + shipperList = new ArrayList<>(); + for (Object item : rawList) { + if (item instanceof Map) { + @SuppressWarnings("unchecked") + Map mapItem = (Map) item; + shipperList.add(mapItem); + } else { + Map mapItem = JSON.parseObject(JSONObject.toJSONString(item), Map.class); + shipperList.add(mapItem); + } + } + } else { + String jsonStr = JSONObject.toJSONString(data); + shipperList = JSON.parseObject(jsonStr, new com.alibaba.fastjson.TypeReference>>(){}); + } + + if (shipperList != null && !shipperList.isEmpty()) { + String normalizedShipperName = shipperName != null ? shipperName.trim() : ""; + String normalizedShipperCode = shipperCode != null ? shipperCode.trim() : ""; + + for (Map shipper : shipperList) { + Object userId = shipper.get("userId"); + Object userName = shipper.get("userName"); + Object userCode = shipper.get("userCode"); + Object userMemberCode = shipper.get("userMemberCode"); + + if (userName == null) { + userName = shipper.get("name"); + } + if (userName == null) { + userName = shipper.get("shipperName"); + } + + boolean matched = false; + // 优先根据编号匹配 + if (StringUtils.isNotEmpty(normalizedShipperCode)) { + String normalizedUserCode = userCode != null ? String.valueOf(userCode).trim() : ""; + String normalizedUserMemberCode = userMemberCode != null ? String.valueOf(userMemberCode).trim() : ""; + if (normalizedShipperCode.equals(normalizedUserCode) || + normalizedShipperCode.equals(normalizedUserMemberCode)) { + matched = true; + } + } + // 如果编号不匹配,再根据名称匹配 + if (!matched && StringUtils.isNotEmpty(normalizedShipperName) && userName != null) { + String normalizedUserName = String.valueOf(userName).trim(); + if (normalizedShipperName.equals(normalizedUserName) || + normalizedUserName.contains(normalizedShipperName)) { + matched = true; + } + } + + if (matched && userId != null) { + shipperId = Long.valueOf(String.valueOf(userId)); + log.info("从货主列表中找到货主ID,货主名称:{},货主编号:{},货主ID:{}", + shipperName, shipperCode, shipperId); + return shipperId; + } + } + } + } + } catch (Exception e) { + log.debug("从货主列表中查找货主ID失败,货主名称:{},货主编号:{},错误:{}", + shipperName, shipperCode, e.getMessage()); + } + } + + if (shipperId == null) { + log.warn("未找到货主ID,货主名称:{},货主编号:{}", shipperName, shipperCode); + } + + return shipperId; + } + + /** + * @description 封装货主信息(改为与出库单相同的简洁逻辑,使用入库单的字段shipperName) + * @author ZhouGY + * @date 2024/5/9 20:43 + * @param stockInOrderDO + */ + private void shipperParam(ReservationStockInOrderDO stockInOrderDO){ + // 新增/编辑时前端可能只传 shipperId(下拉选中值),shipperName 为空。 + // 这里优先按 shipperId 回填货主编码/名称;其次再按 shipperName(名称或数字ID字符串)回填。 + + // 1) 优先按 shipperId 查询 + if (ObjectUtil.isNotNull(stockInOrderDO.getShipperId())) { + AjaxResult ajaxResult = userServiceFeign.getInfo(stockInOrderDO.getShipperId()); + if(!"200".equals(String.valueOf(ajaxResult.get("code")))){ + throw new ServiceException("获取货主信息失败"); + } + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); + stockInOrderDO.setShipperId(userPo.getUserId()); + stockInOrderDO.setShipperCode(userPo.getUserMemberCode()); + stockInOrderDO.setShipperName(userPo.getUserName()); + return; + } + + // 2) shipperId 为空时,按 shipperName 兜底 + String shipperName = stockInOrderDO.getShipperName(); + if (StringUtils.isEmpty(shipperName)) { + return; + } + if (!shipperName.matches("\\d+")) { + // 按名称查询 + AjaxResult ajaxResult = userServiceFeign.getInfoByName(shipperName); + if(!"200".equals(String.valueOf(ajaxResult.get("code")))){ + throw new ServiceException("获取货主信息失败"); + } + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); + stockInOrderDO.setShipperId(userPo.getUserId()); + stockInOrderDO.setShipperCode(userPo.getUserMemberCode()); + stockInOrderDO.setShipperName(userPo.getUserName()); + } else { + // shipperName 是数字:按ID查询 + AjaxResult ajaxResult = userServiceFeign.getInfo(Long.valueOf(shipperName)); + if(!"200".equals(String.valueOf(ajaxResult.get("code")))){ + throw new ServiceException("获取货主信息失败"); + } + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); + stockInOrderDO.setShipperId(userPo.getUserId()); + stockInOrderDO.setShipperCode(userPo.getUserMemberCode()); + stockInOrderDO.setShipperName(userPo.getUserName()); + } + } + + /** + * @description 封装供应商信息 + * @author ZhouGY + * @date 2024/5/9 20:43 + * @param stockInOrderDO + */ + private void supplierParam(ReservationStockInOrderDO stockInOrderDO){ + if (ObjectUtil.isNotNull(stockInOrderDO.getSupplierId())){ + AjaxResult ajaxResult = userServiceFeign.getInfo(stockInOrderDO.getSupplierId()); + if(!"200".equals(String.valueOf(ajaxResult.get("code")))){ + throw new ServiceException("获取供应商信息失败"); + } + UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class); + stockInOrderDO.setSupplierName(userPo.getUserName()); + } + } + + /** + * @description 设置数据字典键值 + * @author ZhouGY + * @date 2024/4/7 14:33 + * @param stockInOrderDO + */ + private void setDataDict(ReservationStockInOrderDO stockInOrderDO){ + //翻译单据类型 + if (StringUtils.isNotBlank(stockInOrderDO.getOrderTypeCode())){ + AjaxResult documentTypeResult = systemServiceFeign.selectListByDictType(DictCode.DOCUMENT_TYPE.getCode()); + if (!"200".equals(String.valueOf(documentTypeResult.get("code")))) { + throw new ServiceException("单据类型数据字典不存在"); + } + List documentTypeDataList = JSON.parseArray(JSONUtil.toJsonStr(documentTypeResult.get("data")), SysDictData.class); + + SysDictData documentTypeData = documentTypeDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), stockInOrderDO.getOrderTypeCode())).findAny().orElse(null); + if (null == documentTypeData) { + throw new ServiceException("单据类型【" + stockInOrderDO.getOrderTypeCode() + "】数据字典不存在 请联系管理员"); + } + stockInOrderDO.setOrderTypeName(documentTypeData.getDictLabel()); + } + + //翻译优先级别类型 + if (StringUtils.isNotBlank(stockInOrderDO.getPriorityLevelCode())){ + AjaxResult priorityLevelResult = systemServiceFeign.selectListByDictType(DictCode.PRIORITY_LEVEL.getCode()); + if (!"200".equals(String.valueOf(priorityLevelResult.get("code")))) { + throw new ServiceException("优先级别类型数据字典不存在"); + } + List priorityLevelDataList = JSON.parseArray(JSONUtil.toJsonStr(priorityLevelResult.get("data")), SysDictData.class); + + SysDictData priorityLevelData = priorityLevelDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), stockInOrderDO.getPriorityLevelCode())).findAny().orElse(null); + if (null == priorityLevelData) { + throw new ServiceException("优先级别类型【" + stockInOrderDO.getPriorityLevelCode() + "】数据字典不存在 请联系管理员"); + } + stockInOrderDO.setPriorityLevelName(priorityLevelData.getDictLabel()); + } + } + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderAssembler.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderAssembler.java new file mode 100644 index 000000000..c82183cd1 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderAssembler.java @@ -0,0 +1,134 @@ +package com.mhd.oms.domain.reservationStockInOrder.service; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONUtil; +import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException; +import com.mhd.common.core.exception.digitalLogisticsException.UserError; +import com.mhd.common.core.utils.IgnoreNullUtil; +import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDO; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDTO; +import com.mhd.system.api.model.LoginUser; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 入库单Assembler + * + * @author gen + * @date 2024-05-21 + */ +@Component +public class ReservationStockInOrderAssembler { + + /** + * 转换实体 + */ + public ReservationStockInOrderDO toDO(ReservationStockInOrderDTO stockInOrderDTO) { + ReservationStockInOrderDO stockInOrderDO = new ReservationStockInOrderDO(); + // 拷贝 + BeanUtils.copyProperties(stockInOrderDTO, stockInOrderDO, IgnoreNullUtil.getNullPropertyNames(stockInOrderDTO)); + // 确保查询条件字段被正确传递(查询条件字段需要明确传递,避免被IgnoreNullUtil忽略) + stockInOrderDO.setCreateTimeStart(stockInOrderDTO.getCreateTimeStart()); + stockInOrderDO.setCreateTimeEnd(stockInOrderDTO.getCreateTimeEnd()); + // 列表筛选:前端常传「名称 (编码)」展示串,库内多为纯名称,去掉末尾括号段再 LIKE + if (stockInOrderDTO.getMaterialName() != null && !stockInOrderDTO.getMaterialName().isEmpty()) { + String normalized = normalizeDetailMaterialNameForQuery(stockInOrderDTO.getMaterialName()); + stockInOrderDO.setMaterialName(normalized.isEmpty() + ? stockInOrderDTO.getMaterialName().trim() + : normalized); + } + return stockInOrderDO; + } + + /** + * 转换实体 + */ + public ReservationStockInOrderDO toDOByEdit(ReservationStockInOrderDTO stockInOrderDTO) { + // 兼容前端传 userName 作为货主名称字段的情况: + // 如果 shipperName 为空但 userName 有值,则优先回填到 shipperName, + // 以保证后续 shipperParam 能根据名称正确找到货主ID。 + if (ObjectUtil.isNull(stockInOrderDTO.getShipperId()) + && (stockInOrderDTO.getShipperName() == null || stockInOrderDTO.getShipperName().trim().length() == 0) + && stockInOrderDTO.getUserName() != null && stockInOrderDTO.getUserName().trim().length() > 0) { + stockInOrderDTO.setShipperName(stockInOrderDTO.getUserName().trim()); + } + + ReservationStockInOrderDO stockInOrderDO = JSONUtil.toBean(JSONUtil.toJsonStr(stockInOrderDTO), ReservationStockInOrderDO.class); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + // 获取登录人id + Long userId = loginUser.getUserid(); + // 获取用户姓名(优先从UserPo获取,如果为空则使用realname,最后使用username作为兜底) + String userRealName = null; + if (loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null + && !loginUser.getUserPo().getUserName().trim().isEmpty()) { + // 优先使用UserPo中的userName(用户真实姓名) + userRealName = loginUser.getUserPo().getUserName(); + } else if (loginUser.getRealname() != null && !loginUser.getRealname().trim().isEmpty()) { + // 其次使用realname + userRealName = loginUser.getRealname(); + } else { + // 最后使用username(账号)作为兜底 + userRealName = loginUser.getUsername(); + } + if(stockInOrderDTO.getInOrderId() != null){ + stockInOrderDO.setUpdateBy(userId); + stockInOrderDO.setUpdateByName(userRealName); + stockInOrderDO.setUpdateTime(new Date()); + }else { + stockInOrderDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); + stockInOrderDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + stockInOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + stockInOrderDO.setCreateBy(userId); + // 强制设置创建人姓名为用户真实姓名,确保覆盖前端可能传递的账号 + stockInOrderDO.setCreateByName(userRealName); + stockInOrderDO.setCreateTime(new Date()); + stockInOrderDO.setDelFlag(1); + // 新增入库单时,如果入库单类型为空,默认设置为普通入库 + String orderTypeCode = stockInOrderDO.getOrderTypeCode(); + if (orderTypeCode == null || orderTypeCode.trim().length() == 0) { + stockInOrderDO.setOrderTypeCode("pu_tong_ru_ku"); + } + String orderTypeName = stockInOrderDO.getOrderTypeName(); + if (orderTypeName == null || orderTypeName.trim().length() == 0) { + stockInOrderDO.setOrderTypeName("普通入库单"); + } + // 新增入库单时,计划数量取所有明细行的入库数量之和 + if (!CollectionUtils.isEmpty(stockInOrderDO.getMaterialDetailList())) { + BigDecimal totalInboundQuantity = stockInOrderDO.getMaterialDetailList().stream() + .map(detail -> detail.getInboundQuantity() != null ? detail.getInboundQuantity() : BigDecimal.ZERO) + .reduce(BigDecimal.ZERO, BigDecimal::add); + stockInOrderDO.setQuantity(totalInboundQuantity); + } + } + return stockInOrderDO; + } + + /** + * 去掉物料展示名末尾的「 (xxx) / (xxx)」等,便于与库内 material_name 模糊匹配。 + */ + private static String normalizeDetailMaterialNameForQuery(String raw) { + if (raw == null) { + return null; + } + String s = raw.trim(); + // 循环去掉末尾多组括号(兼容「名称 (编码)」或重复后缀) + String next; + do { + next = s.replaceFirst("[\\s\\u3000]*[((][^))]*[))]\\s*$", "").trim(); + if (next.equals(s)) { + break; + } + s = next; + } while (!s.isEmpty()); + return s; + } + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java new file mode 100644 index 000000000..d5e4fdcca --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java @@ -0,0 +1,789 @@ +package com.mhd.oms.domain.reservationStockInOrder.service; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.utils.OrderSequence; +import com.mhd.common.core.utils.StringUtils; +import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.facade.IReservationInMaterialDetailService; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailBaseDO; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO; +import com.mhd.oms.domain.reservationStockInOrder.entity.ReservationStockInOrder; +import com.mhd.oms.domain.reservationStockInOrder.repository.facade.IReservationStockInOrderService; +import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialGoodsRulePO; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialWarehouseControlPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.ReservationStockInOrderPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDO; +import com.mhd.system.api.SystemServiceFeign; +import com.mhd.system.api.domain.PackDetailFeignPO; +import com.mhd.system.api.model.LoginUser; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 入库单 + * + * @author gen + * @date 2024-05-21 + */ +@Service +@Slf4j +public class ReservationStockInOrderDomainService { + + @Autowired + private IReservationStockInOrderService stockInOrderService; + @Autowired + private IReservationInMaterialDetailService materialDetailService; +// @Autowired +// private ReservationStockReceiptOrderDomainService stockReceiptOrderDomainService; +// @Autowired +// private ReservationStockShelfOrderDomainService stockShelfOrderDomainService; +// @Autowired +// private IMaterialBaseInfoService materialBaseInfoService; +// @Autowired +// private IMaterialGoodsRuleService materialGoodsRuleService; +// @Autowired +// private IMaterialWarehouseControlService materialWarehouseControlService; + @Autowired + private SystemServiceFeign systemServiceFeign; + @Autowired + private ReservationStockInOrderMapper reservationStockInOrderMapper; +// @Autowired +// private IReceiptMaterialDetailService receiptMaterialDetailService; +// @Autowired +// private IShelfMaterialDetailService shelfMaterialDetailService; + + /** + * 分页查询入库单列表 + */ + public List queryList(ReservationStockInOrderDO stockInOrderDO) { + return stockInOrderService.queryList(stockInOrderDO); + } + + + /** + * 新增入库单 + */ + @Transactional(rollbackFor = Exception.class) + public Boolean insert(ReservationStockInOrderDO stockInOrderDO) { + stockInOrderDO.setInOrderNumber(OrderSequence.getOrderCode("RK")); +// //设置默认值 +// setDefaultValues(stockInOrderDO); +// //设置物料信息 +// setMaterialDetailInfo(stockInOrderDO); +// //统计总物料种数 +// stockInOrderDO.setMaterialQuantity(stockInOrderDO.getMaterialDetailList().size()); +// //统计总计划数 +// BigDecimal quantity = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); +// stockInOrderDO.setQuantity(quantity); +// //统计总重量 +// BigDecimal weightLimit = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getWeightLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); +// stockInOrderDO.setWeightLimit(weightLimit); +// //统计总体积 +// BigDecimal volumeLimit = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getVolumeLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); +// stockInOrderDO.setVolumeLimit(volumeLimit); + stockInOrderService.insert(stockInOrderDO); + return materialDetailService.batchInsert(stockInOrderDO.getInOrderNumber(), stockInOrderDO.getMaterialDetailList()); + } + + /** + * 批量新增入库单 + */ + public Boolean batchInsert(List stockInOrderDOList) { + for (ReservationStockInOrderDO stockInOrderDO : stockInOrderDOList){ + if (StringUtils.isBlank(stockInOrderDO.getInOrderNumber())){ + stockInOrderDO.setInOrderNumber(OrderSequence.getOrderCode("RK")); + } +// //设置物料信息 +// setMaterialDetailInfo(stockInOrderDO); +// //统计总物料种数 +// stockInOrderDO.setMaterialQuantity(stockInOrderDO.getMaterialDetailList().size()); +// //统计总计划数 +// BigDecimal quantity = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); +// stockInOrderDO.setQuantity(quantity); +// //统计总重量 +// BigDecimal weightLimit = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getWeightLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); +// stockInOrderDO.setWeightLimit(weightLimit); +// //统计总体积 +// BigDecimal volumeLimit = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getVolumeLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); +// stockInOrderDO.setVolumeLimit(volumeLimit); + stockInOrderService.insert(stockInOrderDO); + materialDetailService.batchInsert(stockInOrderDO.getInOrderNumber(), stockInOrderDO.getMaterialDetailList()); + } + return true; + } + + /** + * 修改入库单 + */ + @Transactional(rollbackFor = Exception.class) + public Boolean update(ReservationStockInOrderDO stockInOrderDO) { + ReservationStockInOrderPO stockInOrderPO = stockInOrderService.getInfo(stockInOrderDO.getInOrderId()); + if (stockInOrderPO == null){ + throw new ServiceException("入库单信息不存在"); + } + //设置物料信息 + setMaterialDetailInfo(stockInOrderDO); + //统计总物料种数 + stockInOrderDO.setMaterialQuantity(stockInOrderDO.getMaterialDetailList().size()); + //统计总计划数 + BigDecimal quantity = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); + stockInOrderPO.setQuantity(quantity); + stockInOrderDO.setQuantity(quantity); + //统计总重量 + BigDecimal weightLimit = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getWeightLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); + stockInOrderDO.setWeightLimit(weightLimit); + //统计总体积 + BigDecimal volumeLimit = stockInOrderDO.getMaterialDetailList().stream().map(ReservationInMaterialDetailDO::getVolumeLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); + stockInOrderDO.setVolumeLimit(volumeLimit); + stockInOrderService.update(stockInOrderDO); + ReservationInMaterialDetailBaseDO inMaterialDetailBaseDO = new ReservationInMaterialDetailBaseDO(); + BeanUtils.copyProperties(stockInOrderPO, inMaterialDetailBaseDO); + inMaterialDetailBaseDO.setInOrderNumber(stockInOrderPO.getInOrderNumber()); + return materialDetailService.batchUpdate(stockInOrderDO.getMaterialDetailList(), inMaterialDetailBaseDO); + } + + /** + * 批量删除入库单 + */ + public Boolean delete(Long[] inOrderIds) { + return stockInOrderService.delete(inOrderIds); + } + + + /** + * 获取入库单详细信息 + */ + public ReservationStockInOrderPO getInfo(Long inOrderId) + { + ReservationStockInOrderPO stockInOrderPO = stockInOrderService.getInfo(inOrderId); + ReservationInMaterialDetailDO inMaterialDetailDO = new ReservationInMaterialDetailDO(); + inMaterialDetailDO.setInOrderNumber(stockInOrderPO.getInOrderNumber()); + inMaterialDetailDO.setLevel(1); + List inMaterialDetailPOList = materialDetailService.queryList(inMaterialDetailDO); + + // 先通过入库单号查询收货单列表 +// StockReceiptOrderDO stockReceiptOrderDO = new StockReceiptOrderDO(); +// stockReceiptOrderDO.setInOrderNumber(stockInOrderPO.getInOrderNumber()); +// List stockReceiptOrderPOList = stockReceiptOrderDomainService.queryList(stockReceiptOrderDO); +// +// // 先通过入库单号查询上架单列表 +// StockShelfOrderDO stockShelfOrderDO = new StockShelfOrderDO(); +// stockShelfOrderDO.setInOrderNumber(stockInOrderPO.getInOrderNumber()); +// List stockShelfOrderPOList = stockShelfOrderDomainService.queryList(stockShelfOrderDO); +// + // 查询收货单明细,用于填充收货数量和更新毛重、净重、面积、体积 +// List receiptMaterialDetailPOList = new ArrayList<>(); +// if (!CollectionUtils.isEmpty(stockReceiptOrderPOList)) { +// List receiptOrderNumberList = stockReceiptOrderPOList.stream() +// .map(StockReceiptOrderPO::getReceiptOrderNumber) +// .filter(StringUtils::isNotBlank) +// .collect(Collectors.toList()); +// if (!CollectionUtils.isEmpty(receiptOrderNumberList)) { +// ReceiptMaterialDetailDO receiptMaterialDetailDO = new ReceiptMaterialDetailDO(); +// receiptMaterialDetailDO.setReceiptOrderNumberList(receiptOrderNumberList); +// receiptMaterialDetailPOList = receiptMaterialDetailService.queryList(receiptMaterialDetailDO); +// } +// } + + // 查询上架单明细,用于填充上架数量 +// List shelfMaterialDetailPOList = new ArrayList<>(); +// if (!CollectionUtils.isEmpty(stockShelfOrderPOList)) { +// for (StockShelfOrderPO stockShelfOrderPO : stockShelfOrderPOList) { +// if (StringUtils.isNotBlank(stockShelfOrderPO.getShelfOrderNumber())) { +// ShelfMaterialDetailDO shelfMaterialDetailDO = new ShelfMaterialDetailDO(); +// shelfMaterialDetailDO.setShelfOrderNumber(stockShelfOrderPO.getShelfOrderNumber()); +// List shelfDetails = shelfMaterialDetailService.queryList(shelfMaterialDetailDO); +// if (!CollectionUtils.isEmpty(shelfDetails)) { +// shelfMaterialDetailPOList.addAll(shelfDetails); +// } +// } +// } +// } + + // 按 materialDetailId 分组汇总收货数量和上架数量,以及更新毛重、净重、面积、体积 + if (!CollectionUtils.isEmpty(inMaterialDetailPOList)) { + // 按 materialDetailId 分组汇总收货数量(实际收货数量)、毛重、净重、面积、体积 + // 收货数量:入库单对应的收货单实际收货数量汇总 +// Map receiptDetailMap = new HashMap<>(); +// if (!CollectionUtils.isEmpty(receiptMaterialDetailPOList)) { +// // 递归处理所有层级的收货单明细(包括子明细) +// for (ReceiptMaterialDetailPO receiptDetail : receiptMaterialDetailPOList) { +// processReceiptDetail(receiptDetail, receiptDetailMap); +// } +// } + + // 按 materialDetailId 分组汇总上架数量(实际上架数量) + // 上架数量:入库单对应的上架单实际上架数量汇总 +// Map shelfQuantityMap = new HashMap<>(); +// if (!CollectionUtils.isEmpty(shelfMaterialDetailPOList)) { +// for (ShelfMaterialDetailPO shelfDetail : shelfMaterialDetailPOList) { +// if (shelfDetail.getMaterialDetailId() != null && shelfDetail.getShelvesQuantity() != null) { +// Long materialDetailId = shelfDetail.getMaterialDetailId(); +// BigDecimal shelvesQuantity = shelfQuantityMap.getOrDefault(materialDetailId, BigDecimal.ZERO); +// shelfQuantityMap.put(materialDetailId, shelvesQuantity.add(shelfDetail.getShelvesQuantity())); +// } +// } +// } + + // 填充入库单明细的收货数量、上架数量;入库单明细 total* 保持计划值不因收货覆盖(原按收货汇总 total* 已注释保留) + for (ReservationInMaterialDetailPO inMaterialDetail : inMaterialDetailPOList) { + Long materialDetailId = inMaterialDetail.getMaterialDetailId(); + if (materialDetailId != null) { + // 填充收货数量(入库单对应的收货单实际收货数量) + //ReceiptMaterialDetailPO receiptDetail = receiptDetailMap.get(materialDetailId); +// if (receiptDetail != null) { + // 更新收货数量 +// if (receiptDetail.getReceiptQuantity() != null) { +// inMaterialDetail.setReceiptQuantity(receiptDetail.getReceiptQuantity()); +// } + + // 更新毛重、净重、面积、体积(根据收货时所填的明细行数据更新到入库单明细中) + // 将收货单明细中填写的数据汇总后更新到入库单明细 +// if (receiptDetail.getTotalGrossWeight() != null) { +// inMaterialDetail.setTotalGrossWeight(receiptDetail.getTotalGrossWeight()); +// } +// if (receiptDetail.getTotalNetWeight() != null) { +// inMaterialDetail.setTotalNetWeight(receiptDetail.getTotalNetWeight()); +// } +// if (receiptDetail.getTotalArea() != null) { +// inMaterialDetail.setTotalArea(receiptDetail.getTotalArea()); +// } +// if (receiptDetail.getTotalVolume() != null) { +// inMaterialDetail.setTotalVolume(receiptDetail.getTotalVolume()); +// } +// } + + // 填充上架数量(入库单对应的上架单实际上架数量) +// BigDecimal shelvesQuantity = shelfQuantityMap.get(materialDetailId); +// if (shelvesQuantity != null) { +// inMaterialDetail.setShelvesQuantity(shelvesQuantity); +// } + } + } + } + + stockInOrderPO.setMaterialDetailList(inMaterialDetailPOList); + return stockInOrderPO; + } + + /** + * 递归处理收货单明细,汇总收货数量;毛重/净重/面积/体积汇总已注释(入库单明细 total* 不因收货覆盖) + * @param receiptDetail 收货单明细 + * @param receiptDetailMap 收货单明细汇总Map + */ +// private void processReceiptDetail(ReceiptMaterialDetailPO receiptDetail, Map receiptDetailMap) { +// if (receiptDetail == null || receiptDetail.getMaterialDetailId() == null) { +// return; +// } +// +// Long materialDetailId = receiptDetail.getMaterialDetailId(); +// ReceiptMaterialDetailPO existing = receiptDetailMap.get(materialDetailId); +// +// if (existing == null) { +// // 如果不存在,直接放入Map +// receiptDetailMap.put(materialDetailId, receiptDetail); +// } else { +// // 如果已存在,汇总收货数量、毛重、净重、面积、体积 +// // 汇总收货数量(实际收货数量) +// BigDecimal receiptQuantity = existing.getReceiptQuantity() != null ? existing.getReceiptQuantity() : BigDecimal.ZERO; +// BigDecimal newReceiptQuantity = receiptDetail.getReceiptQuantity() != null ? receiptDetail.getReceiptQuantity() : BigDecimal.ZERO; +// existing.setReceiptQuantity(receiptQuantity.add(newReceiptQuantity)); +// +// // 汇总毛重、净重、面积、体积(根据收货时填写的数据)— 入库单明细 total* 不因收货覆盖,已注释保留 +// // 累加所有收货单明细的毛重、净重、面积、体积 +//// BigDecimal existingGrossWeight = existing.getTotalGrossWeight() != null ? existing.getTotalGrossWeight() : BigDecimal.ZERO; +//// BigDecimal newGrossWeight = receiptDetail.getTotalGrossWeight() != null ? receiptDetail.getTotalGrossWeight() : BigDecimal.ZERO; +//// existing.setTotalGrossWeight(existingGrossWeight.add(newGrossWeight)); +//// +//// BigDecimal existingNetWeight = existing.getTotalNetWeight() != null ? existing.getTotalNetWeight() : BigDecimal.ZERO; +//// BigDecimal newNetWeight = receiptDetail.getTotalNetWeight() != null ? receiptDetail.getTotalNetWeight() : BigDecimal.ZERO; +//// existing.setTotalNetWeight(existingNetWeight.add(newNetWeight)); +//// +//// BigDecimal existingArea = existing.getTotalArea() != null ? existing.getTotalArea() : BigDecimal.ZERO; +//// BigDecimal newArea = receiptDetail.getTotalArea() != null ? receiptDetail.getTotalArea() : BigDecimal.ZERO; +//// existing.setTotalArea(existingArea.add(newArea)); +//// +//// BigDecimal existingVolume = existing.getTotalVolume() != null ? existing.getTotalVolume() : BigDecimal.ZERO; +//// BigDecimal newVolume = receiptDetail.getTotalVolume() != null ? receiptDetail.getTotalVolume() : BigDecimal.ZERO; +//// existing.setTotalVolume(existingVolume.add(newVolume)); +// } +// +// // 递归处理子明细 +// if (!CollectionUtils.isEmpty(receiptDetail.getChildren())) { +// for (ReceiptMaterialDetailPO child : receiptDetail.getChildren()) { +// processReceiptDetail(child, receiptDetailMap); +// } +// } +// } + + /** + * @description 审核入库单 + * @author ZhouGY + * @date 2024/5/21 13:53 + * @param stockInOrderDO + * @return Boolean + */ + @Transactional(rollbackFor = Exception.class) + public Boolean auditState(ReservationStockInOrderDO stockInOrderDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + //统计是否已经审核 + int count = stockInOrderService.count(new QueryWrapper().lambda() + .eq(ReservationStockInOrder::getAuditStatus, 3) + .eq(ReservationStockInOrder::getDelFlag, 1) + .in(ReservationStockInOrder::getInOrderId, stockInOrderDO.getInOrderIds())); + if (count > 0){ + throw new ServiceException("入库单已审核,请重新选择!"); + } + + //生成收货单 +// if (stockInOrderDO.getAuditStatus() == 3){ +// auditApprove(stockInOrderDO); +// } + // 获取用户姓名(优先从UserPo获取,如果为空则使用realname,最后使用username作为兜底) + String userRealName = loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null + ? loginUser.getUserPo().getUserName() + : (loginUser.getRealname() != null ? loginUser.getRealname() : loginUser.getUsername()); + return stockInOrderService.update(null, new UpdateWrapper().lambda() + .set(3 == stockInOrderDO.getAuditStatus(), ReservationStockInOrder::getStatus, 2) + .set(ReservationStockInOrder::getAuditStatus, stockInOrderDO.getAuditStatus()) + .set(ReservationStockInOrder::getAuditRemark, stockInOrderDO.getAuditRemark()) + .set(ReservationStockInOrder::getAuditBy, loginUser.getUserid()) + .set(ReservationStockInOrder::getAuditByName, userRealName) + .set(ReservationStockInOrder::getAuditTime, new Date()) + .set(ReservationStockInOrder::getUpdateBy, loginUser.getUserid()) + .set(ReservationStockInOrder::getUpdateByName, userRealName) + .set(ReservationStockInOrder::getUpdateTime, new Date()) + .in(ReservationStockInOrder::getInOrderId, stockInOrderDO.getInOrderIds())); + } + + + /** + * @description 取消入库单 + * @author ZhouGY + * @date 2024/5/21 13:53 + * @param stockInOrderDO + * @return Boolean + */ + public Boolean cancelOrder(ReservationStockInOrderDO stockInOrderDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + return stockInOrderService.update(null, new UpdateWrapper().lambda() + .set(ReservationStockInOrder::getCancelOrder, 2) + .set(ReservationStockInOrder::getCancelRemark, stockInOrderDO.getCancelRemark()) + .set(ReservationStockInOrder::getCancelBy, loginUser.getUserid()) + .set(ReservationStockInOrder::getCancelByName, loginUser.getUsername()) + .set(ReservationStockInOrder::getCancelTime, new Date()) + .set(ReservationStockInOrder::getUpdateBy, loginUser.getUserid()) + .set(ReservationStockInOrder::getUpdateByName, loginUser.getUsername()) + .set(ReservationStockInOrder::getUpdateTime, new Date()) + .in(ReservationStockInOrder::getInOrderId, stockInOrderDO.getInOrderIds())); + } + + /** + * @description 关闭入库单 + * @author ZhouGY + * @date 2024/5/21 13:53 + * @param stockInOrderDO + * @return Boolean + */ + public Boolean closeOrder(ReservationStockInOrderDO stockInOrderDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + return stockInOrderService.update(null, new UpdateWrapper().lambda() + .set(ReservationStockInOrder::getCloseOrder, 1) + .set(ReservationStockInOrder::getStatus, 7) + .set(ReservationStockInOrder::getCloseRemark, stockInOrderDO.getCloseRemark()) + .set(ReservationStockInOrder::getCloseBy, loginUser.getUserid()) + .set(ReservationStockInOrder::getCloseByName, loginUser.getUsername()) + .set(ReservationStockInOrder::getCloseTime, new Date()) + .set(ReservationStockInOrder::getUpdateBy, loginUser.getUserid()) + .set(ReservationStockInOrder::getUpdateByName, loginUser.getUsername()) + .set(ReservationStockInOrder::getUpdateTime, new Date()) + .in(ReservationStockInOrder::getInOrderId, stockInOrderDO.getInOrderIds())); + } + + /** + * @description 审核通过生成收货单 + * @author ZhouGY + * @date 2024/5/22 14:48 + * @param stockInOrderDO + * @return Boolean + */ +// public Boolean auditApprove(ReservationStockInOrderDO stockInOrderDO){ +// ReservationStockInOrderDO stockInOrderDOByQuery = new ReservationStockInOrderDO(); +// stockInOrderDOByQuery.setInOrderIds(stockInOrderDO.getInOrderIds()); +// stockInOrderDOByQuery.setLtAuditStatus(3); +// List stockInOrderPOList = stockInOrderService.queryList(stockInOrderDOByQuery); +// if (CollectionUtils.isEmpty(stockInOrderPOList)){ +// throw new ServiceException("出库单不存在或已审核通过"); +// } +// List inOrderNumberList = stockInOrderPOList.stream().map(ReservationStockInOrderPO::getInOrderNumber).collect(Collectors.toList()); +// ReservationInMaterialDetailDO inMaterialDetailDO = new ReservationInMaterialDetailDO(); +// inMaterialDetailDO.setInOrderNumberList(inOrderNumberList); +// List inMaterialDetailPOList = materialDetailService.queryListChildren(inMaterialDetailDO); +// Map> inMaterialDetailListMap = inMaterialDetailPOList.stream().collect(Collectors.groupingBy(ReservationInMaterialDetailPO::getInOrderNumber)); +// +// List stockReceiptOrderDOList = new ArrayList<>(); +// stockInOrderPOList.forEach(p -> { +// StockReceiptOrderDO stockReceiptOrderDO = new StockReceiptOrderDO(); +// BeanUtils.copyProperties(p, stockReceiptOrderDO); +// stockReceiptOrderDO.setReceiptOrderNumber(OrderSequence.getOrderCode("SH")); +// List inMaterialDetailPOs = inMaterialDetailListMap.get(p.getInOrderNumber()); +// if (!CollectionUtils.isEmpty(inMaterialDetailPOs)){ +// List receiptMaterialDetailDOList = new ArrayList<>(); +// inMaterialDetailPOs.forEach(inMaterialDetailPO -> { +// ReceiptMaterialDetailDO receiptMaterialDetailDO = new ReceiptMaterialDetailDO(); +// BeanUtils.copyProperties(inMaterialDetailPO, receiptMaterialDetailDO); +// receiptMaterialDetailDO.setInUniqueId(inMaterialDetailPO.getUniqueId()); +// +// // 复制特定字段:生产日期、过期日期、存货日期、批次参考号、单据参考号、箱号/卡板号、扩展属性1-4 +// // 这些字段可能使用驼峰命名或下划线命名,使用反射获取和设置 +// copySpecialFields(inMaterialDetailPO, receiptMaterialDetailDO); +// //收货计划数量赋值 +// receiptMaterialDetailDO.setQuantity(inMaterialDetailPO.getInboundQuantity()); +// receiptMaterialDetailDOList.add(receiptMaterialDetailDO); +// }); +// stockReceiptOrderDO.setMaterialDetailList(receiptMaterialDetailDOList); +// stockReceiptOrderDO.setMaterialQuantity(receiptMaterialDetailDOList.size()); +// // 重新计算计划数量:从物料明细中汇总quantity字段 +// BigDecimal quantity = receiptMaterialDetailDOList.stream() +// .map(ReceiptMaterialDetailDO::getQuantity) +// .filter(Objects::nonNull) +// .reduce(BigDecimal.ZERO, BigDecimal::add); +// stockReceiptOrderDO.setQuantity(quantity); +// } else { +// // 如果没有物料明细,将数量设置为0 +// stockReceiptOrderDO.setQuantity(BigDecimal.ZERO); +// } +// stockReceiptOrderDOList.add(stockReceiptOrderDO); +// }); +// //判断物流是否需要生成质检单 +// genQualityInspection(stockReceiptOrderDOList); +// //生成收货单 +// Boolean batchInsertResult = stockReceiptOrderDomainService.batchInsert(stockReceiptOrderDOList); +// if (!batchInsertResult) { +// throw new ServiceException("生成收货单失败"); +// } +// //生成收货任务:根据入库单号查询刚生成的收货单 +// List stockReceiptOrderPOList = new ArrayList<>(); +// for (String inOrderNumber : inOrderNumberList) { +// StockReceiptOrderDO stockReceiptOrderDOQuery = new StockReceiptOrderDO(); +// stockReceiptOrderDOQuery.setInOrderNumber(inOrderNumber); +// List receiptOrderList = stockReceiptOrderDomainService.queryList(stockReceiptOrderDOQuery); +// if (!CollectionUtils.isEmpty(receiptOrderList)) { +// stockReceiptOrderPOList.addAll(receiptOrderList); +// } +// } +// if (!CollectionUtils.isEmpty(stockReceiptOrderPOList)) { +// stockReceiptOrderDomainService.genStockReceiptTaskOrder(stockReceiptOrderPOList); +// } +// return batchInsertResult; +// } + + + + /** + * @description 设置物料信息 + * @author ZhouGY + * @date 2024/5/23 14:03 + * @param stockInOrderDO + */ + private void setMaterialDetailInfo(ReservationStockInOrderDO stockInOrderDO){ + List inMaterialDetailDOList = stockInOrderDO.getMaterialDetailList(); + inMaterialDetailDOList.forEach(inMaterialDetailDO -> { + MaterialBaseInfoPO materialBaseInfoPO = reservationStockInOrderMapper.getinfo(inMaterialDetailDO.getMaterialBaseInfoId()); + //MaterialBaseInfoPO materialBaseInfoPO = materialBaseInfoService.getInfo(inMaterialDetailDO.getMaterialBaseInfoId()); + if (materialBaseInfoPO == null){ + throw new ServiceException("物料基础信息不存在"); + } + inMaterialDetailDO.setMaterialCode(materialBaseInfoPO.getMaterialCode()); + inMaterialDetailDO.setMaterialName(materialBaseInfoPO.getMaterialName()); + inMaterialDetailDO.setBarCode(materialBaseInfoPO.getBarCode()); + inMaterialDetailDO.setPackId(materialBaseInfoPO.getPackId()); + inMaterialDetailDO.setPackCode(materialBaseInfoPO.getPackCode()); + inMaterialDetailDO.setPackName(materialBaseInfoPO.getPackName()); + + //获取包装详情 + AjaxResult packDetailResult = systemServiceFeign.getInfoByPackIdAndUnitCode(materialBaseInfoPO.getPackId(), "EA"); + if(!"200".equals(String.valueOf(packDetailResult.get("code")))){ + throw new ServiceException("获取物料单位EA信息失败"); + } + PackDetailFeignPO packDetailFeignPO = JSON.parseObject(JSONObject.toJSONString(packDetailResult.get("data")), PackDetailFeignPO.class); + inMaterialDetailDO.setPackDetailId(packDetailFeignPO.getPackDetailId()); + inMaterialDetailDO.setUnitCode(packDetailFeignPO.getUnitCode()); + inMaterialDetailDO.setUnitName(packDetailFeignPO.getName()); + inMaterialDetailDO.setUnitNumber(packDetailFeignPO.getNumber()); + inMaterialDetailDO.setWeightLimit(packDetailFeignPO.getWeight()); + inMaterialDetailDO.setVolumeLimit(packDetailFeignPO.getVolume()); + + //获取仓库控制信息 + MaterialWarehouseControlPO materialWarehouseControlPO = reservationStockInOrderMapper.getInfoByMaterialBaseInfoIds(materialBaseInfoPO.getMaterialBaseInfoId()); + //MaterialWarehouseControlPO materialWarehouseControlPO = materialWarehouseControlService.getInfoByMaterialBaseInfoIds(materialBaseInfoPO.getMaterialBaseInfoId()); + if (materialWarehouseControlPO == null){ + throw new ServiceException("物料仓库控制信息不存在"); + } + inMaterialDetailDO.setMaterialWarehouseControlId(materialWarehouseControlPO.getMaterialWarehouseControlId()); + inMaterialDetailDO.setSerialNumberManage(materialWarehouseControlPO.getSerialNumberManage()); + inMaterialDetailDO.setQualityInspectionManage(materialWarehouseControlPO.getQualityInspectionManage()); + inMaterialDetailDO.setQualityInspectionStage(materialWarehouseControlPO.getQualityInspectionStage()); + inMaterialDetailDO.setQualityInspectionRule(materialWarehouseControlPO.getQualityInspectionRule()); + inMaterialDetailDO.setQualityInspectionTerm(materialWarehouseControlPO.getQualityInspectionTerm()); + inMaterialDetailDO.setAllowOvercharge(materialWarehouseControlPO.getAllowOvercharge()); + inMaterialDetailDO.setOverchargeRatio(materialWarehouseControlPO.getOverchargeRatio()); + + //获取商品规则信息 + MaterialGoodsRulePO materialGoodsRulePO = reservationStockInOrderMapper.getGoodsInfoByMaterialBaseInfoIds(inMaterialDetailDO.getMaterialBaseInfoId()); + //MaterialGoodsRulePO materialGoodsRulePO = materialGoodsRuleService.getInfoByMaterialBaseInfoIds(materialBaseInfoPO.getMaterialBaseInfoId()); + if (materialGoodsRulePO == null){ + throw new ServiceException("物料商品规则信息不存在"); + } + inMaterialDetailDO.setDistributeRuleId(materialGoodsRulePO.getMaterialGoodsRuleId()); + inMaterialDetailDO.setDistributeRuleCode(materialGoodsRulePO.getRuleCode()); + inMaterialDetailDO.setDistributeRuleName(materialGoodsRulePO.getRuleName()); + + //自动填充规格型号和SKU码(如果物料基础信息中有相关字段且明细中未设置) + //规格型号:优先使用物料种类名称,如果为空则使用物料类型名称 + if (StringUtils.isBlank(inMaterialDetailDO.getSpecificationModel())) { + if (StringUtils.isNotBlank(materialBaseInfoPO.getMaterialTypeName())) { + inMaterialDetailDO.setSpecificationModel(materialBaseInfoPO.getMaterialTypeName()); + } + } + //SKU码:使用物料条形码 + if (StringUtils.isBlank(inMaterialDetailDO.getSkuCode())) { + if (StringUtils.isNotBlank(materialBaseInfoPO.getBarCode())) { + inMaterialDetailDO.setSkuCode(materialBaseInfoPO.getBarCode()); + } + } + }); + } + + /** + * @description 设置默认值 + * @author gen + * @date 2026/1/16 + * @param stockInOrderDO + */ + private void setDefaultValues(ReservationStockInOrderDO stockInOrderDO) { + //海关是否查验货物(默认:0=否) + if (stockInOrderDO.getCustomsInspection() == null) { + stockInOrderDO.setCustomsInspection(0); + } + //是否需要报关(默认:1=是) + if (stockInOrderDO.getNeedCustomsDeclaration() == null) { + stockInOrderDO.setNeedCustomsDeclaration(1); + } + //是否需要运输(默认:0=否) + if (stockInOrderDO.getNeedTransport() == null) { + stockInOrderDO.setNeedTransport(0); + } + } + + /** + * @description 复制特定字段从入库单明细到收货明细 + * 包括:生产日期、过期日期、存货日期、批次参考号、单据参考号、箱号/卡板号、扩展属性1-4 + * @author gen + * @date 2026/1/29 + * @param source 源对象(ReservationInMaterialDetailPO) + * @param target 目标对象(ReceiptMaterialDetailDO) + */ +// private void copySpecialFields(ReservationInMaterialDetailPO source, ReceiptMaterialDetailDO target) { +// if (source == null || target == null) { +// return; +// } +// +// try { +// // 字段映射:源字段名 -> 目标字段名(支持驼峰和下划线两种命名方式) +// Map fieldMappings = new HashMap<>(); +// fieldMappings.put("productionDate", "productionDate"); +// fieldMappings.put("production_date", "productionDate"); +// fieldMappings.put("expiryDate", "expiryDate"); +// fieldMappings.put("expiry_date", "expiryDate"); +// fieldMappings.put("inventoryDate", "inventoryDate"); +// fieldMappings.put("inventory_date", "inventoryDate"); +// fieldMappings.put("batchRefNo", "batchRefNo"); +// fieldMappings.put("batch_ref_no", "batchRefNo"); +// fieldMappings.put("sheetRefNo", "sheetRefNo"); +// fieldMappings.put("sheet_ref_no", "sheetRefNo"); +// fieldMappings.put("boxPalletNo", "boxPalletNo"); +// fieldMappings.put("box_pallet_no", "boxPalletNo"); +// fieldMappings.put("extAttr1", "extAttr1"); +// fieldMappings.put("ext_attr_1", "extAttr1"); +// fieldMappings.put("extAttr2", "extAttr2"); +// fieldMappings.put("ext_attr_2", "extAttr2"); +// fieldMappings.put("extAttr3", "extAttr3"); +// fieldMappings.put("ext_attr_3", "extAttr3"); +// fieldMappings.put("extAttr4", "extAttr4"); +// fieldMappings.put("ext_attr_4", "extAttr4"); +// +// // 使用反射复制字段值 +// for (Map.Entry entry : fieldMappings.entrySet()) { +// String sourceFieldName = entry.getKey(); +// String targetFieldName = entry.getValue(); +// +// // 尝试从源对象获取字段值(支持驼峰和下划线命名) +// Object value = getFieldValue(source, sourceFieldName); +// if (value != null) { +// // 设置到目标对象(使用驼峰命名) +// setFieldValue(target, targetFieldName, value); +// log.info("复制字段成功:{} -> {},值:{}", sourceFieldName, targetFieldName, value); +// } else { +// log.debug("源对象字段 {} 的值为 null,跳过复制", sourceFieldName); +// } +// } +// } catch (Exception e) { +// log.warn("复制特定字段时发生异常,源对象:{},目标对象:{},错误:{}", +// source.getClass().getSimpleName(), target.getClass().getSimpleName(), e.getMessage()); +// } +// } + + /** + * @description 使用反射获取字段值(支持驼峰和下划线命名) + */ + private Object getFieldValue(Object obj, String fieldName) { + if (obj == null || StringUtils.isBlank(fieldName)) { + return null; + } + + try { + Class clazz = obj.getClass(); + Field field = null; + + // 先尝试直接获取字段(驼峰命名) + try { + field = clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + // 如果失败,尝试转换为驼峰命名(如果是下划线命名) + if (fieldName.contains("_")) { + String camelCaseName = snakeToCamel(fieldName); + try { + field = clazz.getDeclaredField(camelCaseName); + } catch (NoSuchFieldException ex) { + // 继续查找父类 + } + } + } + + // 如果当前类找不到,查找父类 + if (field == null) { + Class currentClass = clazz.getSuperclass(); + while (currentClass != null && field == null) { + try { + field = currentClass.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + if (fieldName.contains("_")) { + String camelCaseName = snakeToCamel(fieldName); + try { + field = currentClass.getDeclaredField(camelCaseName); + } catch (NoSuchFieldException ex) { + // 继续查找父类 + } + } + } + currentClass = currentClass.getSuperclass(); + } + } + + if (field != null) { + field.setAccessible(true); + return field.get(obj); + } + } catch (Exception e) { + log.debug("获取字段值失败,对象:{},字段名:{},错误:{}", + obj.getClass().getSimpleName(), fieldName, e.getMessage()); + } + + return null; + } + + /** + * @description 使用反射设置字段值 + */ + private void setFieldValue(Object obj, String fieldName, Object value) { + if (obj == null || StringUtils.isBlank(fieldName)) { + return; + } + + try { + Class clazz = obj.getClass(); + Field field = null; + + // 先尝试直接获取字段(驼峰命名) + try { + field = clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + // 如果失败,查找父类 + Class currentClass = clazz.getSuperclass(); + while (currentClass != null && field == null) { + try { + field = currentClass.getDeclaredField(fieldName); + } catch (NoSuchFieldException ex) { + // 继续查找父类 + } + currentClass = currentClass.getSuperclass(); + } + } + + if (field != null) { + field.setAccessible(true); + // 类型转换:如果值类型不匹配,尝试转换 + Class fieldType = field.getType(); + if (value != null && !fieldType.isAssignableFrom(value.getClass())) { + // 尝试类型转换 + if (fieldType == Date.class && value instanceof String) { + // 字符串转日期(简单处理,实际可能需要更复杂的解析) + value = null; // 暂时不转换,避免解析错误 + } else if (fieldType == String.class) { + value = String.valueOf(value); + } + } + if (value != null && fieldType.isAssignableFrom(value.getClass())) { + field.set(obj, value); + } + } + } catch (Exception e) { + log.debug("设置字段值失败,对象:{},字段名:{},值:{},错误:{}", + obj.getClass().getSimpleName(), fieldName, value, e.getMessage()); + } + } + + /** + * @description 下划线命名转驼峰命名 + */ + private String snakeToCamel(String snakeCase) { + if (StringUtils.isBlank(snakeCase)) { + return snakeCase; + } + + String[] parts = snakeCase.split("_"); + if (parts.length == 0) { + return snakeCase; + } + + StringBuilder camelCase = new StringBuilder(parts[0].toLowerCase()); + for (int i = 1; i < parts.length; i++) { + if (parts[i].length() > 0) { + camelCase.append(parts[i].substring(0, 1).toUpperCase()) + .append(parts[i].substring(1).toLowerCase()); + } + } + + return camelCase.toString(); + } + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationInMaterialDetail/ReservationInMaterialDetailApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationInMaterialDetail/ReservationInMaterialDetailApi.java new file mode 100644 index 000000000..fd5815264 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationInMaterialDetail/ReservationInMaterialDetailApi.java @@ -0,0 +1,83 @@ +package com.mhd.oms.interfaces.facade.reservationInMaterialDetail; + +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.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO; +import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDTO; +import com.mhd.oms.domain.reservationInMaterialDetail.service.ReservationInMaterialDetailApplicationService; +import com.mhd.oms.domain.reservationInMaterialDetail.service.ReservationInMaterialDetailAssembler; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 物料明细Api + * + * @author gen + * @date 2024-05-21 + */ +@RestController +@RequestMapping("/materialDetailApi") +public class ReservationInMaterialDetailApi extends BaseController { + @Autowired + private ReservationInMaterialDetailApplicationService inMaterialDetailApplicationService; + @Resource + private ReservationInMaterialDetailAssembler inMaterialDetailAssembler; + + /** + * 分页查询物料明细列表 + */ + @ApiOperation("查询物料明细列表") + @GetMapping("/list") + public TableDataInfo list(ReservationInMaterialDetailDTO inMaterialDetailDTO) + { + //转换实体 + ReservationInMaterialDetailDO inMaterialDetailDO = inMaterialDetailAssembler.toDO(inMaterialDetailDTO); + startPage(); + List list = inMaterialDetailApplicationService.queryList(inMaterialDetailDO); + return getDataTable(list); + } + + /** + * 编辑物料明细 + */ + @ApiOperation("编辑物料明细") + @PostMapping("/edit") + public AjaxResult edit(@RequestBody ReservationInMaterialDetailDTO inMaterialDetailDTO) + { + //转换实体 + ReservationInMaterialDetailDO inMaterialDetailDO = inMaterialDetailAssembler.toDOByEdit(inMaterialDetailDTO); + if(inMaterialDetailDTO.getMaterialDetailId() != null){ + return toAjax(inMaterialDetailApplicationService.update(inMaterialDetailDO)); + }else { + return toAjax(inMaterialDetailApplicationService.insert(inMaterialDetailDO)); + } + } + + /** + * 批量删除物料明细 + */ + @ApiOperation("批量删除物料明细") + @DeleteMapping("/deleteByIds/{materialDetailIds}") + public AjaxResult delete(@PathVariable Long[] materialDetailIds) + { + return toAjax(inMaterialDetailApplicationService.delete(materialDetailIds)); + } + + /** + * 获取物料明细详细信息 + */ + @ApiOperation("获取物料明细") + @GetMapping(value = "/getInfo/{materialDetailId}") + public AjaxResult getInfo(@PathVariable("materialDetailId") Long materialDetailId) + { + return AjaxResult.success(inMaterialDetailApplicationService.getInfo(materialDetailId)); + } + + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationStockInOrder/ReservationStockInOrderApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationStockInOrder/ReservationStockInOrderApi.java new file mode 100644 index 000000000..fb98e738e --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationStockInOrder/ReservationStockInOrderApi.java @@ -0,0 +1,130 @@ +package com.mhd.oms.interfaces.facade.reservationStockInOrder; + +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.oms.domain.reservationStockInOrder.repository.po.ReservationStockInOrderPO; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDO; +import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDTO; +import com.mhd.oms.domain.reservationStockInOrder.service.ReservationStockInOrderApplicationService; +import com.mhd.oms.domain.reservationStockInOrder.service.ReservationStockInOrderAssembler; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 入库单Api + * + * @author gen + * @date 2024-05-21 + */ +@RestController +@RequestMapping("/reservationStockInOrderApi") +public class ReservationStockInOrderApi extends BaseController { + @Autowired + private ReservationStockInOrderApplicationService stockInOrderApplicationService; + + @Resource + private ReservationStockInOrderAssembler stockInOrderAssembler; + + /** + * 分页查询入库单列表 + */ + @ApiOperation("查询入库单列表") + @GetMapping("/list") + public TableDataInfo list(ReservationStockInOrderDTO stockInOrderDTO) + { + //转换实体 + ReservationStockInOrderDO stockInOrderDO = stockInOrderAssembler.toDO(stockInOrderDTO); + startPage(); + List list = stockInOrderApplicationService.queryList(stockInOrderDO); + return getDataTable(list); + } + + /** + * 编辑入库单 + */ + @ApiOperation("编辑入库单") + @PostMapping("/edit") + public AjaxResult edit(@RequestBody ReservationStockInOrderDTO stockInOrderDTO) + { + //转换实体 + ReservationStockInOrderDO stockInOrderDO = stockInOrderAssembler.toDOByEdit(stockInOrderDTO); + if(stockInOrderDTO.getInOrderId() != null){ + return toAjax(stockInOrderApplicationService.update(stockInOrderDO)); + }else { + return toAjax(stockInOrderApplicationService.insert(stockInOrderDO)); + } + } + + /** + * 批量删除入库单 + */ + @ApiOperation("批量删除入库单") + @DeleteMapping("/deleteByIds/{inOrderIds}") + public AjaxResult delete(@PathVariable Long[] inOrderIds) + { + return toAjax(stockInOrderApplicationService.delete(inOrderIds)); + } + + /** + * 获取入库单详细信息 + */ + @ApiOperation("获取入库单") + @GetMapping(value = "/getInfo/{inOrderId}") + public AjaxResult getInfo(@PathVariable("inOrderId") Long inOrderId) + { + return AjaxResult.success(stockInOrderApplicationService.getInfo(inOrderId)); + } + + /** + * 导入入库单 + */ +// @ApiOperation("导入入库单") +// @PostMapping(value = "/importData") +// public AjaxResult importData( +// @RequestParam("file") MultipartFile file, +// @RequestParam("warehouseId") Long warehouseId, +// @RequestParam("warehouseCode") String warehouseCode, +// @RequestParam("warehouseName") String warehouseName) +// { +// return AjaxResult.success(stockInOrderApplicationService.importData(file, warehouseId, warehouseCode, warehouseName)); +// } + + /** + * 审核入库单 + */ + @ApiOperation("审核入库单") + @PostMapping(value = "/auditState") + public AjaxResult auditState(@RequestBody ReservationStockInOrderDTO stockInOrderDTO) { + ReservationStockInOrderDO stockInOrderDO = stockInOrderAssembler.toDO(stockInOrderDTO); + return AjaxResult.success(stockInOrderApplicationService.auditState(stockInOrderDO)); + } + + + /** + * 取消入库单 + */ + @ApiOperation("取消入库单") + @PostMapping(value = "/cancelOrder") + public AjaxResult cancelOrder(@RequestBody ReservationStockInOrderDTO stockInOrderDTO) { + ReservationStockInOrderDO stockInOrderDO = stockInOrderAssembler.toDO(stockInOrderDTO); + return AjaxResult.success(stockInOrderApplicationService.cancelOrder(stockInOrderDO)); + } + + + /** + * 关闭入库单 + */ + @ApiOperation("关闭入库单") + @PostMapping(value = "/closeOrder") + public AjaxResult closeOrder(@RequestBody ReservationStockInOrderDTO stockInOrderDTO) { + ReservationStockInOrderDO stockInOrderDO = stockInOrderAssembler.toDO(stockInOrderDTO); + return AjaxResult.success(stockInOrderApplicationService.closeOrder(stockInOrderDO)); + } + +} \ No newline at end of file diff --git a/mhd_oms/src/main/resources/mapper/reservationInMaterialDetail/ReservationInMaterialDetailMapper.xml b/mhd_oms/src/main/resources/mapper/reservationInMaterialDetail/ReservationInMaterialDetailMapper.xml new file mode 100644 index 000000000..9a7479ea0 --- /dev/null +++ b/mhd_oms/src/main/resources/mapper/reservationInMaterialDetail/ReservationInMaterialDetailMapper.xml @@ -0,0 +1,339 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a.contract_fee , + a.monthly_warehouse_fee , + a.half_month_wh_fee , + a.discount_rate , + a.single_volume , + a.single_gross_weight , + a.lot_no , + a.material_detail_id, a.organization_id, a.organization_name, a.top_organization_id, a.unique_id, a.in_order_number, a.material_base_info_id, + a.material_code, a.material_name, a.bar_code, a.quantity, a.receipt_quantity, a.shelves_quantity, + a.receipt_status, a.shelves_status, a.pack_id, a.pack_code, a.pack_name, + CASE + WHEN a.pack_detail_id IS NULL OR TRIM(a.pack_detail_id) = '' THEN NULL + ELSE CAST(a.pack_detail_id AS BIGINT) + END as pack_detail_id, a.unit_code, a.unit_name, a.material_warehouse_control_id, a.serial_number_manage, a.quality_inspection_manage, + a.quality_inspection_stage, a.quality_inspection_rule, a.quality_inspection_ratio, a.quality_inspection_term, a.quality_inspection_results, a.allow_overcharge, + a.overcharge_ratio, a.batch_number, a.material_status_code, a.material_status_name, a.distribute_rule_id, a.distribute_rule_code, + a.distribute_rule_name, a.container_id, a.container_code, a.container_type, a.container_type_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.level, a.parent_unique_id, 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.over_stock_id, a.over_stock_status, a.over_stock_type, + a.SPECIFICATION_MODEL, a.SKU_CODE, a.INVOICE_NO, a.LITER, a.DIMENSIONS, a.DECLARATION_UNIT, a.BATCH_REF_NO, a.SHEET_REF_NO, + a.ORIGIN_COUNTRY, a.BOX_PALLET_NO, a.CURRENCY, a.UNIT, a.DECLARED_QUANTITY, a.BOX_COUNT, a.PIECE_COUNT, a.INBOUND_QUANTITY, + a.TOTAL_NET_WEIGHT, a.TOTAL_GROSS_WEIGHT, a.TOTAL_VOLUME, a.TOTAL_AREA, a.TOTAL_PRICE, + a.PRODUCTION_DATE, a.EXPIRY_DATE, a.INVENTORY_DATE, a.EXT_ATTR_1, a.EXT_ATTR_2, a.EXT_ATTR_3, a.EXT_ATTR_4 + ,CASE + WHEN (a.quantity - a.receipt_quantity) < 0 THEN 0 + ELSE (a.quantity - a.receipt_quantity) + END AS wait_receipt_quantity, + CASE + WHEN (a.receipt_quantity - a.shelves_quantity) < 0 THEN 0 + ELSE (a.receipt_quantity - a.shelves_quantity) + END AS wait_shelves_quantity + + + + + and a.organization_id = #{organizationId} + + + and a.organization_name like concat('%', #{organizationName}, '%') + + + and a.top_organization_id = #{topOrganizationId} + + + and a.in_order_number = #{inOrderNumber} + + + and a.material_base_info_id = #{materialBaseInfoId} + + + and a.material_code = #{materialCode} + + + and a.material_name like concat('%', #{materialName}, '%') + + + and a.bar_code = #{barCode} + + + and a.quantity = #{quantity} + + + and a.receipt_quantity = #{receiptQuantity} + + + and a.shelves_quantity = #{shelvesQuantity} + + + and a.pack_id = #{packId} + + + and a.pack_code = #{packCode} + + + and a.pack_name like concat('%', #{packName}, '%') + + + and a.pack_detail_id = #{packDetailId} + + + and a.unit_code = #{unitCode} + + + and a.unit_name like concat('%', #{unitName}, '%') + + + and a.material_warehouse_control_id = #{materialWarehouseControlId} + + + and a.serial_number_manage = #{serialNumberManage} + + + and a.quality_inspection_manage = #{qualityInspectionManage} + + + and a.quality_inspection_stage = #{qualityInspectionStage} + + + and a.quality_inspection_rule = #{qualityInspectionRule} + + + and a.quality_inspection_term = #{qualityInspectionTerm} + + + and a.quality_inspection_results = #{qualityInspectionResults} + + + and a.allow_overcharge = #{allowOvercharge} + + + and a.overcharge_ratio = #{overchargeRatio} + + + and a.batch_number = #{batchNumber} + + + and a.material_status_code = #{materialStatusCode} + + + and a.material_status_name like concat('%', #{materialStatusName}, '%') + + + and a.distribute_rule_id = #{distributeRuleId} + + + and a.distribute_rule_code = #{distributeRuleCode} + + + and a.distribute_rule_name like concat('%', #{distributeRuleName}, '%') + + + and a.container_id = #{containerId} + + + and a.container_code = #{containerCode} + + + and a.container_type = #{containerType} + + + and a.container_type_name like concat('%', #{containerTypeName}, '%') + + + and a.create_by_name like concat('%', #{createByName}, '%') + + + and a.update_by_name like concat('%', #{updateByName}, '%') + + + and a.in_order_number in + + #{item} + + + + and a.del_flag = #{delFlag} + and a.del_flag = 1 + + + + + + and a.organization_id = #{organizationId} + + + and a.organization_name like concat('%', #{organizationName}, '%') + + + and a.top_organization_id = #{topOrganizationId} + + + and a.over_stock_status = #{overStockStatus} + + + and a.material_base_info_id = #{materialBaseInfoId} + + + and a.material_base_info_id in + + #{item} + + + + and a.del_flag = #{delFlag} + and a.del_flag = 1 + + + + + + and b.out_order_number = #{outOrderNumber} + + + and b.warehouse_id = #{warehouseId} + + + and b.shipper_id = #{shipperId} + + + and b.shipper_id in + + #{item} + + + + and date_format(b.expect_time,'%y%m%d') >= date_format(#{inOrderExpectStartTime},'%y%m%d') + + + and date_format(b.expect_time,'%y%m%d') <= date_format(#{inOrderExpectEndTime},'%y%m%d') + + + and b.order_type_code = #{outOrderTypeCode} + + + + and b.status = #{inStatus} + + + and b.del_flag = #{delFlag} + and b.del_flag = 1 + + + + + + + \ No newline at end of file diff --git a/mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml b/mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml new file mode 100644 index 000000000..9d26097e7 --- /dev/null +++ b/mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a.in_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.notice_number, a.in_order_number, a.status, + a.audit_status, a.audit_remark, a.audit_by, a.audit_by_name, a.audit_time, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id, a.shipper_code, + a.shipper_name, a.order_type_code, a.order_type_name, a.supplier_id, a.supplier_code, a.supplier_name, a.expect_time, a.supply_chain_number, + a.priority_level_code, a.priority_level_name, a.direct_warehouse, a.annex_url, a.material_quantity, a.quantity, + -- 计划入库数量:入库明细表 in_material_detail 的 quantity 汇总 + (select ifnull(sum(imd.quantity), 0) + from in_material_detail imd + where imd.in_order_number = a.in_order_number + and imd.del_flag = 1 + and (imd.level is null or imd.level = 1) + ) as plan_in_quantity, + -- 收货数量:收货单表 stock_receipt_order 的 receipt_quantity 汇总 + (select ifnull(sum(sro.receipt_quantity), 0) + from stock_receipt_order sro + where sro.in_order_number = a.in_order_number + and sro.del_flag = 1 + ) as receipt_quantity, + -- 上架数量:上架单表 stock_shelf_order 的 shelves_quantity 汇总 + (select ifnull(sum(sso.shelves_quantity), 0) + from stock_shelf_order sso + where sso.in_order_number = a.in_order_number + and sso.del_flag = 1 + ) as shelves_quantity, + a.weight_limit, a.volume_limit, a.cancel_order, a.cancel_remark, a.cancel_by, + a.cancel_by_name, a.cancel_time, a.close_order, a.close_remark, a.close_by, a.close_by_name, a.close_time, 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, over_stock_id, over_stock_status, over_stock_type, + a."TO", a.CONTACT_PERSON, a.VEHICLE_INFO, a.CONSIGNMENT_NO, a.TEL, a.DRIVER_SIGNATURE, a.FAX, a.DECLARATION_AREA, a.MANUFACTURER, + a.CUSTOMS_BROKER_INFO, a.DELIVERY_ADDRESS, a.ENTRY_EXIT_CUSTOMS, a.ORIGIN_DESTINATION_COUNTRY, a.CARRIER, a.CONTAINER_NO, + a.TRANSPORT_METHOD, a.SUPERVISION_METHOD, a.CUSTOMS_INSPECTION, a.NEED_CUSTOMS_DECLARATION, a.NEED_TRANSPORT, + a.WAREHOUSE_DATE, a.COMPLETION_TIME, a.ORDER_DATE + + + + ,b.notice_number, b.warehouse_id, b.warehouse_code, b.warehouse_name, b.shipper_id, b.shipper_code, b.shipper_name, + b.order_type_code, b.order_type_name, b.supplier_id, b.supplier_code, b.supplier_name, b.expect_time, b.supply_chain_number, b.priority_level_code, + b.priority_level_name, b.direct_warehouse, b.annex_url, b.material_quantity as in_order_material_quantity, b.quantity as in_order_quantity + + + + + + and b.notice_number = #{noticeNumber} + + + and b.in_order_number like concat('%', #{inOrderNumber}, '%') + + + and b.warehouse_id = #{warehouseId} + + + and b.warehouse_code = #{warehouseCode} + + + and b.warehouse_name like concat('%', #{warehouseName}, '%') + + + and b.shipper_id = #{shipperId} + + + and b.shipper_name like concat('%', #{shipperName}, '%') + + + and b.order_type_code = #{orderTypeCode} + + + and b.order_type_name like concat('%', #{orderTypeName}, '%') + + + and b.supplier_id = #{supplierId} + + + and b.supplier_name like concat('%', #{supplierName}, '%') + + + and b.expect_time = #{expectTime} + + + and b.supply_chain_number = #{supplyChainNumber} + + + and b.priority_level_code = #{priorityLevelCode} + + + and b.priority_level_name like concat('%', #{priorityLevelName}, '%') + + + and b.direct_warehouse = #{directWarehouse} + + + and b.annex_url = #{annexUrl} + + + and b.quantity = #{quantity} + + + + + + and a.organization_id = #{organizationId} + + + and a.organization_name like concat('%', #{organizationName}, '%') + + + and a.top_organization_id = #{topOrganizationId} + + + and a.notice_number = #{noticeNumber} + + + and a.in_order_number = #{inOrderNumber} + + + and a.status = #{status} + + + and a.status < #{ltStatus} + + + and a.status > #{gtStatus} + + + and a.audit_status = #{auditStatus} + + + and a.audit_status < #{ltAuditStatus} + + + and a.audit_status > #{gtAuditStatus} + + + and a.audit_remark = #{auditRemark} + + + and a.audit_by = #{auditBy} + + + and a.audit_by_name like concat('%', #{auditByName}, '%') + + + and a.audit_time = #{auditTime} + + + and a.warehouse_id = #{warehouseId} + + + and a.warehouse_code = #{warehouseCode} + + + and a.warehouse_name like concat('%', #{warehouseName}, '%') + + + and a.shipper_id = #{shipperId} + + + and a.shipper_name like concat('%', #{shipperName}, '%') + + + and a.order_type_code = #{orderTypeCode} + + + and a.order_type_name like concat('%', #{orderTypeName}, '%') + + + and a.supplier_id = #{supplierId} + + + and a.supplier_name like concat('%', #{supplierName}, '%') + + + and a.expect_time = #{expectTime} + + + and a.supply_chain_number = #{supplyChainNumber} + + + and a.priority_level_code = #{priorityLevelCode} + + + and a.priority_level_name like concat('%', #{priorityLevelName}, '%') + + + and a.direct_warehouse = #{directWarehouse} + + + and a.annex_url = #{annexUrl} + + + and a.quantity = #{quantity} + + + and a.cancel_order = #{cancelOrder} + + + and a.cancel_remark = #{cancelRemark} + + + and a.cancel_by = #{cancelBy} + + + and a.cancel_by_name like concat('%', #{cancelByName}, '%') + + + and a.cancel_time = #{cancelTime} + + + and a.close_order = #{closeOrder} + + + and a.close_remark = #{closeRemark} + + + and a.close_by = #{closeBy} + + + and a.close_by_name like concat('%', #{closeByName}, '%') + + + and a.close_time = #{closeTime} + + + and a.create_by_name like concat('%', #{createByName}, '%') + + + and a.update_by_name like concat('%', #{updateByName}, '%') + + + and a.in_order_id in + + #{item} + + + + + and a."TO" like concat('%', #{to}, '%') + + + and a.CONTACT_PERSON like concat('%', #{contactPerson}, '%') + + + and a.VEHICLE_INFO like concat('%', #{vehicleInfo}, '%') + + + and a.CONSIGNMENT_NO like concat('%', #{consignmentNo}, '%') + + + and a.TEL like concat('%', #{tel}, '%') + + + and a.DRIVER_SIGNATURE like concat('%', #{driverSignature}, '%') + + + and a.FAX like concat('%', #{fax}, '%') + + + and a.DECLARATION_AREA like concat('%', #{declarationArea}, '%') + + + and a.MANUFACTURER like concat('%', #{manufacturer}, '%') + + + and a.CUSTOMS_BROKER_INFO like concat('%', #{customsBrokerInfo}, '%') + + + and a.DELIVERY_ADDRESS like concat('%', #{deliveryAddress}, '%') + + + and a.ENTRY_EXIT_CUSTOMS like concat('%', #{entryExitCustoms}, '%') + + + and a.ORIGIN_DESTINATION_COUNTRY like concat('%', #{originDestinationCountry}, '%') + + + and a.CARRIER like concat('%', #{carrier}, '%') + + + and a.CONTAINER_NO = #{containerNo} + + + and a.TRANSPORT_METHOD = #{transportMethod} + + + and a.SUPERVISION_METHOD = #{supervisionMethod} + + + and a.CUSTOMS_INSPECTION = #{customsInspection} + + + and a.NEED_CUSTOMS_DECLARATION = #{needCustomsDeclaration} + + + and a.NEED_TRANSPORT = #{needTransport} + + + and a.WAREHOUSE_DATE = #{warehouseDate} + + + and a.COMPLETION_TIME = #{completionTime} + + + and a.ORDER_DATE = #{orderDate} + + + and date_format(a.create_time,'%Y-%m-%d') >= #{createTimeStart} + + + and date_format(a.create_time,'%Y-%m-%d') <= #{createTimeEnd} + + + + and exists ( + select 1 from in_material_detail imd + left join material_base_info mb on imd.material_base_info_id = mb.material_base_info_id and mb.del_flag = 1 + where imd.in_order_number = a.in_order_number + and imd.del_flag = 1 + and (imd.level is null or imd.level = 1) + + and ( + imd.material_name like concat('%', #{materialName}, '%') + or mb.material_name like concat('%', #{materialName}, '%') + ) + + + and ( + imd.material_code like concat('%', #{materialCode}, '%') + or mb.material_code like concat('%', #{materialCode}, '%') + ) + + ) + + + and a.del_flag = #{delFlag} + and a.del_flag = 1 + + + + + + + + + + + \ No newline at end of file