diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 9a7a2fab9..10d1f72d5 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -2,10 +2,7 @@ package com.mhd.system.api; import com.mhd.common.core.constant.ServiceNameConstants; import com.mhd.common.core.web.domain.AjaxResult; -import com.mhd.system.api.domain.InMaterialDetail; -import com.mhd.system.api.domain.OutMaterialDetail; -import com.mhd.system.api.domain.StockInOrder; -import com.mhd.system.api.domain.StockOutOrder; +import com.mhd.system.api.domain.*; import com.mhd.system.api.factory.RemoteBmsFeignFallbackFactory; import com.mhd.system.api.feign.FeignAutoConfiguration; import io.swagger.annotations.ApiOperation; @@ -33,4 +30,8 @@ public interface OmsServiceFeign { @ApiOperation("wms推送入库单明细") @PostMapping(value = "/reservationStockOutOrderApi/pushOutOrderDetail") public AjaxResult pushOutOrderDetail(@RequestBody OutMaterialDetail outMaterialDetail); + + @ApiOperation("编辑物料库存") + @PostMapping("/materialInventoryApi/omsEdit") + public AjaxResult omsEdit(@RequestBody MaterialInventoryOmsParamDO materialInventoryOmsParamDO); } \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/MaterialInventoryOmsParamDO.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/MaterialInventoryOmsParamDO.java new file mode 100644 index 000000000..c42b3a996 --- /dev/null +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/MaterialInventoryOmsParamDO.java @@ -0,0 +1,79 @@ +package com.mhd.system.api.domain; + +import com.mhd.common.core.web.domain.BaseVOEntity; +import com.mhd.system.api.model.LoginUser; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + + +/** + * 物料库存对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +public class MaterialInventoryOmsParamDO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + //库存id + private Long materialInventoryId; + //物料基础信息id + private Long materialBaseInfoId; + //物料明细ID + private Long materialDetailId; + //仓库信息参数 + private Long organizationId; + private String organizationName; + private Long topOrganizationId; + //仓库ID + private Long warehouseId; + //仓库编码 + private String warehouseCode; + //仓库名称 + private String warehouseName; + //存储区ID + private Long storageSectionId; + //存储区编码 + private String storageCode; + //存储区名称 + private String storageName; + //存储位置ID + private Long storageLocationId; + //存储位置编码 + private String storageLocationCode; + //存储位置名称 + private String storageLocationName; + //调整数量 + private BigDecimal quantity; + //净重 + private BigDecimal netWeight; + //毛重 + private BigDecimal grossWeight; + //体积 + private BigDecimal volume; + //面积 + private BigDecimal area; + //类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结) + private String type; + + private String barCode; + + private String inOrderNumber; + + private String lotNumber; + + private String batchNumber; + + private String isNew; + + /** 业务关联单号(出库单号、交接单对应单号等),用于库存调整记录 relate_no;可与入库单号区分 */ + private String relateNo; + + private String kctzType; + + private LoginUser loginUser; + +} \ No newline at end of file diff --git a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/domain/po/UserPo.java b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/domain/po/UserPo.java index c801c53d7..5a4143bb1 100644 --- a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/domain/po/UserPo.java +++ b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/domain/po/UserPo.java @@ -203,7 +203,7 @@ public class UserPo { private Integer esignEnterpriseStatus; @ApiModelProperty(name = "部门ID") - private Integer departmentId; + private String departmentId; @ApiModelProperty(name = "钉钉user_id") private String dingUserId; diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/entity/ReservationInventoryAdjustmentRecord.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/entity/ReservationInventoryAdjustmentRecord.java new file mode 100644 index 000000000..b322cd6fa --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/entity/ReservationInventoryAdjustmentRecord.java @@ -0,0 +1,202 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +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; + + +/** + * 库存调整记录对象 inventory_adjustment_record + * + * @author gen + * @date 2024-07-17 + */ + +@Data +public class ReservationInventoryAdjustmentRecord extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("库存调整记录id") + @TableId(type = IdType.AUTO) + private Long inventoryAdjustmentId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("物料库存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("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @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 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("调整类型:0:无状态 1:数量调整 :2:状态调整 3:库存冻结") + @Excel(name = "调整类型:0:无状态 1:数量调整 :2:状态调整 3:库存冻结") + private Long adjustType; + + @ApiModelProperty("调整方向:0:无状态 1:增库存 2:减库存") + @Excel(name = "调整方向:0:无状态 1:增库存 2:减库存") + private Long adjustDirection; + + @ApiModelProperty("调整前状态编码") + @Excel(name = "调整前状态编码") + private String adjustBeforeStatusCode; + + @ApiModelProperty("调整前状态名称") + @Excel(name = "调整前状态名称") + private String adjustBeforeStatusName; + + @ApiModelProperty("调整后状态编码") + @Excel(name = "调整后状态编码") + private String adjustAfterStatusCode; + + @ApiModelProperty("调整后状态名称") + @Excel(name = "调整后状态名称") + private String adjustAfterStatusName; + + @ApiModelProperty("调整前库存数量") + @Excel(name = "调整前库存数量") + private BigDecimal inventoryBeforeQuantity; + + @ApiModelProperty("调整前可用数量") + @Excel(name = "调整前可用数量") + private BigDecimal allocationBeforeQuantity; + + @ApiModelProperty("调整前冻结数量") + @Excel(name = "调整前冻结数量") + private BigDecimal freezeBeforeQuantity; + + @ApiModelProperty("调整后库存数量") + @Excel(name = "调整后库存数量") + private BigDecimal inventoryAfterQuantity; + + @ApiModelProperty("调整后可用数量") + @Excel(name = "调整后可用数量") + private BigDecimal allocationAfterQuantity; + + @ApiModelProperty("调整后冻结数量") + @Excel(name = "调整后冻结数量") + private BigDecimal freezeAfterQuantity; + + @ApiModelProperty("调整动作") + @Excel(name = "调整动作") + private String adjustAction; + + @ApiModelProperty("关联单号") + @Excel(name = "关联单号") + private String relateNo; + + @ApiModelProperty("调整前净重(KG)") + @Excel(name = "调整前净重(KG)") + private BigDecimal netWeight; + + @ApiModelProperty("调整前毛重(KG)") + @Excel(name = "调整前毛重(KG)") + private BigDecimal grossWeight; + + @ApiModelProperty("调整前体积") + @Excel(name = "调整前体积") + private BigDecimal volume; + + @ApiModelProperty("调整前面积") + @Excel(name = "调整前面积") + private BigDecimal area; + + @ApiModelProperty("调整后净重(KG)") + @Excel(name = "调整后净重(KG)") + private BigDecimal adjustedNetWeight; + + @ApiModelProperty("调整后毛重(KG)") + @Excel(name = "调整后毛重(KG)") + private BigDecimal adjustedGrossWeight; + + @ApiModelProperty("调整后体积") + @Excel(name = "调整后体积") + private BigDecimal adjustedVolume; + + @ApiModelProperty("调整后面积") + @Excel(name = "调整后面积") + private BigDecimal adjustedArea; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("LOT编号") + @Excel(name = "LOT编号") + private String lotNumber; + @ApiModelProperty("批次号") + @Excel(name = "批次号") + private String batchNumber; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/facade/IReservationInventoryAdjustmentRecordService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/facade/IReservationInventoryAdjustmentRecordService.java new file mode 100644 index 000000000..f566a5667 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/facade/IReservationInventoryAdjustmentRecordService.java @@ -0,0 +1,43 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.facade; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.entity.ReservationInventoryAdjustmentRecord; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.po.ReservationInventoryAdjustmentRecordPO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDO; + +import java.util.List; + +/** + * 库存调整记录Service接口 + * + * @author gen + * @date 2024-07-17 + */ +public interface IReservationInventoryAdjustmentRecordService extends IService +{ + /** + * 分页查询库存调整记录列表 + */ + public List queryList(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO); + + /** + * 新增库存调整记录 + */ + public Boolean insert(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO); + + /** + * 修改库存调整记录 + */ + public Boolean update(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO); + + /** + * 批量删除库存调整记录 + */ + public Boolean delete(Long[] inventoryAdjustmentIds); + + + /** + * 查询库存调整记录 + */ + public ReservationInventoryAdjustmentRecordPO getInfo(Long inventoryAdjustmentId); +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/mapper/ReservationInventoryAdjustmentRecordMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/mapper/ReservationInventoryAdjustmentRecordMapper.java new file mode 100644 index 000000000..514373f34 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/mapper/ReservationInventoryAdjustmentRecordMapper.java @@ -0,0 +1,23 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.entity.ReservationInventoryAdjustmentRecord; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.po.ReservationInventoryAdjustmentRecordPO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDO; + +import java.util.List; + +/** + * 库存调整记录Mapper接口 + * + * @author gen + * @date 2024-07-17 + */ +public interface ReservationInventoryAdjustmentRecordMapper extends BaseMapper +{ + /** + * 查询库存调整记录列表 + */ + public List queryList(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO); + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/persistence/ReservationInventoryAdjustmentRecordImpl.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/persistence/ReservationInventoryAdjustmentRecordImpl.java new file mode 100644 index 000000000..77529e6d7 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/persistence/ReservationInventoryAdjustmentRecordImpl.java @@ -0,0 +1,81 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.persistence; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.entity.ReservationInventoryAdjustmentRecord; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.facade.IReservationInventoryAdjustmentRecordService; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.mapper.ReservationInventoryAdjustmentRecordMapper; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.po.ReservationInventoryAdjustmentRecordPO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * 库存调整记录Service业务层处理 + * + * @author gen + * @date 2024-07-17 + */ +@Service +public class ReservationInventoryAdjustmentRecordImpl extends ServiceImpl implements IReservationInventoryAdjustmentRecordService { + @Autowired + private ReservationInventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper; + + /** + * 查询库存调整记录列表 + */ + @Override + public List queryList(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) + { + return inventoryAdjustmentRecordMapper.queryList(inventoryAdjustmentRecordDO); + } + + /** + * 新增库存调整记录 + */ + @Override + public Boolean insert(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { + ReservationInventoryAdjustmentRecord inventoryAdjustmentRecord = new ReservationInventoryAdjustmentRecord(); + BeanUtils.copyProperties(inventoryAdjustmentRecordDO,inventoryAdjustmentRecord); + return this.save(inventoryAdjustmentRecord); + } + + /** + * 修改库存调整记录 + */ + @Override + public Boolean update(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { + ReservationInventoryAdjustmentRecord inventoryAdjustmentRecord = new ReservationInventoryAdjustmentRecord(); + BeanUtils.copyProperties(inventoryAdjustmentRecordDO,inventoryAdjustmentRecord); + return this.updateById(inventoryAdjustmentRecord); + } + + /** + * 批量删除库存调整记录 + */ + @Override + public Boolean delete(Long[] inventoryAdjustmentIds ) { + List list = new ArrayList<>(); + for (Long id : inventoryAdjustmentIds) { + ReservationInventoryAdjustmentRecord inventoryAdjustmentRecord = new ReservationInventoryAdjustmentRecord(); + inventoryAdjustmentRecord.setInventoryAdjustmentId(id); + inventoryAdjustmentRecord.setDelFlag(2); + list.add(inventoryAdjustmentRecord); + } + return this.updateBatchById(list); + } + + /** + * 修改库存调整记录 + */ + @Override + public ReservationInventoryAdjustmentRecordPO getInfo(Long inventoryAdjustmentId) { + ReservationInventoryAdjustmentRecord inventoryAdjustmentRecord = this.getById(inventoryAdjustmentId); + ReservationInventoryAdjustmentRecordPO inventoryAdjustmentRecordPO = new ReservationInventoryAdjustmentRecordPO(); + BeanUtils.copyProperties(inventoryAdjustmentRecord,inventoryAdjustmentRecordPO); + return inventoryAdjustmentRecordPO; + } +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/po/ReservationInventoryAdjustmentRecordPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/po/ReservationInventoryAdjustmentRecordPO.java new file mode 100644 index 000000000..6778ad71f --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/po/ReservationInventoryAdjustmentRecordPO.java @@ -0,0 +1,258 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.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.system.api.domain.MaterialMoreDetailPO; +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; + + +/** + * 库存调整记录对象 inventory_adjustment_record + * + * @author gen + * @date 2024-07-17 + */ + +@Data +@ApiModel(value = "库存调整记录对象", description = "库存调整记录响应对象") +public class ReservationInventoryAdjustmentRecordPO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("库存调整记录id") + private Long inventoryAdjustmentId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("物料库存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("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @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 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("调整类型:0:无状态 1:数量调整 :2:状态调整 3:库存冻结") + @Excel(name = "调整类型:0:无状态 1:数量调整 :2:状态调整 3:库存冻结") + private Long adjustType; + + @ApiModelProperty("调整方向:0:无状态 1:增库存 2:减库存") + @Excel(name = "调整方向:0:无状态 1:增库存 2:减库存") + private Long adjustDirection; + + @ApiModelProperty("调整前状态编码") + @Excel(name = "调整前状态编码") + private String adjustBeforeStatusCode; + + @ApiModelProperty("调整前状态名称") + @Excel(name = "调整前状态名称") + private String adjustBeforeStatusName; + + @ApiModelProperty("调整后状态编码") + @Excel(name = "调整后状态编码") + private String adjustAfterStatusCode; + + @ApiModelProperty("调整后状态名称") + @Excel(name = "调整后状态名称") + private String adjustAfterStatusName; + + @ApiModelProperty("调整前库存数量") + @Excel(name = "调整前库存数量") + private BigDecimal inventoryBeforeQuantity; + + @ApiModelProperty("调整前可用数量") + @Excel(name = "调整前可用数量") + private BigDecimal allocationBeforeQuantity; + + @ApiModelProperty("调整前冻结数量") + @Excel(name = "调整前冻结数量") + private BigDecimal freezeBeforeQuantity; + + @ApiModelProperty("调整后库存数量") + @Excel(name = "调整后库存数量") + private BigDecimal inventoryAfterQuantity; + + @ApiModelProperty("调整后可用数量") + @Excel(name = "调整后可用数量") + private BigDecimal allocationAfterQuantity; + + @ApiModelProperty("调整后冻结数量") + @Excel(name = "调整后冻结数量") + private BigDecimal freezeAfterQuantity; + + @ApiModelProperty("Batch Ref NO's") + @Excel(name = "Batch Ref NO's") + private String batchRefNo; + + @ApiModelProperty("Sheet Ref NO's") + @Excel(name = "Sheet Ref NO's") + private String sheetRefNo; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("扩展字段1") + @Excel(name = "扩展字段1") + private String extAttr1; + + @ApiModelProperty("扩展字段2") + @Excel(name = "扩展字段2") + private String extAttr2; + + @ApiModelProperty("生产日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date productionDate; + + @ApiModelProperty("过期日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expiryDate; + + @ApiModelProperty("存货日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date inventoryDate; + + @ApiModelProperty("ExtAttr3") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr3; + + @ApiModelProperty("ExtAttr4") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr4; + + @ApiModelProperty("物料更多属性列表(批次属性)") + private List materialMoreDetailList; + + @ApiModelProperty("调整动作") + @Excel(name = "调整动作") + private String adjustAction; + + @ApiModelProperty("关联单号") + @Excel(name = "关联单号") + private String relateNo; + + @ApiModelProperty("调整前净重(KG)") + @Excel(name = "调整前净重(KG)") + private BigDecimal netWeight; + + @ApiModelProperty("调整前毛重(KG)") + @Excel(name = "调整前毛重(KG)") + private BigDecimal grossWeight; + + @ApiModelProperty("调整前体积") + @Excel(name = "调整前体积") + private BigDecimal volume; + + @ApiModelProperty("调整前面积") + @Excel(name = "调整前面积") + private BigDecimal area; + + @ApiModelProperty("调整后净重(KG)") + @Excel(name = "调整后净重(KG)") + private BigDecimal adjustedNetWeight; + + @ApiModelProperty("调整后毛重(KG)") + @Excel(name = "调整后毛重(KG)") + private BigDecimal adjustedGrossWeight; + + @ApiModelProperty("调整后体积") + @Excel(name = "调整后体积") + private BigDecimal adjustedVolume; + + @ApiModelProperty("调整后面积") + @Excel(name = "调整后面积") + private BigDecimal adjustedArea; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("LOT编号") + @Excel(name = "LOT编号") + private String LotNumber; + @ApiModelProperty("批次号") + @Excel(name = "批次号") + private String batchNumber; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/todo/ReservationInventoryAdjustmentRecordDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/todo/ReservationInventoryAdjustmentRecordDO.java new file mode 100644 index 000000000..9bc66291d --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/todo/ReservationInventoryAdjustmentRecordDO.java @@ -0,0 +1,214 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo; + +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; + + +/** + * 库存调整记录对象 inventory_adjustment_record + * + * @author gen + * @date 2024-07-17 + */ + +@Data +public class ReservationInventoryAdjustmentRecordDO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("库存调整记录id") + private Long inventoryAdjustmentId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("物料库存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("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @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 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("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("容器id") + @Excel(name = "容器id") + private Long containerId; + + @ApiModelProperty("调整类型:0:无状态 1:数量调整 :2:状态调整 3:库存冻结") + @Excel(name = "调整类型:0:无状态 1:数量调整 :2:状态调整 3:库存冻结") + private Long adjustType; + + @ApiModelProperty("调整方向:0:无状态 1:增库存 2:减库存") + @Excel(name = "调整方向:0:无状态 1:增库存 2:减库存") + private Long adjustDirection; + + @ApiModelProperty("调整前状态编码") + @Excel(name = "调整前状态编码") + private String adjustBeforeStatusCode; + + @ApiModelProperty("调整前状态名称") + @Excel(name = "调整前状态名称") + private String adjustBeforeStatusName; + + @ApiModelProperty("调整后状态编码") + @Excel(name = "调整后状态编码") + private String adjustAfterStatusCode; + + @ApiModelProperty("调整后状态名称") + @Excel(name = "调整后状态名称") + private String adjustAfterStatusName; + + @ApiModelProperty("调整数量") + @Excel(name = "调整数量") + private BigDecimal adjustQuantity; + + @ApiModelProperty("调整前库存数量") + @Excel(name = "调整前库存数量") + private BigDecimal inventoryBeforeQuantity; + + @ApiModelProperty("调整前可用数量") + @Excel(name = "调整前可用数量") + private BigDecimal allocationBeforeQuantity; + + @ApiModelProperty("调整前冻结数量") + @Excel(name = "调整前冻结数量") + private BigDecimal freezeBeforeQuantity; + + @ApiModelProperty("调整后库存数量") + @Excel(name = "调整后库存数量") + private BigDecimal inventoryAfterQuantity; + + @ApiModelProperty("调整后可用数量") + @Excel(name = "调整后可用数量") + private BigDecimal allocationAfterQuantity; + + @ApiModelProperty("调整后冻结数量") + @Excel(name = "调整后冻结数量") + private BigDecimal freezeAfterQuantity; + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty("调整动作") + @Excel(name = "调整动作") + private String adjustAction; + + @ApiModelProperty("关联单号") + @Excel(name = "关联单号") + private String relateNo; + + @ApiModelProperty("调整前净重(KG)") + @Excel(name = "调整前净重(KG)") + private BigDecimal netWeight; + + @ApiModelProperty("调整前毛重(KG)") + @Excel(name = "调整前毛重(KG)") + private BigDecimal grossWeight; + + @ApiModelProperty("调整前体积") + @Excel(name = "调整前体积") + private BigDecimal volume; + + @ApiModelProperty("调整前面积") + @Excel(name = "调整前面积") + private BigDecimal area; + + @ApiModelProperty("调整后净重(KG)") + @Excel(name = "调整后净重(KG)") + private BigDecimal adjustedNetWeight; + + @ApiModelProperty("调整后毛重(KG)") + @Excel(name = "调整后毛重(KG)") + private BigDecimal adjustedGrossWeight; + + @ApiModelProperty("调整后体积") + @Excel(name = "调整后体积") + private BigDecimal adjustedVolume; + + @ApiModelProperty("调整后面积") + @Excel(name = "调整后面积") + private BigDecimal adjustedArea; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("LOT编号") + @Excel(name = "LOT编号") + private String lotNumber; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/todo/ReservationInventoryAdjustmentRecordDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/todo/ReservationInventoryAdjustmentRecordDTO.java new file mode 100644 index 000000000..bcc56a552 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/repository/todo/ReservationInventoryAdjustmentRecordDTO.java @@ -0,0 +1,171 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo; + +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; + +/** + * 库存调整记录对象 inventory_adjustment_record + * + * @author gen + * @date 2024-07-17 + */ + +@Data +public class ReservationInventoryAdjustmentRecordDTO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("库存调整记录id") + private Long inventoryAdjustmentId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("物料库存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("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @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 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("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("容器id") + @Excel(name = "容器id") + private Long containerId; + + @ApiModelProperty("调整类型:0:无状态 1:数量调整 :2:状态调整 3:库存冻结") + @Excel(name = "调整类型:0:无状态 1:数量调整 :2:状态调整 3:库存冻结") + private Long adjustType; + + @ApiModelProperty("调整方向:0:无状态 1:增库存 2:减库存") + @Excel(name = "调整方向:0:无状态 1:增库存 2:减库存") + private Long adjustDirection; + + @ApiModelProperty("调整前状态编码") + @Excel(name = "调整前状态编码") + private String adjustBeforeStatusCode; + + @ApiModelProperty("调整前状态名称") + @Excel(name = "调整前状态名称") + private String adjustBeforeStatusName; + + @ApiModelProperty("调整后状态编码") + @Excel(name = "调整后状态编码") + private String adjustAfterStatusCode; + + @ApiModelProperty("调整后状态名称") + @Excel(name = "调整后状态名称") + private String adjustAfterStatusName; + + @ApiModelProperty("调整数量") + @Excel(name = "调整数量") + private BigDecimal adjustQuantity; + + @ApiModelProperty("调整前库存数量") + @Excel(name = "调整前库存数量") + private BigDecimal inventoryBeforeQuantity; + + @ApiModelProperty("调整前可用数量") + @Excel(name = "调整前可用数量") + private BigDecimal allocationBeforeQuantity; + + @ApiModelProperty("调整前冻结数量") + @Excel(name = "调整前冻结数量") + private BigDecimal freezeBeforeQuantity; + + @ApiModelProperty("调整后库存数量") + @Excel(name = "调整后库存数量") + private BigDecimal inventoryAfterQuantity; + + @ApiModelProperty("调整后可用数量") + @Excel(name = "调整后可用数量") + private BigDecimal allocationAfterQuantity; + + @ApiModelProperty("调整后冻结数量") + @Excel(name = "调整后冻结数量") + private BigDecimal freezeAfterQuantity; + + @ApiModelProperty("调整动作") + private String adjustAction; + + @ApiModelProperty("关联单号") + private String relateNo; + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/service/ReservationInventoryAdjustmentRecordApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/service/ReservationInventoryAdjustmentRecordApplicationService.java new file mode 100644 index 000000000..0a9d861a8 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/service/ReservationInventoryAdjustmentRecordApplicationService.java @@ -0,0 +1,169 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.service; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson2.JSONObject; +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.reservationInventoryAdjustmentRecord.repository.po.ReservationInventoryAdjustmentRecordPO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.service.ReservationInventoryAdjustmentRecordDomainService; +import com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper; +import com.mhd.system.api.SystemServiceFeign; +import com.mhd.system.api.domain.BatchDetailFeignPO; +import com.mhd.system.api.domain.MaterialMoreDetailPO; +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.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.lang.reflect.Field; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 库存调整记录ApplicationService + * + * @author gen + * @date 2024-07-17 + */ +@Service +@Slf4j +public class ReservationInventoryAdjustmentRecordApplicationService { + @Autowired + private ReservationInventoryAdjustmentRecordDomainService inventoryAdjustmentRecordDomainService; + @Autowired + private ReservationMaterialInventoryMapper materialInventoryMapper; + @Autowired + private SystemServiceFeign systemServiceFeign; + + + /** + * 分页查询库存调整记录列表 + */ + + public List queryList(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null && loginUser.getUserPo() != null){ + Long userOrganizationId = loginUser.getUserPo().getOrganizationId(); + Long frontendOrganizationId = inventoryAdjustmentRecordDO.getOrganizationId(); // 前端传递的 organizationId + + // 数据权限:根据 organizationId 来设置查询权限 + // 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己 + if (userOrganizationId != null && userOrganizationId == 2827L) { + // 南光组织(organizationId=2827):可以查询所有组织的数据 + // 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤 + // 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据 + if (frontendOrganizationId != null) { + // 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤 + inventoryAdjustmentRecordDO.setOrganizationId(frontendOrganizationId); + inventoryAdjustmentRecordDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件 + } else { + // 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据 + inventoryAdjustmentRecordDO.setOrganizationId(null); + inventoryAdjustmentRecordDO.setTopOrganizationId(null); + } + } else { + // 其他组织:设置organizationId,只查询当前组织的数据 + // 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致 + if (frontendOrganizationId != null && userOrganizationId != null) { + // 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致 + if (!frontendOrganizationId.equals(userOrganizationId)) { + // 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询 + inventoryAdjustmentRecordDO.setOrganizationId(userOrganizationId); + } + // 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值 + } else { + // 前端没有传递 organizationId,使用当前登录用户的组织ID + if (userOrganizationId != null) { + inventoryAdjustmentRecordDO.setOrganizationId(userOrganizationId); + } + } + // 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件 + // 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId + if (inventoryAdjustmentRecordDO.getOrganizationId() == null) { + Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); + if (topOrganizationId != null && topOrganizationId != 1) { + inventoryAdjustmentRecordDO.setTopOrganizationId(topOrganizationId); + } + } else { + // 对于非2827组织,必须设置 topOrganizationId=2827 + inventoryAdjustmentRecordDO.setTopOrganizationId(2827L); + } + } + AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid()); + if (associationWarehouseCacheDO != null) { + inventoryAdjustmentRecordDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId()); + } + } + List inventoryAdjustmentRecordPOS = inventoryAdjustmentRecordDomainService.queryList(inventoryAdjustmentRecordDO); + + // 性能优化:批量获取批次属性,避免N+1查询问题 + // 1. 收集所有唯一的materialBaseInfoId + Set materialBaseInfoIdSet = inventoryAdjustmentRecordPOS.stream() + .map(ReservationInventoryAdjustmentRecordPO::getMaterialBaseInfoId) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + + // 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId) + Map> batchDetailMap = new HashMap<>(); + for (Long materialBaseInfoId : materialBaseInfoIdSet) { + try { + AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId); + if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) { + List batchDetailFeignPOList = JSON.parseArray( + JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class); + if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) { + // 过滤isDisplay=1的属性 + List filteredList = batchDetailFeignPOList.stream() + .filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1) + .collect(Collectors.toList()); + batchDetailMap.put(materialBaseInfoId, filteredList); + } + } + } catch (Exception e) { + log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage()); + } + } + + // 3. 为每个物料明细设置更多属性(从库存表中获取值) + //setMaterialMoreDetailListFromInventory(inventoryAdjustmentRecordPOS, batchDetailMap); + inventoryAdjustmentRecordPOS.sort(Comparator.comparing(ReservationInventoryAdjustmentRecordPO::getCreateTime).reversed()); + return inventoryAdjustmentRecordPOS; + } + + + /** + * 新增库存调整记录 + */ + public Boolean insert(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { + + return inventoryAdjustmentRecordDomainService.insert(inventoryAdjustmentRecordDO); + } + + /** + * 修改库存调整记录 + */ + public Boolean update(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { + return inventoryAdjustmentRecordDomainService.update(inventoryAdjustmentRecordDO); + } + + /** + * 批量删除库存调整记录 + */ + public boolean delete(Long[] inventoryAdjustmentIds) { + return inventoryAdjustmentRecordDomainService.delete(inventoryAdjustmentIds); + } + + /** + * 获取库存调整记录详细信息 + */ + public ReservationInventoryAdjustmentRecordPO getInfo(Long inventoryAdjustmentId) + { + return inventoryAdjustmentRecordDomainService.getInfo(inventoryAdjustmentId); + } +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/service/ReservationInventoryAdjustmentRecordAssembler.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/service/ReservationInventoryAdjustmentRecordAssembler.java new file mode 100644 index 000000000..a84354531 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/service/ReservationInventoryAdjustmentRecordAssembler.java @@ -0,0 +1,28 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.service; + +import com.mhd.common.core.utils.IgnoreNullUtil; +import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDTO; +import org.springframework.stereotype.Component; + +/** + * 库存调整记录Assembler + * + * @author gen + * @date 2024-07-17 + */ +@Component +public class ReservationInventoryAdjustmentRecordAssembler { + + /** + * 转换实体 + */ + public ReservationInventoryAdjustmentRecordDO toDO(ReservationInventoryAdjustmentRecordDTO inventoryAdjustmentRecordDTO) { + ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO = new ReservationInventoryAdjustmentRecordDO(); + // 拷贝 + BeanUtils.copyProperties(inventoryAdjustmentRecordDTO, inventoryAdjustmentRecordDO, IgnoreNullUtil.getNullPropertyNames(inventoryAdjustmentRecordDTO)); + return inventoryAdjustmentRecordDO; + } + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/service/ReservationInventoryAdjustmentRecordDomainService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/service/ReservationInventoryAdjustmentRecordDomainService.java new file mode 100644 index 000000000..4b21756f9 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInventoryAdjustmentRecord/service/ReservationInventoryAdjustmentRecordDomainService.java @@ -0,0 +1,305 @@ +package com.mhd.oms.domain.reservationInventoryAdjustmentRecord.service; + +import cn.hutool.core.util.ObjectUtil; +import com.aliyun.oss.ServiceException; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.mhd.common.core.constant.SnowFlakeConstants; +import com.mhd.common.core.domain.po.UserPo; +import com.mhd.common.core.utils.OrderSequence; +import com.mhd.common.core.utils.uuid.IdGenerator; +import com.mhd.common.core.web.domain.BaseVOEntity; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.facade.IReservationInventoryAdjustmentRecordService; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.po.ReservationInventoryAdjustmentRecordPO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDO; +import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory; +import com.mhd.oms.domain.reservationMaterialInventory.repository.facade.IReservationMaterialInventoryService; +import com.mhd.system.api.OmsServiceFeign; +import com.mhd.system.api.domain.InMaterialDetail; +import com.mhd.system.api.domain.OutMaterialDetail; +import com.mhd.system.api.domain.StockOutOrder; +import com.mhd.system.api.model.LoginUser; +import lombok.extern.slf4j.Slf4j; +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.math.BigDecimal; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +/** + * 库存调整记录 + * + * @author gen + * @date 2024-07-17 + */ +@Service +@Slf4j +public class ReservationInventoryAdjustmentRecordDomainService { + + @Autowired + private IReservationInventoryAdjustmentRecordService inventoryAdjustmentRecordService; + @Autowired + private IReservationMaterialInventoryService materialInventoryService; +// @Autowired +// private IMaterialBaseInfoService materialBaseInfoService; +// @Autowired +// private IInventoryStandingDetailService inventoryStandingDetailService; + @Autowired + private IdGenerator idGenerator; + @Autowired + private OmsServiceFeign omsServiceFeign; + + + + /** + * 分页查询库存调整记录列表 + */ + public List queryList(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { + return inventoryAdjustmentRecordService.queryList(inventoryAdjustmentRecordDO); + } + + + /** + * 新增库存调整记录 + */ + public Boolean insert(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { + + return inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecordDO); + } + + /** + * 修改库存调整记录 + */ + public Boolean update(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { + return inventoryAdjustmentRecordService.update(inventoryAdjustmentRecordDO); + } + + /** + * 批量删除库存调整记录 + */ + public Boolean delete(Long[] inventoryAdjustmentIds) { + return inventoryAdjustmentRecordService.delete(inventoryAdjustmentIds); + } + + /** + * 获取库存调整记录详细信息 + */ + public ReservationInventoryAdjustmentRecordPO getInfo(Long inventoryAdjustmentId) + { + return inventoryAdjustmentRecordService.getInfo(inventoryAdjustmentId); + } + + /** + * @description:库存调整 + * @param inventoryAdjustmentRecordDO + * @return: java.lang.Boolean + * @author: lianzj + * @time: 2024-07-18 9:30:30 + */ +// @Transactional +// public Boolean inventoryAdjust(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { +// ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecord = new ReservationInventoryAdjustmentRecordDO(); +// inventoryAdjustmentRecord.setAdjustAction("库存调整"); +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// inventoryAdjustmentRecord.setOrganizationId(loginUser.getUserPo().getOrganizationId()); +// inventoryAdjustmentRecord.setOrganizationName(loginUser.getUserPo().getOrganizationName()); +// inventoryAdjustmentRecord.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); +// inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid()); +// inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername()); +// inventoryAdjustmentRecord.setCreateTime(new Date()); +// ReservationMaterialInventory materialInventory = null; +// //根据调整类型判断,数量调整只调整当前库存记录数量,状态调整减少当前原物料状态库存数量和可用数量,增加到现状态库存数量和可用数量 +// if (inventoryAdjustmentRecordDO.getAdjustType() != null && inventoryAdjustmentRecordDO.getAdjustType() == 1) { +// inventoryAdjustmentRecord.setAdjustType(1L); +// if (inventoryAdjustmentRecordDO.getReservationMaterialInventoryId() != null) { +// materialInventory = materialInventoryService.getById(inventoryAdjustmentRecordDO.getReservationMaterialInventoryId()); +// if (ObjectUtil.isNotNull(materialInventory)) { +// BeanUtils.copyProperties(materialInventory, inventoryAdjustmentRecord); +// inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity()); +// inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity()); +// inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity()); +// MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getOne(new QueryWrapper().lambda() +// .eq(MaterialBaseInfo::getMaterialBaseInfoId,materialInventory.getMaterialBaseInfoId()).eq(BaseVOEntity::getDelFlag,1)); +// if (ObjectUtil.isNotNull(materialBaseInfo)) { +// inventoryAdjustmentRecord.setMaterialCode(materialBaseInfo.getMaterialCode()); +// inventoryAdjustmentRecord.setMaterialName(materialBaseInfo.getMaterialName()); +// inventoryAdjustmentRecord.setBarCode(materialBaseInfo.getBarCode()); +// inventoryAdjustmentRecord.setShipperId(materialBaseInfo.getShipperId()); +// inventoryAdjustmentRecord.setShipperName(materialBaseInfo.getShipperName()); +// } +// //根据调整方向判断 +// if (inventoryAdjustmentRecordDO.getAdjustDirection() != null && inventoryAdjustmentRecordDO.getAdjustDirection() == 1) { +// materialInventory.setInventoryQuantity(materialInventory.getInventoryQuantity().add(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// materialInventory.setAllocationQuantity(materialInventory.getAllocationQuantity().add(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// +// } else if (inventoryAdjustmentRecordDO.getAdjustDirection() != null && inventoryAdjustmentRecordDO.getAdjustDirection() == 2) { +// materialInventory.setInventoryQuantity(materialInventory.getInventoryQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// if (materialInventory.getInventoryQuantity().compareTo(BigDecimal.ZERO) < 0) { +// throw new ServiceException("库存数量调整之后不能小于0"); +// } +// materialInventory.setAllocationQuantity(materialInventory.getAllocationQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// if (materialInventory.getAllocationQuantity().compareTo(BigDecimal.ZERO) < 0) { +// throw new ServiceException("可用数量调整之后不能小于0"); +// } +// } +// inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity()); +// inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity()); +// inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity()); +// // 调整前:库存数量(净重、毛重、体积、面积) +// inventoryAdjustmentRecord.setNetWeight(materialInventory.getNetWeight()); +// inventoryAdjustmentRecord.setGrossWeight(materialInventory.getGrossWeight()); +// inventoryAdjustmentRecord.setVolume(materialInventory.getVolume()); +// inventoryAdjustmentRecord.setArea(materialInventory.getArea()); +// // 调整后:库存数量 - 复核时填写的数量 +// inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight()); +// inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight()); +// inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume()); +// inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea()); +// +// } else { +// throw new ServiceException("根据物料库存id查询不到物料库存信息!"); +// } +// } +// } else if (inventoryAdjustmentRecordDO.getAdjustType() != null && inventoryAdjustmentRecordDO.getAdjustType() == 2) { +// inventoryAdjustmentRecord.setAdjustType(2L); +// inventoryAdjustmentRecord.setAdjustBeforeStatusCode(inventoryAdjustmentRecordDO.getAdjustBeforeStatusCode()); +// inventoryAdjustmentRecord.setAdjustBeforeStatusName(inventoryAdjustmentRecordDO.getAdjustBeforeStatusName()); +// //根据物料基本信息id,仓库id,库区id,库位id,原物料状态查询 +// materialInventory = materialInventoryService.getOne(new QueryWrapper().lambda() +// .eq(ReservationMaterialInventory::getReservationMaterialInventoryId,inventoryAdjustmentRecordDO.getReservationMaterialInventoryId()) +// .eq(ReservationMaterialInventory::getMaterialBaseInfoId,inventoryAdjustmentRecordDO.getMaterialBaseInfoId()) +// .eq(ReservationMaterialInventory::getWarehouseId,inventoryAdjustmentRecordDO.getWarehouseId()) +// .eq(ReservationMaterialInventory::getStorageSectionId,inventoryAdjustmentRecordDO.getStorageSectionId()) +// .eq(ReservationMaterialInventory::getStorageLocationId,inventoryAdjustmentRecordDO.getStorageLocationId()) +// .eq(ReservationMaterialInventory::getMaterialStatusCode,inventoryAdjustmentRecordDO.getAdjustBeforeStatusCode()) +// .eq(ReservationMaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber()) +// .eq(ReservationMaterialInventory::getContainerId,inventoryAdjustmentRecordDO.getContainerId()) +// .eq(BaseVOEntity::getDelFlag, 1)); +// if (ObjectUtil.isNotNull(materialInventory)) { +// BeanUtils.copyProperties(materialInventory, inventoryAdjustmentRecord); +// inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity()); +// inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity()); +// inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity()); +// MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getOne(new QueryWrapper().lambda() +// .eq(MaterialBaseInfo::getMaterialBaseInfoId,materialInventory.getMaterialBaseInfoId()).eq(BaseVOEntity::getDelFlag,1)); +// if (ObjectUtil.isNotNull(materialBaseInfo)) { +// inventoryAdjustmentRecord.setMaterialCode(materialBaseInfo.getMaterialCode()); +// inventoryAdjustmentRecord.setMaterialName(materialBaseInfo.getMaterialName()); +// inventoryAdjustmentRecord.setBarCode(materialBaseInfo.getBarCode()); +// inventoryAdjustmentRecord.setShipperId(materialBaseInfo.getShipperId()); +// inventoryAdjustmentRecord.setShipperName(materialBaseInfo.getShipperName()); +// } +// materialInventory.setInventoryQuantity(materialInventory.getInventoryQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// if (materialInventory.getInventoryQuantity().compareTo(BigDecimal.ZERO) < 0) { +// throw new ServiceException("库存数量调整之后不能小于0"); +// } +// materialInventory.setAllocationQuantity(materialInventory.getAllocationQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// if (materialInventory.getAllocationQuantity().compareTo(BigDecimal.ZERO) < 0) { +// throw new ServiceException("可用数量调整之后不能小于0"); +// } +// inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity()); +// inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity()); +// inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity()); +// // 调整前:库存数量(净重、毛重、体积、面积) +// inventoryAdjustmentRecord.setNetWeight(materialInventory.getNetWeight()); +// inventoryAdjustmentRecord.setGrossWeight(materialInventory.getGrossWeight()); +// inventoryAdjustmentRecord.setVolume(materialInventory.getVolume()); +// inventoryAdjustmentRecord.setArea(materialInventory.getArea()); +// // 调整后:库存数量 - 复核时填写的数量 +// inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight()); +// inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight()); +// inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume()); +// inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea()); +// } else { +// throw new ServiceException("根据原物料状态查询不到物料库存信息!"); +// } +// //根据物料基本信息id,仓库id,库区id,库位id,现物料状态查询 +// ReservationMaterialInventory materialInventory1 = materialInventoryService.getOne(new QueryWrapper().lambda() +// .eq(ReservationMaterialInventory::getMaterialBaseInfoId,inventoryAdjustmentRecordDO.getMaterialBaseInfoId()) +// .eq(ReservationMaterialInventory::getWarehouseId,inventoryAdjustmentRecordDO.getWarehouseId()) +// .eq(ReservationMaterialInventory::getStorageSectionId,inventoryAdjustmentRecordDO.getStorageSectionId()) +// .eq(ReservationMaterialInventory::getStorageLocationId,inventoryAdjustmentRecordDO.getStorageLocationId()) +// .eq(ReservationMaterialInventory::getMaterialStatusCode,inventoryAdjustmentRecordDO.getAdjustAfterStatusCode()) +// .eq(ReservationMaterialInventory::getBatchNumber,inventoryAdjustmentRecordDO.getBatchNumber()) +// .eq(ReservationMaterialInventory::getContainerId,inventoryAdjustmentRecordDO.getContainerId()) +// .eq(BaseVOEntity::getDelFlag, 1)); +// if (ObjectUtil.isNotNull(materialInventory1)) { +// materialInventory1.setInventoryQuantity(materialInventory1.getInventoryQuantity().add(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// materialInventory1.setAllocationQuantity(materialInventory1.getAllocationQuantity().add(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// materialInventoryService.updateById(materialInventory1); +// +// inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory1.getInventoryQuantity()); +// inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory1.getAllocationQuantity()); +// inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory1.getFreezeQuantity()); +// } else { +// throw new ServiceException("根据现物料状态查询不到调整库存库存信息!"); +// } +// inventoryAdjustmentRecord.setAdjustAfterStatusCode(inventoryAdjustmentRecordDO.getAdjustAfterStatusCode()); +// inventoryAdjustmentRecord.setAdjustAfterStatusName(inventoryAdjustmentRecordDO.getAdjustAfterStatusName()); +// } +// //生成库存调整追溯记录 +// if (ObjectUtil.isNotNull(materialInventory)){ +// genInventoryStandingDetail(materialInventory, inventoryAdjustmentRecordDO.getAdjustQuantity()); +// } +// +// +// materialInventoryService.updateById(materialInventory); +// Boolean insert = inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecord); +// //推送oms库存调整记录 +// pushOms(materialInventory, inventoryAdjustmentRecordDO); +// return insert; +// } + + /** + * @description:库存冻结 + * @param inventoryAdjustmentRecordDO + * @return: java.lang.Boolean + * @author: lianzj + * @time: 2024-07-18 14:58:50 + */ +// @Transactional +// public Boolean inventoryFrozen(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) { +// ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecord = new ReservationInventoryAdjustmentRecordDO(); +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// inventoryAdjustmentRecord.setOrganizationId(loginUser.getUserPo().getOrganizationId()); +// inventoryAdjustmentRecord.setOrganizationName(loginUser.getUserPo().getOrganizationName()); +// inventoryAdjustmentRecord.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); +// inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid()); +// inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername()); +// inventoryAdjustmentRecord.setCreateTime(new Date()); +// ReservationMaterialInventory materialInventory = materialInventoryService.getById(inventoryAdjustmentRecordDO.getReservationMaterialInventoryId()); +// inventoryAdjustmentRecord.setAdjustType(3L); +// if (ObjectUtil.isNotNull(materialInventory)) { +// BeanUtils.copyProperties(materialInventory, inventoryAdjustmentRecord); +// inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity()); +// inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity()); +// inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity()); +// MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getOne(new QueryWrapper().lambda() +// .eq(MaterialBaseInfo::getMaterialBaseInfoId,materialInventory.getMaterialBaseInfoId()).eq(BaseVOEntity::getDelFlag,1)); +// if (ObjectUtil.isNotNull(materialBaseInfo)) { +// inventoryAdjustmentRecord.setMaterialCode(materialBaseInfo.getMaterialCode()); +// inventoryAdjustmentRecord.setMaterialName(materialBaseInfo.getMaterialName()); +// inventoryAdjustmentRecord.setBarCode(materialBaseInfo.getBarCode()); +// inventoryAdjustmentRecord.setShipperId(materialBaseInfo.getShipperId()); +// inventoryAdjustmentRecord.setShipperName(materialBaseInfo.getShipperName()); +// } +// //可用数量减,冻结数量加 +// materialInventory.setAllocationQuantity(materialInventory.getAllocationQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// materialInventory.setFreezeQuantity(materialInventory.getFreezeQuantity().add(inventoryAdjustmentRecordDO.getAdjustQuantity())); +// if (materialInventory.getAllocationQuantity().compareTo(BigDecimal.ZERO) < 0) { +// throw new ServiceException("冻结可用数量不能小于0"); +// } +// inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity()); +// inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity()); +// inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity()); +// } else { +// throw new ServiceException("根据物料库存id查询不到物料库存信息!"); +// } +// materialInventoryService.updateById(materialInventory); +// return inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecord); +// } +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/entity/ReservationMaterialInventory.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/entity/ReservationMaterialInventory.java new file mode 100644 index 000000000..830011805 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/entity/ReservationMaterialInventory.java @@ -0,0 +1,239 @@ +package com.mhd.oms.domain.reservationMaterialInventory.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; + + +/** + * 物料库存对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +public class ReservationMaterialInventory extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料库存id") + @TableId(type = IdType.AUTO) + private Long materialInventoryId; + + @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 shipperId; + + @ApiModelProperty("货主编码") + @Excel(name = "货主编码") + private String shipperCode; + + @ApiModelProperty("货主名称") + @Excel(name = "货主名称") + private String shipperName; + + @ApiModelProperty("上架单物料明细id") + @Excel(name = "上架单物料明细id") + private Long materialDetailId; + + @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 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("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @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("库存数量") + @Excel(name = "库存数量") + private BigDecimal inventoryQuantity; + + @ApiModelProperty("可用数量") + @Excel(name = "可用数量") + private BigDecimal allocationQuantity; + + @ApiModelProperty("冻结数量") + @Excel(name = "冻结数量") + private BigDecimal freezeQuantity; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("盘点是否可用:0-禁用 1-可用") + @Excel(name = "盘点是否可用:0-禁用 1-可用") + private Integer isAble; + + @ApiModelProperty("单位") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("单位名称") + @Excel(name = "单位名称") + private String unitName; + + @ApiModelProperty("净重(KG)") + @Excel(name = "净重(KG)") + private BigDecimal netWeight; + + @ApiModelProperty("毛重(KG)") + @Excel(name = "毛重(KG)") + private BigDecimal grossWeight; + + @ApiModelProperty("体积") + @Excel(name = "体积") + private BigDecimal volume; + + @ApiModelProperty("面积") + @Excel(name = "面积") + private BigDecimal area; + + + @ApiModelProperty("Batch Ref NO's") + @Excel(name = "Batch Ref NO's") + private String batchRefNo; + + @ApiModelProperty("Sheet Ref NO's") + @Excel(name = "Sheet Ref NO's") + private String sheetRefNo; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("扩展字段1") + @Excel(name = "扩展字段1") + @TableField("ext_attr_1") + private String extAttr1; + + @ApiModelProperty("扩展字段2") + @Excel(name = "扩展字段2") + @TableField("ext_attr_2") + private String extAttr2; + + @ApiModelProperty("生产日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date productionDate; + + @ApiModelProperty("过期日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expiryDate; + + @ApiModelProperty("存货日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date inventoryDate; + + @ApiModelProperty("ExtAttr3") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @TableField("ext_attr_3") + private Date extAttr3; + + @ApiModelProperty("ExtAttr4") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @TableField("ext_attr_4") + private Date extAttr4; + + @ApiModelProperty("条码") + @Excel(name = "条码") + private String barCode; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("LOT编号") + @Excel(name = "LOT编号") + private String lotNumber; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/facade/IReservationMaterialInventoryService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/facade/IReservationMaterialInventoryService.java new file mode 100644 index 000000000..5344f3163 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/facade/IReservationMaterialInventoryService.java @@ -0,0 +1,116 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.facade; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory; +import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialInventoryParamDO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialInventoryQueryListDO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO; +import com.mhd.system.api.domain.MaterialInventoryOmsParamDO; +import com.mhd.system.api.domain.MaterialInventoryPO; +import com.mhd.system.api.model.LoginUser; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 物料库存Service接口 + * + * @author gen + * @date 2024-05-29 + */ +public interface IReservationMaterialInventoryService extends IService +{ + /** + * 分页查询物料库存列表 + */ + public List queryList(ReservationMaterialInventoryDO materialInventoryDO); + + /** + * 新增物料库存 + */ + public Boolean insert(ReservationMaterialInventoryDO materialInventoryDO); + + /** + * 修改物料库存 + */ + public Boolean update(ReservationMaterialInventoryDO materialInventoryDO); + + /** + * 批量删除物料库存 + */ + public Boolean delete(Long[] materialInventoryIds); + + + /** + * 查询物料库存 + */ + public ReservationMaterialInventoryPO getInfo(Long materialInventoryId); + + public Boolean omsEdit(MaterialInventoryOmsParamDO materialInventoryOmsParamDO); + + /** + * @description 修改物料库存信息 + * @author ZhouGY + * @date 2024/5/29 16:31 + * @param materialInventoryDOList + */ + //public void updateReservationMaterialInventoryInfo(List materialInventoryDOList, Integer type); + + /** + * @description:库存查询列表 + * @param materialInventoryQueryListDO + * @return: java.util.List + * @author: lianzj + * @time: 2024-07-16 14:46:10 + */ + //List materialQueryList(MaterialInventoryQueryListDO materialInventoryQueryListDO); + + /** + * 分页查询物料库存列表 + */ + //public List queryImmediateInventoryList(ImmediateInventoryDO immediateInventoryDO); + + /** + * @description 增加指定库存 + * @author ZhouGY + * @date 2024/7/21 0:27 + * @param materialInventoryParentDO + * @return Boolean + */ + //public Boolean batchAddInventoryQuantity(ReservationMaterialInventoryParentDO materialInventoryParentDO); + + /** + * @description 减少指定库存 + * @author ZhouGY + * @date 2024/7/21 0:29 + * @param materialInventoryParentDO + * @return Boolean + */ + //public Boolean batchSubtractInventoryQuantity(ReservationMaterialInventoryParentDO materialInventoryParentDO); + + /** + * @description 货主编码和物料编码统计库存数量 + * @author ZhouGY + * @date 2024/7/25 13:44 + * @return BigDecimal + */ + //public BigDecimal sumInventoryQuantityByShipperAndMaterialCode(Long shipperCode, Long materialBaseInfoId); + + //ReservationMaterialInventoryPO selectOneByWhere(ReservationMaterialInventoryDO materialInventoryDO); + + /* + * 库存调整方法 + * netWeight 总净重 + * grossWeight 总毛重 + * volume 体积 + * area 面积 + * quantity 数量 + * type 类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结) + * materialInventoryId 物料库存ID + * */ + public void xgkc(MaterialInventoryOmsParamDO materialInventoryParamDO); + + public void kctzjl(MaterialInventoryOmsParamDO materialInventoryParamDO,String adjustAction,LoginUser loginUser); +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/mapper/ReservationMaterialInventoryMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/mapper/ReservationMaterialInventoryMapper.java new file mode 100644 index 000000000..5676fa84d --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/mapper/ReservationMaterialInventoryMapper.java @@ -0,0 +1,37 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory; +import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBarCodePO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBaseInfo; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 物料库存Mapper接口 + * + * @author gen + * @date 2024-05-29 + */ +public interface ReservationMaterialInventoryMapper extends BaseMapper +{ + //查全部 + public List queryList(ReservationMaterialInventoryDO materialInventoryDO); + //查物料库存列表-物料/库位 + public List queryListByWlKw(ReservationMaterialInventoryDO materialInventoryDO); + //查物料库存列表-库位 + public List queryListByKw(ReservationMaterialInventoryDO materialInventoryDO); + //查物料库存列表-物料 + public List queryListByWl(ReservationMaterialInventoryDO materialInventoryDO); + //查物料库存列表-货主 + public List queryListByHz(ReservationMaterialInventoryDO materialInventoryDO); + + + public MaterialBaseInfo getByInfoId(@Param("id") Long id); + + public List getInfoByMaterialBaseInfoIds(@Param("id") Long id); +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/persistence/ReservationMaterialInventoryImpl.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/persistence/ReservationMaterialInventoryImpl.java new file mode 100644 index 000000000..f1dbc09dd --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/persistence/ReservationMaterialInventoryImpl.java @@ -0,0 +1,832 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.persistence; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mhd.common.core.domain.po.UserPo; +import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.web.domain.BaseVOEntity; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.entity.ReservationInventoryAdjustmentRecord; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.mapper.ReservationInventoryAdjustmentRecordMapper; +import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory; +import com.mhd.oms.domain.reservationMaterialInventory.repository.facade.IReservationMaterialInventoryService; +import com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper; +import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBarCodePO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBaseInfo; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialInventoryParamDO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO; +import com.mhd.system.api.SystemServiceFeign; +import com.mhd.system.api.domain.MaterialInventoryOmsParamDO; +import com.mhd.system.api.domain.MaterialInventoryPO; +import com.mhd.system.api.model.LoginUser; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 物料库存Service业务层处理 + * + * @author gen + * @date 2024-05-29 + */ +@Service +public class ReservationMaterialInventoryImpl extends ServiceImpl implements IReservationMaterialInventoryService { + @Autowired + private ReservationMaterialInventoryMapper materialInventoryMapper; + @Autowired + private ReservationInventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper; + + /** + * 查询物料库存列表 + */ + @Override + public List queryList(ReservationMaterialInventoryDO materialInventoryDO) + { + String queryRule = materialInventoryDO.getQueryRule(); + if ("hz".equals(queryRule)) { + return materialInventoryMapper.queryListByHz(materialInventoryDO); + } else if ("wl".equals(queryRule)) { + return materialInventoryMapper.queryListByWl(materialInventoryDO); + } else if ("kw".equals(queryRule)) { + return materialInventoryMapper.queryListByKw(materialInventoryDO); + } else if ("wlkw".equals(queryRule)) { + return materialInventoryMapper.queryListByWlKw(materialInventoryDO); + } else if ("all".equals(queryRule)) { + return materialInventoryMapper.queryList(materialInventoryDO); + } else { + //不传返回全部 + return materialInventoryMapper.queryList(materialInventoryDO); + } + } + + /** + * 新增物料库存 + */ + @Override + public Boolean insert(ReservationMaterialInventoryDO materialInventoryDO) { + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + BeanUtils.copyProperties(materialInventoryDO,materialInventory); + return this.save(materialInventory); + } + + /** + * 修改物料库存 + */ + @Override + public Boolean update(ReservationMaterialInventoryDO materialInventoryDO) { + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + BeanUtils.copyProperties(materialInventoryDO,materialInventory); + return this.updateById(materialInventory); + } + + /** + * 批量删除物料库存 + */ + @Override + public Boolean delete(Long[] materialInventoryIds ) { + List list = new ArrayList<>(); + for (Long id : materialInventoryIds) { + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + materialInventory.setMaterialInventoryId(id); + materialInventory.setDelFlag(2); + list.add(materialInventory); + } + return this.updateBatchById(list); + } + + /** + * 修改物料库存 + */ + @Override + public ReservationMaterialInventoryPO getInfo(Long materialInventoryId) { + ReservationMaterialInventory materialInventory = this.getById(materialInventoryId); + ReservationMaterialInventoryPO materialInventoryPO = new ReservationMaterialInventoryPO(); + BeanUtils.copyProperties(materialInventory,materialInventoryPO); + return materialInventoryPO; + } + + @Override + public Boolean omsEdit(MaterialInventoryOmsParamDO materialInventoryOmsParamDO) { + String inOrderNumber = materialInventoryOmsParamDO.getInOrderNumber(); + String lotNumber = materialInventoryOmsParamDO.getLotNumber(); + String batchNumber = materialInventoryOmsParamDO.getBatchNumber(); + Long materialBaseInfoId = materialInventoryOmsParamDO.getMaterialBaseInfoId(); + Long warehouseId = materialInventoryOmsParamDO.getWarehouseId(); + List reservationMaterialInventories = materialInventoryMapper.selectList(new LambdaQueryWrapper() + .eq(ReservationMaterialInventory::getInOrderNumber, inOrderNumber) + .eq(ReservationMaterialInventory::getLotNumber, lotNumber) + .eq(ReservationMaterialInventory::getBatchNumber, batchNumber) + .eq(ReservationMaterialInventory::getMaterialBaseInfoId, materialBaseInfoId) + .eq(ReservationMaterialInventory::getWarehouseId, warehouseId)); + if (reservationMaterialInventories != null && reservationMaterialInventories.size() > 0) { + ReservationMaterialInventory reservationMaterialInventory = reservationMaterialInventories.get(0); + Long materialInventoryId = reservationMaterialInventory.getMaterialInventoryId(); + materialInventoryOmsParamDO.setMaterialInventoryId(materialInventoryId); + } + kctzjl(materialInventoryOmsParamDO, materialInventoryOmsParamDO.getKctzType(), materialInventoryOmsParamDO.getLoginUser()); + xgkc(materialInventoryOmsParamDO); + return true; + } + + /** + * @description 修改物料库存信息 + * @author ZhouGY + * @date 2024/5/23 14:03 + */ +// @Override +// @Transactional(rollbackFor = Exception.class) +// public void updateReservationMaterialInventoryInfo(List materialInventoryDOList, Integer type){ +// if (type == 1){ +// //增加 +// addReservationMaterialInventory(materialInventoryDOList); +// }else if (type == 2) { +// //减少 +// subtractReservationMaterialInventory(materialInventoryDOList); +// }else { +// throw new ServiceException("修改库存指定方式不存在"); +// } +// } + + @Override + public void xgkc(MaterialInventoryOmsParamDO materialInventoryParamDO) { + BigDecimal netWeight = materialInventoryParamDO.getNetWeight() != null ? materialInventoryParamDO.getNetWeight() : BigDecimal.ZERO; + BigDecimal grossWeight = materialInventoryParamDO.getGrossWeight() != null ? materialInventoryParamDO.getGrossWeight() : BigDecimal.ZERO; + BigDecimal volume = materialInventoryParamDO.getVolume() != null ? materialInventoryParamDO.getVolume() : BigDecimal.ZERO; + BigDecimal area = materialInventoryParamDO.getArea() != null ? materialInventoryParamDO.getArea() : BigDecimal.ZERO; + BigDecimal quantity = materialInventoryParamDO.getQuantity() != null ? materialInventoryParamDO.getQuantity() : BigDecimal.ZERO; + String type = materialInventoryParamDO.getType(); + Long materialInventoryId = materialInventoryParamDO.getMaterialInventoryId(); + + //类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结) + switch (type) { + case "1": + // 上架 + sj(netWeight, grossWeight, volume, area, quantity, materialInventoryId, materialInventoryParamDO); + break; + case "2": + // 分配 + ff(netWeight, grossWeight, volume, area, quantity, materialInventoryId); + break; + case "3": + // 取消分配 + qxff(netWeight, grossWeight, volume, area, quantity, materialInventoryId); + break; + case "4": + // 出库交接 + ckjj(netWeight, grossWeight, volume, area, quantity, materialInventoryId); + break; + case "5": + // 移位 + yw(netWeight, grossWeight, volume, area, quantity, materialInventoryId); + break; + case "6": + // 库存调整 + kctz(netWeight, grossWeight, volume, area, quantity, materialInventoryId); + break; + case "7": + // 库存冻结 + kcdj(netWeight, grossWeight, volume, area, quantity, materialInventoryId); + break; + default: + throw new ServiceException("错误的类型"); + } + } + + @Override + public synchronized void kctzjl(MaterialInventoryOmsParamDO materialInventoryParamDO, + String adjustAction,LoginUser loginUser) { + //库存调整记录(在 xgkc 更新库存前调用,materialInventory 为调整前快照) + Long materialInventoryId = materialInventoryParamDO.getMaterialInventoryId(); + ReservationMaterialInventory materialInventory = materialInventoryMapper.selectOne(new QueryWrapper().lambda() + .eq(ReservationMaterialInventory::getMaterialInventoryId, materialInventoryId)); + if (materialInventory == null) { + throw new ServiceException("物料库存不存在,无法生成库存调整记录"); + } + Long materialBaseInfoId = materialInventory.getMaterialBaseInfoId(); + MaterialBaseInfo materialBaseInfo = materialInventoryMapper.getByInfoId(materialBaseInfoId); + ReservationInventoryAdjustmentRecord inventoryAdjustmentRecord = new ReservationInventoryAdjustmentRecord(); + inventoryAdjustmentRecord.setAdjustAction(adjustAction); + String relateNo = StringUtils.hasText(materialInventoryParamDO.getRelateNo()) + ? materialInventoryParamDO.getRelateNo() + : materialInventoryParamDO.getInOrderNumber(); + inventoryAdjustmentRecord.setRelateNo(relateNo); + inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode()); + inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode()); + inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName()); + inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName()); + inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId()); + + inventoryAdjustmentRecord.setLotNumber(materialInventoryParamDO.getLotNumber()); + inventoryAdjustmentRecord.setInOrderNumber(materialInventoryParamDO.getInOrderNumber()); + inventoryAdjustmentRecord.setBatchNumber(materialInventoryParamDO.getBatchNumber()); + if (ObjectUtil.isNotNull(materialBaseInfo)) { + inventoryAdjustmentRecord.setMaterialCode(materialBaseInfo.getMaterialCode()); + inventoryAdjustmentRecord.setMaterialName(materialBaseInfo.getMaterialName()); + inventoryAdjustmentRecord.setBarCode(materialBaseInfo.getBarCode()); + inventoryAdjustmentRecord.setShipperId(materialBaseInfo.getShipperId()); + inventoryAdjustmentRecord.setShipperName(materialBaseInfo.getShipperName()); + } + if (inventoryAdjustmentRecord.getBarCode() == null || inventoryAdjustmentRecord.getBarCode().isEmpty()){ + getBarCode(materialInventory, inventoryAdjustmentRecord); + } + inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId()); + inventoryAdjustmentRecord.setAdjustType(1L); + if ("库存冻结".equals(adjustAction)) { + inventoryAdjustmentRecord.setAdjustType(3L); + } + inventoryAdjustmentRecord.setOrganizationId(materialInventory.getOrganizationId()); + inventoryAdjustmentRecord.setOrganizationName(materialInventory.getOrganizationName()); + inventoryAdjustmentRecord.setTopOrganizationId(materialInventory.getTopOrganizationId()); + inventoryAdjustmentRecord.setWarehouseCode(materialInventory.getWarehouseCode()); + inventoryAdjustmentRecord.setWarehouseName(materialInventory.getWarehouseName()); + inventoryAdjustmentRecord.setWarehouseId(materialInventory.getWarehouseId()); + inventoryAdjustmentRecord.setStorageCode(materialInventory.getStorageCode()); + inventoryAdjustmentRecord.setStorageName(materialInventory.getStorageName()); + inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId()); + inventoryAdjustmentRecord.setStorageLocationCode(materialInventory.getStorageLocationCode()); + inventoryAdjustmentRecord.setStorageLocationName(materialInventory.getStorageLocationName()); + inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getMaterialInventoryId()); + inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId()); + inventoryAdjustmentRecord.setStorageSectionId(materialInventory.getStorageSectionId()); + inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId()); + inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid()); + UserPo userPo = loginUser.getUserPo(); + if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName()); + inventoryAdjustmentRecord.setCreateTime(new Date()); + + BigDecimal qty = nz(materialInventoryParamDO.getQuantity()); + if ("分配库存".equals(adjustAction)) { + // 总库存不变;可用减少、冻结增加(数量从可用转至冻结) + BigDecimal invBefore = nz(materialInventory.getInventoryQuantity()); + BigDecimal allocBefore = nz(materialInventory.getAllocationQuantity()); + BigDecimal freezeBefore = nz(materialInventory.getFreezeQuantity()); + inventoryAdjustmentRecord.setInventoryBeforeQuantity(invBefore); //调整前库存数量 + inventoryAdjustmentRecord.setInventoryAfterQuantity(invBefore); //调整后库存数量 + inventoryAdjustmentRecord.setAllocationBeforeQuantity(allocBefore); //调整前可用数量 + inventoryAdjustmentRecord.setAllocationAfterQuantity(allocBefore.subtract(qty));//调整后可用数量 + inventoryAdjustmentRecord.setFreezeBeforeQuantity(freezeBefore);//调整前冻结数量 + inventoryAdjustmentRecord.setFreezeAfterQuantity(freezeBefore.add(qty));//调整后冻结数量 + inventoryAdjustmentRecord.setNetWeight(nz(materialInventory.getNetWeight()));//净重 + inventoryAdjustmentRecord.setGrossWeight(nz(materialInventory.getGrossWeight()));//毛重 + inventoryAdjustmentRecord.setVolume(nz(materialInventory.getVolume()));//体积 + inventoryAdjustmentRecord.setArea(nz(materialInventory.getArea()));//积 + inventoryAdjustmentRecord.setAdjustedNetWeight(nz(materialInventory.getNetWeight()));//净重 + inventoryAdjustmentRecord.setAdjustedGrossWeight(nz(materialInventory.getGrossWeight()));//毛重 + inventoryAdjustmentRecord.setAdjustedVolume(nz(materialInventory.getVolume()));//体积 + inventoryAdjustmentRecord.setAdjustedArea(nz(materialInventory.getArea()));//积 + } else if ("取消分配".equals(adjustAction)) { + // 与分配相反:可用增加、冻结减少,总库存不变 + BigDecimal invBefore = nz(materialInventory.getInventoryQuantity()); + BigDecimal allocBefore = nz(materialInventory.getAllocationQuantity()); + BigDecimal freezeBefore = nz(materialInventory.getFreezeQuantity()); + inventoryAdjustmentRecord.setInventoryBeforeQuantity(invBefore); + inventoryAdjustmentRecord.setInventoryAfterQuantity(invBefore); + inventoryAdjustmentRecord.setAllocationBeforeQuantity(allocBefore); + inventoryAdjustmentRecord.setAllocationAfterQuantity(allocBefore.add(qty)); + inventoryAdjustmentRecord.setFreezeBeforeQuantity(freezeBefore); + inventoryAdjustmentRecord.setFreezeAfterQuantity(freezeBefore.subtract(qty)); + inventoryAdjustmentRecord.setNetWeight(nz(materialInventory.getNetWeight())); + inventoryAdjustmentRecord.setGrossWeight(nz(materialInventory.getGrossWeight())); + inventoryAdjustmentRecord.setVolume(nz(materialInventory.getVolume())); + inventoryAdjustmentRecord.setArea(nz(materialInventory.getArea())); + inventoryAdjustmentRecord.setAdjustedNetWeight(nz(materialInventory.getNetWeight())); + inventoryAdjustmentRecord.setAdjustedGrossWeight(nz(materialInventory.getGrossWeight())); + inventoryAdjustmentRecord.setAdjustedVolume(nz(materialInventory.getVolume())); + inventoryAdjustmentRecord.setAdjustedArea(nz(materialInventory.getArea())); + } else if ("入库".equals(adjustAction)){ + if ("1".equals(materialInventoryParamDO.getIsNew())) { + inventoryAdjustmentRecord.setAllocationBeforeQuantity(BigDecimal.ZERO); + inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventoryParamDO.getQuantity()); + inventoryAdjustmentRecord.setFreezeBeforeQuantity(BigDecimal.ZERO); + inventoryAdjustmentRecord.setFreezeAfterQuantity(BigDecimal.ZERO);//调整后 冻结-出库 + inventoryAdjustmentRecord.setInventoryBeforeQuantity(BigDecimal.ZERO); + inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventoryParamDO.getQuantity()); + // 调整前:库存数量(净重、毛重、体积、面积) + inventoryAdjustmentRecord.setNetWeight(BigDecimal.ZERO); + inventoryAdjustmentRecord.setGrossWeight(BigDecimal.ZERO); + inventoryAdjustmentRecord.setVolume(BigDecimal.ZERO); + inventoryAdjustmentRecord.setArea(BigDecimal.ZERO); + // 调整后:库存数量 - 复核时填写的数量 + inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventoryParamDO.getNetWeight()); + inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventoryParamDO.getGrossWeight()); + inventoryAdjustmentRecord.setAdjustedVolume(materialInventoryParamDO.getVolume()); + inventoryAdjustmentRecord.setAdjustedArea(materialInventoryParamDO.getArea()); + } else { + inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity()); + inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity().add(materialInventoryParamDO.getQuantity())); + inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity()); + inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());//调整后 冻结-出库 + inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity()); + inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity().add(materialInventoryParamDO.getQuantity())); + // 调整前:库存数量(净重、毛重、体积、面积) + inventoryAdjustmentRecord.setNetWeight(materialInventory.getNetWeight()); + inventoryAdjustmentRecord.setGrossWeight(materialInventory.getGrossWeight()); + inventoryAdjustmentRecord.setVolume(materialInventory.getVolume()); + inventoryAdjustmentRecord.setArea(materialInventory.getArea()); + // 调整后:库存数量 - 复核时填写的数量 + inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight().add(inventoryAdjustmentRecord.getNetWeight())); + inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight().add(inventoryAdjustmentRecord.getGrossWeight())); + inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume().add(inventoryAdjustmentRecord.getVolume())); + inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea().add(inventoryAdjustmentRecord.getArea())); + } + } else if ("出库".equals(adjustAction)){ + // 出库交接:总库存与冻结同减 checkQuantity;可用数量不变(与 ckjj 中不修改 allocation_quantity 一致) + BigDecimal invBefore = nz(materialInventory.getInventoryQuantity()); + BigDecimal allocBefore = nz(materialInventory.getAllocationQuantity()); + BigDecimal freezeBefore = nz(materialInventory.getFreezeQuantity()); + inventoryAdjustmentRecord.setInventoryBeforeQuantity(invBefore);// 调整前:库存数量 + inventoryAdjustmentRecord.setInventoryAfterQuantity(invBefore.subtract(qty));// 调整后:库存数量 + inventoryAdjustmentRecord.setAllocationBeforeQuantity(allocBefore);// 调整前:可用数量 + inventoryAdjustmentRecord.setAllocationAfterQuantity(allocBefore);// 调整后:可用数量 + inventoryAdjustmentRecord.setFreezeBeforeQuantity(freezeBefore);// 调整前:冻结数量 + inventoryAdjustmentRecord.setFreezeAfterQuantity(freezeBefore.subtract(qty));// 调整后:冻结数量 + BigDecimal nw = nz(materialInventory.getNetWeight()); + BigDecimal gw = nz(materialInventory.getGrossWeight()); + BigDecimal vol = nz(materialInventory.getVolume()); + BigDecimal ar = nz(materialInventory.getArea()); + inventoryAdjustmentRecord.setNetWeight(nw); + inventoryAdjustmentRecord.setGrossWeight(gw); + inventoryAdjustmentRecord.setVolume(vol); + inventoryAdjustmentRecord.setArea(ar); + inventoryAdjustmentRecord.setAdjustedNetWeight(nw.subtract(nz(materialInventoryParamDO.getNetWeight()))); + inventoryAdjustmentRecord.setAdjustedGrossWeight(gw.subtract(nz(materialInventoryParamDO.getGrossWeight()))); + inventoryAdjustmentRecord.setAdjustedVolume(vol.subtract(nz(materialInventoryParamDO.getVolume()))); + inventoryAdjustmentRecord.setAdjustedArea(ar.subtract(nz(materialInventoryParamDO.getArea()))); + } else if ("移位".equals(adjustAction)){ + inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity()); + inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventoryParamDO.getQuantity()); + //inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity); + inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());//调整后 冻结-出库 + //inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity); + inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity()); + // 调整前:库存数量(净重、毛重、体积、面积) + inventoryAdjustmentRecord.setNetWeight(materialInventory.getNetWeight()); + inventoryAdjustmentRecord.setGrossWeight(materialInventory.getGrossWeight()); + inventoryAdjustmentRecord.setVolume(materialInventory.getVolume()); + inventoryAdjustmentRecord.setArea(materialInventory.getArea()); + // 调整后:库存数量 - 复核时填写的数量 + inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight()); + inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight()); + inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume()); + inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea()); + } else if ("库存冻结".equals(adjustAction)) { + inventoryAdjustmentRecord.setAllocationBeforeQuantity(nz(materialInventory.getAllocationQuantity())); + inventoryAdjustmentRecord.setAllocationAfterQuantity(nz(materialInventory.getAllocationQuantity()).subtract(qty)); + inventoryAdjustmentRecord.setFreezeBeforeQuantity(nz(materialInventory.getFreezeQuantity())); + inventoryAdjustmentRecord.setFreezeAfterQuantity(nz(materialInventory.getFreezeQuantity()).add(qty));//调整后 冻结-出库 + inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity()); + inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity()); + + // 调整前:库存数量(净重、毛重、体积、面积) + inventoryAdjustmentRecord.setNetWeight(materialInventory.getNetWeight()); + inventoryAdjustmentRecord.setGrossWeight(materialInventory.getGrossWeight()); + inventoryAdjustmentRecord.setVolume(materialInventory.getVolume()); + inventoryAdjustmentRecord.setArea(materialInventory.getArea()); + // 调整后:库存数量 - 复核时填写的数量 + inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight()); + inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight()); + inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume()); + inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea()); + } + + + + + inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord); + } + + private static BigDecimal nz(BigDecimal v) { + return v == null ? BigDecimal.ZERO : v; + } + + private void getBarCode(ReservationMaterialInventory materialInventoryPO, ReservationInventoryAdjustmentRecord inventoryAdjustmentRecord) { + List materialBarCodePOList = materialInventoryMapper.getInfoByMaterialBaseInfoIds(materialInventoryPO.getMaterialBaseInfoId()); + if (materialBarCodePOList != null && !materialBarCodePOList.isEmpty()) { + Map collect = materialBarCodePOList.stream() + .collect(Collectors.toMap( + MaterialBarCodePO::getMaterialBaseInfoId, + po -> po, + (existing, replacement) -> existing + )); + MaterialBarCodePO materialBarCodePO = collect.get(materialInventoryPO.getMaterialBaseInfoId()); + if (materialBarCodePO != null && materialBarCodePO.getBarCode() != null) { + inventoryAdjustmentRecord.setBarCode(materialBarCodePO.getBarCode()); + } + } + } + + private void sj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId,MaterialInventoryOmsParamDO materialInventoryParamDO) { + if (materialInventoryId == null) { + Long materialBaseInfoId = materialInventoryParamDO.getMaterialBaseInfoId(); + MaterialBaseInfo materialBaseInfo = materialInventoryMapper.getByInfoId(materialBaseInfoId); + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + materialInventory.setInventoryQuantity(quantity); + materialInventory.setAllocationQuantity(quantity); + materialInventory.setFreezeQuantity(BigDecimal.ZERO); + materialInventory.setArea(area); + materialInventory.setVolume(volume); + materialInventory.setGrossWeight(grossWeight); + materialInventory.setNetWeight(netWeight); + materialInventory.setMaterialBaseInfoId(materialInventoryParamDO.getMaterialBaseInfoId()); + materialInventory.setInOrderNumber(materialInventoryParamDO.getInOrderNumber()); + if (materialBaseInfo != null) { + materialInventory.setShipperId(materialBaseInfo.getShipperId()); + materialInventory.setShipperName(materialBaseInfo.getShipperName()); + materialInventory.setShipperCode(materialBaseInfo.getShipperCode()); + } + //仓库信息 + materialInventory.setOrganizationId(materialInventoryParamDO.getOrganizationId()); + materialInventory.setOrganizationName(materialInventoryParamDO.getOrganizationName()); + materialInventory.setTopOrganizationId(materialInventoryParamDO.getTopOrganizationId()); + materialInventory.setWarehouseCode(materialInventoryParamDO.getWarehouseCode()); + materialInventory.setWarehouseName(materialInventoryParamDO.getWarehouseName()); + materialInventory.setWarehouseId(materialInventoryParamDO.getWarehouseId()); +// materialInventory.setStorageCode(materialInventoryParamDO.getStorageCode()); +// materialInventory.setStorageName(materialInventoryParamDO.getStorageName()); +// materialInventory.setStorageLocationId(materialInventoryParamDO.getStorageLocationId()); +// materialInventory.setStorageLocationCode(materialInventoryParamDO.getStorageLocationCode()); +// materialInventory.setStorageLocationName(materialInventoryParamDO.getStorageLocationName()); +// materialInventory.setStorageSectionId(materialInventoryParamDO.getStorageSectionId()); + //更多属性 +// materialInventory.setBatchRefNo(materialInventoryParamDO.getBatchRefNo()); +// materialInventory.setSheetRefNo(materialInventoryParamDO.getSheetRefNo()); +// materialInventory.setBoxPalletNo(materialInventoryParamDO.getBoxPalletNo()); +// materialInventory.setProductionDate(materialInventoryParamDO.getProductionDate()); +// materialInventory.setExtAttr1(materialInventoryParamDO.getExtAttr1()); +// materialInventory.setExtAttr2(materialInventoryParamDO.getExtAttr2()); +// materialInventory.setExtAttr3(materialInventoryParamDO.getExtAttr3()); +// materialInventory.setExtAttr4(materialInventoryParamDO.getExtAttr4()); +// materialInventory.setExpiryDate(materialInventoryParamDO.getExpiryDate()); +// materialInventory.setInventoryDate(materialInventoryParamDO.getInventoryDate()); + materialInventory.setBatchNumber(materialInventoryParamDO.getBatchNumber()); + materialInventory.setUnit(materialBaseInfo.getUnitCode()); + materialInventory.setUnitName(materialBaseInfo.getUnitName()); + //创建人信息 + materialInventory.setCreateBy(materialInventoryParamDO.getCreateBy()); + materialInventory.setCreateByName(materialInventoryParamDO.getCreateByName()); + materialInventory.setCreateTime(new Date()); + materialInventory.setUpdateTime(new Date()); + materialInventory.setBarCode(materialInventoryParamDO.getBarCode()); + materialInventory.setLotNumber(materialInventoryParamDO.getLotNumber()); + materialInventory.setBatchNumber((materialInventoryParamDO.getBatchNumber())); + materialInventory.setInOrderNumber((materialInventoryParamDO.getInOrderNumber())); + materialInventoryMapper.insert(materialInventory); + materialInventoryParamDO.setMaterialInventoryId(materialInventory.getMaterialInventoryId()); + } else { + ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId); + if (materialInventoryPO != null) { + //库存数量 + BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity(); + oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO; + //可用数量 + BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity(); + oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO; + //冻结数量(出库交接不变动冻结数量) + BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity(); + oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO; + //扣减后库存数量 + BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity); + //扣减后可用数量 + BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity); + BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity); + + + + BigDecimal oldArea = materialInventoryPO.getArea(); + BigDecimal oldVolume = materialInventoryPO.getVolume(); + BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight(); + BigDecimal oldNetWeight = materialInventoryPO.getNetWeight(); + + // 初始化旧数据,避免空指针 + oldArea = oldArea != null ? oldArea : BigDecimal.ZERO; + oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO; + oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO; + oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO; + + BigDecimal newArea = oldArea.add(area); + BigDecimal newVolume = oldVolume.add(volume); + BigDecimal newGrossWeight = oldGrossWeight.add(grossWeight); + BigDecimal newNetWeight = oldNetWeight.add(netWeight); + + materialInventoryPO.setInventoryQuantity(newInventoryQuantity); + //materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity()); + materialInventoryPO.setFreezeQuantity(newFreezeQuantity); + materialInventoryPO.setArea(newArea); + materialInventoryPO.setVolume(newVolume); + materialInventoryPO.setGrossWeight(newGrossWeight); + materialInventoryPO.setNetWeight(newNetWeight); + materialInventoryPO.setUpdateTime(new Date()); + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory); + materialInventoryMapper.updateById(materialInventory); + } + } + } + private void ff(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) { + ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId); + if (materialInventoryPO != null) { + //库存数量 + BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity(); + oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO; + //可用数量 + BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity(); + oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO; + //冻结数量(出库交接不变动冻结数量) + BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity(); + oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO; + //扣减后库存数量 + BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity); + //扣减后可用数量 + BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity); + BigDecimal newFreezeQuantity = oldFreezeQuantity.add(quantity); + + + + BigDecimal oldArea = materialInventoryPO.getArea(); + BigDecimal oldVolume = materialInventoryPO.getVolume(); + BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight(); + BigDecimal oldNetWeight = materialInventoryPO.getNetWeight(); + + // 初始化旧数据,避免空指针 + oldArea = oldArea != null ? oldArea : BigDecimal.ZERO; + oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO; + oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO; + oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO; + + BigDecimal newArea = oldArea.subtract(area); + BigDecimal newVolume = oldVolume.subtract(volume); + BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight); + BigDecimal newNetWeight = oldNetWeight.subtract(netWeight); + + //materialInventoryPO.setInventoryQuantity(newInventoryQuantity); + materialInventoryPO.setAllocationQuantity(newAllocationQuantity); + materialInventoryPO.setFreezeQuantity(newFreezeQuantity); + materialInventoryPO.setArea(newArea); + materialInventoryPO.setVolume(newVolume); + materialInventoryPO.setGrossWeight(newGrossWeight); + materialInventoryPO.setNetWeight(newNetWeight); + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + materialInventoryPO.setUpdateTime(new Date()); + com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory); + materialInventoryMapper.updateById(materialInventory); + } + } + private void qxff(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) { + ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId); + if (materialInventoryPO != null) { + //库存数量 + BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity(); + oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO; + //可用数量 + BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity(); + oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO; + //冻结数量(出库交接不变动冻结数量) + BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity(); + oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO; + //扣减后库存数量 + BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity); + //扣减后可用数量 + BigDecimal newAllocationQuantity = oldAllocationQuantity.add(quantity); + BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity); + + + + BigDecimal oldArea = materialInventoryPO.getArea(); + BigDecimal oldVolume = materialInventoryPO.getVolume(); + BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight(); + BigDecimal oldNetWeight = materialInventoryPO.getNetWeight(); + + // 初始化旧数据,避免空指针 + oldArea = oldArea != null ? oldArea : BigDecimal.ZERO; + oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO; + oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO; + oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO; + + BigDecimal newArea = oldArea.subtract(area); + BigDecimal newVolume = oldVolume.subtract(volume); + BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight); + BigDecimal newNetWeight = oldNetWeight.subtract(netWeight); + + //materialInventoryPO.setInventoryQuantity(newInventoryQuantity); + materialInventoryPO.setAllocationQuantity(newAllocationQuantity); + materialInventoryPO.setFreezeQuantity(newFreezeQuantity); + materialInventoryPO.setArea(newArea); + materialInventoryPO.setVolume(newVolume); + materialInventoryPO.setGrossWeight(newGrossWeight); + materialInventoryPO.setNetWeight(newNetWeight); + materialInventoryPO.setUpdateTime(new Date()); + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory); + materialInventoryMapper.updateById(materialInventory); + } + } + private void ckjj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) { + ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId); + if (materialInventoryPO != null) { + //库存数量 + BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity(); + oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO; + //可用数量 + BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity(); + oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO; + //冻结数量(出库交接不变动冻结数量) + BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity(); + oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO; + //扣减后库存数量 + BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity); + //扣减后可用数量 + BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity); + BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity); + + + + BigDecimal oldArea = materialInventoryPO.getArea(); + BigDecimal oldVolume = materialInventoryPO.getVolume(); + BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight(); + BigDecimal oldNetWeight = materialInventoryPO.getNetWeight(); + + // 初始化旧数据,避免空指针 + oldArea = oldArea != null ? oldArea : BigDecimal.ZERO; + oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO; + oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO; + oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO; + + BigDecimal newArea = oldArea.subtract(area); + BigDecimal newVolume = oldVolume.subtract(volume); + BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight); + BigDecimal newNetWeight = oldNetWeight.subtract(netWeight); + + materialInventoryPO.setInventoryQuantity(newInventoryQuantity); + //materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity()); + materialInventoryPO.setFreezeQuantity(newFreezeQuantity); + materialInventoryPO.setArea(newArea); + materialInventoryPO.setVolume(newVolume); + materialInventoryPO.setGrossWeight(newGrossWeight); + materialInventoryPO.setNetWeight(newNetWeight); + materialInventoryPO.setUpdateTime(new Date()); + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory); + materialInventoryMapper.updateById(materialInventory); + } + } + private void yw(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) { + ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId); + if (materialInventoryPO != null) { + //库存数量 + BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity(); + oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO; + //可用数量 + BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity(); + oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO; + //冻结数量(出库交接不变动冻结数量) + BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity(); + oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO; + //扣减后库存数量 + BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity); + //扣减后可用数量 + BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity); + BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity); + + + + BigDecimal oldArea = materialInventoryPO.getArea(); + BigDecimal oldVolume = materialInventoryPO.getVolume(); + BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight(); + BigDecimal oldNetWeight = materialInventoryPO.getNetWeight(); + + // 初始化旧数据,避免空指针 + oldArea = oldArea != null ? oldArea : BigDecimal.ZERO; + oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO; + oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO; + oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO; + + BigDecimal newArea = oldArea.subtract(area); + BigDecimal newVolume = oldVolume.subtract(volume); + BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight); + BigDecimal newNetWeight = oldNetWeight.subtract(netWeight); + + materialInventoryPO.setInventoryQuantity(newInventoryQuantity); + //materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity()); + materialInventoryPO.setFreezeQuantity(newFreezeQuantity); + materialInventoryPO.setArea(newArea); + materialInventoryPO.setVolume(newVolume); + materialInventoryPO.setGrossWeight(newGrossWeight); + materialInventoryPO.setNetWeight(newNetWeight); + materialInventoryPO.setUpdateTime(new Date()); + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory); + materialInventoryMapper.updateById(materialInventory); + } + } + private void kctz(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) { + ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId); + if (materialInventoryPO != null) { + //库存数量 + BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity(); + oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO; + //可用数量 + BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity(); + oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO; + //冻结数量(出库交接不变动冻结数量) + BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity(); + oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO; + //扣减后库存数量 + BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity); + //扣减后可用数量 + BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity); + BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity); + + + + BigDecimal oldArea = materialInventoryPO.getArea(); + BigDecimal oldVolume = materialInventoryPO.getVolume(); + BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight(); + BigDecimal oldNetWeight = materialInventoryPO.getNetWeight(); + + // 初始化旧数据,避免空指针 + oldArea = oldArea != null ? oldArea : BigDecimal.ZERO; + oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO; + oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO; + oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO; + + BigDecimal newArea = oldArea.subtract(area); + BigDecimal newVolume = oldVolume.subtract(volume); + BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight); + BigDecimal newNetWeight = oldNetWeight.subtract(netWeight); + + materialInventoryPO.setInventoryQuantity(newInventoryQuantity); + //materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity()); + materialInventoryPO.setFreezeQuantity(newFreezeQuantity); + materialInventoryPO.setArea(newArea); + materialInventoryPO.setVolume(newVolume); + materialInventoryPO.setGrossWeight(newGrossWeight); + materialInventoryPO.setNetWeight(newNetWeight); + materialInventoryPO.setUpdateTime(new Date()); + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory); + materialInventoryMapper.updateById(materialInventory); + } + } + private void kcdj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) { + ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId); + if (materialInventoryPO != null) { + //库存数量 + BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity(); + oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO; + //可用数量 + BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity(); + oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO; + //冻结数量(出库交接不变动冻结数量) + BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity(); + oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO; + //扣减后库存数量 + BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity); + //扣减后可用数量 + BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity); + BigDecimal newFreezeQuantity = oldFreezeQuantity.add(quantity); + + + + BigDecimal oldArea = materialInventoryPO.getArea(); + BigDecimal oldVolume = materialInventoryPO.getVolume(); + BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight(); + BigDecimal oldNetWeight = materialInventoryPO.getNetWeight(); + + // 初始化旧数据,避免空指针 + oldArea = oldArea != null ? oldArea : BigDecimal.ZERO; + oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO; + oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO; + oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO; + + BigDecimal newArea = oldArea.subtract(area); + BigDecimal newVolume = oldVolume.subtract(volume); + BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight); + BigDecimal newNetWeight = oldNetWeight.subtract(netWeight); + + //materialInventoryPO.setInventoryQuantity(newInventoryQuantity); + materialInventoryPO.setAllocationQuantity(newAllocationQuantity); + materialInventoryPO.setFreezeQuantity(newFreezeQuantity); + materialInventoryPO.setArea(newArea); + materialInventoryPO.setVolume(newVolume); + materialInventoryPO.setGrossWeight(newGrossWeight); + materialInventoryPO.setNetWeight(newNetWeight); + materialInventoryPO.setUpdateTime(new Date()); + ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); + com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory); + materialInventoryMapper.updateById(materialInventory); + } + } +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/po/ReservationMaterialInventoryPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/po/ReservationMaterialInventoryPO.java new file mode 100644 index 000000000..0ad83ba4d --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/po/ReservationMaterialInventoryPO.java @@ -0,0 +1,228 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.po; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBasePO; +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; + + +/** + * 物料库存对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +@ApiModel(value = "物料库存对象", description = "物料库存响应对象") +public class ReservationMaterialInventoryPO extends MaterialBasePO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料库存id") + private Long materialInventoryId; + + @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 materialDetailId; + + @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 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("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @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("库存数量") + @Excel(name = "库存数量") + private BigDecimal inventoryQuantity; + + @ApiModelProperty("可用数量") + @Excel(name = "可用数量") + private BigDecimal allocationQuantity; + + @ApiModelProperty("冻结数量") + @Excel(name = "冻结数量") + private BigDecimal freezeQuantity; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("盘点是否可用:0-禁用 1-可用") + @Excel(name = "盘点是否可用:0-禁用 1-可用") + private Integer isAble; + + + @ApiModelProperty("单位") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("净重(KG)") + @Excel(name = "净重(KG)") + private BigDecimal netWeight; + + @ApiModelProperty("毛重(KG)") + @Excel(name = "毛重(KG)") + private BigDecimal grossWeight; + + @ApiModelProperty("体积") + @Excel(name = "体积") + private BigDecimal volume; + + @ApiModelProperty("面积") + @Excel(name = "面积") + private BigDecimal area; + + + @ApiModelProperty("Batch Ref NO's") + @Excel(name = "Batch Ref NO's") + private String batchRefNo; + + @ApiModelProperty("Sheet Ref NO's") + @Excel(name = "Sheet Ref NO's") + private String sheetRefNo; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("扩展字段1") + @Excel(name = "扩展字段1") + private String extAttr1; + + @ApiModelProperty("扩展字段2") + @Excel(name = "扩展字段2") + private String extAttr2; + + @ApiModelProperty("生产日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date productionDate; + + @ApiModelProperty("过期日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expiryDate; + + @ApiModelProperty("存货日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date inventoryDate; + + @ApiModelProperty("ExtAttr3") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr3; + + @ApiModelProperty("ExtAttr4") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr4; + + + @ApiModelProperty("包装名") + @Excel(name = "包装名") + private String packName; + + + @ApiModelProperty("单位名") + @Excel(name = "单位名") + private String unitName; + + @ApiModelProperty("条码") + @Excel(name = "条码") + private String barCode; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("LOT编号") + @Excel(name = "LOT编号") + private String lotNumber; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/po/ReservationMaterialInventoryQueryListPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/po/ReservationMaterialInventoryQueryListPO.java new file mode 100644 index 000000000..9e3d67792 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/po/ReservationMaterialInventoryQueryListPO.java @@ -0,0 +1,289 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.po; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBasePO; +import com.mhd.system.api.domain.MaterialMoreDetailPO; +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; + + +/** + * 库存查询对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +@ApiModel(value = "库存查询对象", description = "库存查询响应对象") +public class ReservationMaterialInventoryQueryListPO extends MaterialBasePO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料库存id") + private Long materialInventoryId; + + @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 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("包装规格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 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("移入库位id,供 PDA 底部表单区填写") + private Long newStorageLocationId; + + @ApiModelProperty("移入库位编码,供 PDA 底部表单区填写") + private String newStorageLocationCode; + + @ApiModelProperty("移入库位名称,供 PDA 底部表单区显示") + private String newStorageLocationName; + + @ApiModelProperty("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("批号/LOT") + @Excel(name = "批号") + private String lotNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @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("库存数量") + @Excel(name = "库存数量") + private BigDecimal inventoryQuantity; + + @ApiModelProperty("可用数量") + @Excel(name = "可用数量") + private BigDecimal allocationQuantity; + + @ApiModelProperty("移位数量,供 PDA 底部表单区显示,库存查询时等于可用数量") + @Excel(name = "移位数量") + private BigDecimal shiftQuantity; + + @ApiModelProperty("冻结数量") + @Excel(name = "冻结数量") + private BigDecimal freezeQuantity; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("盘点是否可用:0-禁用 1-可用") + @Excel(name = "盘点是否可用:0-禁用 1-可用") + private Integer isAble; + + + @ApiModelProperty("单位") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("单位名称") + @Excel(name = "单位名称") + private String unitName; + + @ApiModelProperty("净重(KG)") + @Excel(name = "净重(KG)") + private BigDecimal netWeight; + + @ApiModelProperty("毛重(KG)") + @Excel(name = "毛重(KG)") + private BigDecimal grossWeight; + + @ApiModelProperty("体积") + @Excel(name = "体积") + private BigDecimal volume; + + @ApiModelProperty("面积") + @Excel(name = "面积") + private BigDecimal area; + + + @ApiModelProperty("Batch Ref NO's") + @Excel(name = "Batch Ref NO's") + private String batchRefNo; + + @ApiModelProperty("Sheet Ref NO's") + @Excel(name = "Sheet Ref NO's") + private String sheetRefNo; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("扩展字段1") + @Excel(name = "扩展字段1") + private String extAttr1; + + @ApiModelProperty("扩展字段2") + @Excel(name = "扩展字段2") + private String extAttr2; + + @ApiModelProperty("生产日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date productionDate; + + @ApiModelProperty("过期日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expiryDate; + + @ApiModelProperty("存货日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date inventoryDate; + + @ApiModelProperty("ExtAttr3") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr3; + + @ApiModelProperty("ExtAttr4") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr4; + + + @ApiModelProperty("层级深度,与移位详情一致:1-主项 2-子项") + private Integer level; + + @ApiModelProperty("业务唯一id,与移位详情一致") + private Long uniqueId; + + @ApiModelProperty("父级唯一Id,子项时使用") + private Long parentUniqueId; + + @ApiModelProperty("子项列表,与移位详情一致,主项下含一条 parent_copy 子项") + private List children; + + @ApiModelProperty("总净重(KG),PDA 表单区显示") + private BigDecimal totalNetWeight; + + @ApiModelProperty("总毛重(KG),PDA 表单区显示") + private BigDecimal totalGrossWeight; + + @ApiModelProperty("总体积(CBM),PDA 表单区显示") + private BigDecimal totalVolume; + + @ApiModelProperty("总面积(SQM),PDA 表单区显示") + private BigDecimal totalArea; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBarCodePO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBarCodePO.java new file mode 100644 index 000000000..e5c9ae447 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBarCodePO.java @@ -0,0 +1,81 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +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_bar_code + * + * @author gen + * @date 2024-05-07 + */ + +@Data +@ApiModel(value = "物料条码信息对象", description = "物料条码信息响应对象") +public class MaterialBarCodePO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("商品规则id") + private Long materialBarCodeId; + + @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("条码") + @Excel(name = "条码") + private String barCode; + + @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 name; + + @ApiModelProperty("数量") + @Excel(name = "数量") + private BigDecimal number; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseDO.java new file mode 100644 index 000000000..13acabd26 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseDO.java @@ -0,0 +1,73 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +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.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @author ZhouGY + * @title MaterialBaseDO + * @description: TODO + * @date 2024/7/5 10:59 + **/ +@EqualsAndHashCode(callSuper = true) +@Data +public class MaterialBaseDO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @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("物料分类编码") + @Excel(name = "物料分类编码") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyCode; + + @ApiModelProperty("物料分类名称") + @Excel(name = "物料分类名称") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyName; + + @ApiModelProperty("物料种类编码 数据字典") + @Excel(name = "物料种类编码 数据字典") + private String materialType; + + @ApiModelProperty("物料种类名称 数据字典") + @Excel(name = "物料种类名称 数据字典") + private String materialTypeName; + + @ApiModelProperty("货主信息") + @Excel(name = "货主信息") + private String shipperInfo; + + @ApiModelProperty("物料信息") + @Excel(name = "物料信息") + private String materialInfo; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseDTO.java new file mode 100644 index 000000000..08d6ea497 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseDTO.java @@ -0,0 +1,61 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +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.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @author ZhouGY + * @title MaterialBaseDO + * @description: TODO + * @date 2024/7/5 10:59 + **/ +@EqualsAndHashCode(callSuper = true) +@Data +public class MaterialBaseDTO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("货主id") + @Excel(name = "货主id") + private Long shipperId; + + @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("物料分类编码") + @Excel(name = "物料分类编码") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyCode; + + @ApiModelProperty("物料分类名称") + @Excel(name = "物料分类名称") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyName; + + @ApiModelProperty("物料种类编码 数据字典") + @Excel(name = "物料种类编码 数据字典") + private String materialType; + + @ApiModelProperty("物料种类名称 数据字典") + @Excel(name = "物料种类名称 数据字典") + private String materialTypeName; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseInfo.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseInfo.java new file mode 100644 index 000000000..4faf81b74 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseInfo.java @@ -0,0 +1,207 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +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.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + + +/** + * 物料基础信息对象 material_base_info + * + * @author gen + * @date 2024-05-07 + */ + +//@TableName(value = "material_base_info", autoResultMap = true) +@Data +public class MaterialBaseInfo extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料基础信息id") + @TableId(type = IdType.AUTO) + 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("物料分类id") + @Excel(name = "物料分类id") + private String materialClassifyId; + + @ApiModelProperty("物料条形码") + @Excel(name = "物料条形码") + private String barCode; + + @ApiModelProperty("物料分类编码") + @Excel(name = "物料分类编码") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyCode; + + @ApiModelProperty("物料分类名称") + @Excel(name = "物料分类名称") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyName; + + @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("是否公用: 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("是否抄码: 1-是 2-否") + @Excel(name = "是否抄码: 1-是 2-否") + @TableField("copy_code") + private Integer copyCode; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseInfoDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseInfoDTO.java new file mode 100644 index 000000000..e997694b1 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBaseInfoDTO.java @@ -0,0 +1,261 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +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.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 物料基础信息对象 material_base_info + * + * @author gen + * @date 2024-05-07 + */ + +@Data +public class MaterialBaseInfoDTO 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("物料分类编码") + @Excel(name = "物料分类编码") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyCode; + + @ApiModelProperty("物料分类名称") + @Excel(name = "物料分类名称") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyName; + @ApiModelProperty("物料分类(导入)") + @Excel(name = "物料分类") + private String materialClassifyImport; + + @ApiModelProperty("物料种类编码 数据字典") + @Excel(name = "物料种类编码 数据字典") + private String materialType; + + @ApiModelProperty("物料种类名称 数据字典") + @Excel(name = "物料种类名称 数据字典") + private String materialTypeName; + @ApiModelProperty("物料种类(导入)") + @Excel(name = "物料种类") + private String materialTypeImport; + + @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 packImport; + + @ApiModelProperty("包装单位编码") + @Excel(name = "包装单位编码") + private String unitCode; + + @ApiModelProperty("包装单位名称") + @Excel(name = "包装单位名称") + private String unitName; + @ApiModelProperty("物料单位(导入)") + @Excel(name = "物料单位") + private String unitImport; + @ApiModelProperty("单位(导入)") + @Excel(name = "单位") + private String unitImport2; + + @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(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; +// +// @ApiModelProperty("商品规则") +// private MaterialGoodsRuleDO materialGoodsRule; +// +// @ApiModelProperty("公共信息") +// private MaterialCommonDTO materialCommon; +// +// @ApiModelProperty("仓库控制信息") +// private MaterialWarehouseControlDTO materialWarehouseControl; +// +// @ApiModelProperty("库存预警信息") +// private List materialInventoryWarningList; +// +// @ApiModelProperty("条码信息") +// private List materialBarCodeList; + + @ApiModelProperty("复合条件查询 物料名称 物料编码 物料条码") + private String compoundOrQuery; + + @ApiModelProperty("feign 是否是修改: 1-是 2-否") + private Integer updateFeign; + + @ApiModelProperty("是否公用: 1-是 2-否") + @Excel(name = "是否公用: 1-是 2-否") + private Integer common; + + @ApiModelProperty("SKU码") + @Excel(name = "SKU码") + private String skuCode; + + @ApiModelProperty("单价") + @Excel(name = "单价") + private BigDecimal unitPrice; + + @ApiModelProperty("币制") + @Excel(name = "币制") + private String currency; + + @ApiModelProperty("原产国") + @Excel(name = "原产国") + private String originCountry; + + @ApiModelProperty("HS码") + @Excel(name = "HS码") + private String hsCode; + @ApiModelProperty("HS编码(导入)") + @Excel(name = "HS编码") + private String hsCodeImport; + + @ApiModelProperty("申报单位") + @Excel(name = "申报单位") + private String declarationUnit; + + @ApiModelProperty("法定单位") + @Excel(name = "法定单位") + private String statutoryUnit; + + @ApiModelProperty("法定第二单位") + @Excel(name = "法定第二单位") + private String statutorySecondUnit; + + @ApiModelProperty("规格型号") + @Excel(name = "规格型号") + private String specificationModel; + + @ApiModelProperty("批次ID") + private Long batchId; + + @ApiModelProperty("批次规则(导入:批次名称)") + @Excel(name = "批次规则") + private String batchRuleNameImport; + + @ApiModelProperty("批次名称(导入)") + @Excel(name = "批次名称") + private String batchName; + + @ApiModelProperty("批次(导入)") + @Excel(name = "批次") + private String batchImport; + + @ApiModelProperty("是否抄码: 1-是 2-否") + @Excel(name = "是否抄码: 1-是 2-否") + private Integer copyCode; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBasePO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBasePO.java new file mode 100644 index 000000000..929d0cd9f --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialBasePO.java @@ -0,0 +1,65 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +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.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @author ZhouGY + * @title MaterialBaseDO + * @description: TODO + * @date 2024/7/5 10:59 + **/ +@EqualsAndHashCode(callSuper = true) +@Data +public class MaterialBasePO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @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("物料分类编码") + @Excel(name = "物料分类编码") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyCode; + + @ApiModelProperty("物料分类名称") + @Excel(name = "物料分类名称") + @TableField(typeHandler = ListTypeHandler.class) + private List materialClassifyName; + + @ApiModelProperty("物料种类编码 数据字典") + @Excel(name = "物料种类编码 数据字典") + private String materialType; + + @ApiModelProperty("物料种类名称 数据字典") + @Excel(name = "物料种类名称 数据字典") + private String materialTypeName; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryParamDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryParamDO.java new file mode 100644 index 000000000..d488e4718 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryParamDO.java @@ -0,0 +1,102 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + + +/** + * 物料库存对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +public class MaterialInventoryParamDO extends MaterialBaseDO { + private static final long serialVersionUID = 1L; + //库存id + private Long materialInventoryId; + //物料基础信息id + private Long materialBaseInfoId; + //物料明细ID + private Long materialDetailId; + + //仓库信息参数 + private Long organizationId; + private String organizationName; + private Long topOrganizationId; + //仓库ID + private Long warehouseId; + //仓库编码 + private String warehouseCode; + //仓库名称 + private String warehouseName; + //存储区ID + private Long storageSectionId; + //存储区编码 + private String storageCode; + //存储区名称 + private String storageName; + //存储位置ID + private Long storageLocationId; + //存储位置编码 + private String storageLocationCode; + //存储位置名称 + private String storageLocationName; + + + //调整参数 + + //调整数量 + private BigDecimal quantity; + //净重 + private BigDecimal netWeight; + //毛重 + private BigDecimal grossWeight; + //体积 + private BigDecimal volume; + //面积 + private BigDecimal area; + //类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结) + private String type; + + private String barCode; + + + + + //更多属性 + private String batchRefNo; + private String sheetRefNo; + //箱码 + private String boxPalletNo; + //扩展字段2 + private String extAttr1; + //扩展字段1 + private String extAttr2; + //生产日期 + private Date productionDate; + //过期日期 + private Date expiryDate; + //库存日期 + private Date inventoryDate; + //扩展字段3 + private Date extAttr3; + //扩展字段4 + private Date extAttr4; + + + private String inOrderNumber; + + private String lotNumber; + + private String batchNumber; + + private String isNew; + + /** 业务关联单号(出库单号、交接单对应单号等),用于库存调整记录 relate_no;可与入库单号区分 */ + private String relateNo; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryParentDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryParentDO.java new file mode 100644 index 000000000..cee146fd3 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryParentDO.java @@ -0,0 +1,23 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +/** + * 物料库存对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +public class MaterialInventoryParentDO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料库存对象") + private List materialInventoryDOList; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryQueryListDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryQueryListDO.java new file mode 100644 index 000000000..b757c551b --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryQueryListDO.java @@ -0,0 +1,255 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +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; + + +/** + * 物料库存对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +public class MaterialInventoryQueryListDO extends MaterialBaseDO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料库存id") + private Long materialInventoryId; + + @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 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("仓库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 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("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @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("库存数量") + @Excel(name = "库存数量") + private BigDecimal inventoryQuantity; + + @ApiModelProperty("可用数量") + @Excel(name = "可用数量") + private BigDecimal allocationQuantity; + + @ApiModelProperty("冻结数量") + @Excel(name = "冻结数量") + private BigDecimal freezeQuantity; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty("盘点是否可用:0-禁用 1-可用") + @Excel(name = "盘点是否可用:0-禁用 1-可用") + private Integer isAble; + + @ApiModelProperty("查询类型 0-全部查询 1-按货主查询 2-按物料查询 3-按批次查询 4-按库位查询 5-按物料/库位查询 6-按容器查询") + @Excel(name = "查询类型 0-全部查询 1-按货主查询 2-按物料查询 3-按批次查询 4-按库位查询 5-按物料/库位查询 6-按容器查询") + private Integer queryType; + + @ApiModelProperty("货主信息") + @Excel(name = "货主信息") + private String shipperInfo; + + @ApiModelProperty("物料信息") + @Excel(name = "物料信息") + private String materialInfo; + + @ApiModelProperty("物料/库位信息") + @Excel(name = "物料/库位信息") + private String storageInfo; + + @ApiModelProperty("容器号或批次号,输入后同时按容器号、批次号模糊匹配") + @Excel(name = "容器号或批次号") + private String containerOrBatch; + + @ApiModelProperty("单位") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("单位名称") + @Excel(name = "单位名称") + private String unitName; + + @ApiModelProperty("净重(KG)") + @Excel(name = "净重(KG)") + private BigDecimal netWeight; + + @ApiModelProperty("毛重(KG)") + @Excel(name = "毛重(KG)") + private BigDecimal grossWeight; + + @ApiModelProperty("体积") + @Excel(name = "体积") + private BigDecimal volume; + + @ApiModelProperty("面积") + @Excel(name = "面积") + private BigDecimal area; + + @ApiModelProperty("Batch Ref NO's") + @Excel(name = "Batch Ref NO's") + private String batchRefNo; + + @ApiModelProperty("Sheet Ref NO's") + @Excel(name = "Sheet Ref NO's") + private String sheetRefNo; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("扩展字段1") + @Excel(name = "扩展字段1") + private String extAttr1; + + @ApiModelProperty("扩展字段2") + @Excel(name = "扩展字段2") + private String extAttr2; + + @ApiModelProperty("生产日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date productionDate; + + @ApiModelProperty("过期日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expiryDate; + + @ApiModelProperty("存货日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date inventoryDate; + + @ApiModelProperty("ExtAttr3") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr3; + + @ApiModelProperty("ExtAttr4") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr4; + + @ApiModelProperty("订单物料明细id") + private Long materialDetailId; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryQueryListDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryQueryListDTO.java new file mode 100644 index 000000000..d04f90f92 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/MaterialInventoryQueryListDTO.java @@ -0,0 +1,186 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +import com.mhd.common.core.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 物料库存对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +public class MaterialInventoryQueryListDTO extends MaterialBaseDTO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料库存id") + private Long materialInventoryId; + + @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 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("仓库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 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("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @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("库存数量") + @Excel(name = "库存数量") + private BigDecimal inventoryQuantity; + + @ApiModelProperty("可用数量") + @Excel(name = "可用数量") + private BigDecimal allocationQuantity; + + @ApiModelProperty("冻结数量") + @Excel(name = "冻结数量") + private BigDecimal freezeQuantity; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty("盘点是否可用:0-禁用 1-可用") + @Excel(name = "盘点是否可用:0-禁用 1-可用") + private Integer isAble; + + @ApiModelProperty("查询类型 0-全部查询 1-按货主查询 2-按物料查询 3-按批次查询 4-按库位查询 5-按物料/库位查询 6-按容器查询") + @Excel(name = "查询类型 0-全部查询 1-按货主查询 2-按物料查询 3-按批次查询 4-按库位查询 5-按物料/库位查询 6-按容器查询") + private Integer queryType; + + @ApiModelProperty("货主信息") + @Excel(name = "货主信息") + private String shipperInfo; + + @ApiModelProperty("物料信息") + @Excel(name = "物料信息") + private String materialInfo; + + @ApiModelProperty("物料/库位信息") + @Excel(name = "物料/库位信息") + private String storageInfo; + + @ApiModelProperty("容器号或批次号,输入后同时按容器号、批次号模糊匹配") + @Excel(name = "容器号或批次号") + private String containerOrBatch; + + @ApiModelProperty("Batch Ref NO's") + @Excel(name = "Batch Ref NO's") + private String batchRefNo; + + @ApiModelProperty("Sheet Ref NO's") + @Excel(name = "Sheet Ref NO's") + private String sheetRefNo; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/ReservationMaterialInventoryDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/ReservationMaterialInventoryDO.java new file mode 100644 index 000000000..fcd0afe63 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/ReservationMaterialInventoryDO.java @@ -0,0 +1,246 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +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; + + +/** + * 物料库存对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +public class ReservationMaterialInventoryDO extends MaterialBaseDO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料库存id") + private Long materialInventoryId; + + @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 materialDetailId; + + @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 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("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @ApiModelProperty("容器id") + @Excel(name = "容器id") + private Long containerId; + + @ApiModelProperty("容器编码") + @Excel(name = "容器编码") + private String containerCode; + + @ApiModelProperty("容器号或批次号(PDA单输入框模糊查询,优先于 batchNumber/containerCode 单独传参)") + private String containerOrBatch; + + @ApiModelProperty("容器类型 数据字典") + @Excel(name = "容器类型 数据字典") + private String containerType; + + @ApiModelProperty("容器类型名称 数据字典") + @Excel(name = "容器类型名称 数据字典") + private String containerTypeName; + + @ApiModelProperty("库存数量") + @Excel(name = "库存数量") + private BigDecimal inventoryQuantity; + + @ApiModelProperty("可用数量") + @Excel(name = "可用数量") + private BigDecimal allocationQuantity; + + @ApiModelProperty("冻结数量") + @Excel(name = "冻结数量") + private BigDecimal freezeQuantity; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty("盘点是否可用:0-禁用 1-可用") + @Excel(name = "盘点是否可用:0-禁用 1-可用") + private Integer isAble; + + @ApiModelProperty("货主信息") + @Excel(name = "货主信息") + private String shipperInfo; + + @ApiModelProperty("物料信息") + @Excel(name = "物料信息") + private String materialInfo; + + @ApiModelProperty("物料/库位信息") + @Excel(name = "物料/库位信息") + private String storageInfo; + + + @ApiModelProperty("单位") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("单位名称") + @Excel(name = "单位名称") + private String unitName; + + @ApiModelProperty("净重(KG)") + @Excel(name = "净重(KG)") + private BigDecimal netWeight; + + @ApiModelProperty("毛重(KG)") + @Excel(name = "毛重(KG)") + private BigDecimal grossWeight; + + @ApiModelProperty("体积") + @Excel(name = "体积") + private BigDecimal volume; + + @ApiModelProperty("面积") + @Excel(name = "面积") + private BigDecimal area; + + @ApiModelProperty("货主id") + private Long shipperId; + + + @ApiModelProperty("Batch Ref NO's") + @Excel(name = "Batch Ref NO's") + private String batchRefNo; + + @ApiModelProperty("Sheet Ref NO's") + @Excel(name = "Sheet Ref NO's") + private String sheetRefNo; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + + @ApiModelProperty("扩展字段1") + @Excel(name = "扩展字段1") + private String extAttr1; + + @ApiModelProperty("扩展字段2") + @Excel(name = "扩展字段2") + private String extAttr2; + + @ApiModelProperty("生产日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date productionDate; + + @ApiModelProperty("过期日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date expiryDate; + + @ApiModelProperty("存货日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date inventoryDate; + + @ApiModelProperty("ExtAttr3") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr3", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr3; + + @ApiModelProperty("ExtAttr4") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "ExtAttr4", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date extAttr4; + + //查询规则 hz:货主,wl:物料,kw:库位,wlkw:物料库位,all:全部 + private String queryRule; + + @ApiModelProperty("冻结数量大于0条件") + @Excel(name = "冻结数量大于0条件") + private String greaterThanFreezeQuantity; + + @ApiModelProperty("入库单号") + @Excel(name = "入库单号") + private String inOrderNumber; + + @ApiModelProperty("LOT编号") + @Excel(name = "LOT编号") + private String lotNumber; +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/ReservationMaterialInventoryDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/ReservationMaterialInventoryDTO.java new file mode 100644 index 000000000..1a5521eaa --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/repository/todo/ReservationMaterialInventoryDTO.java @@ -0,0 +1,187 @@ +package com.mhd.oms.domain.reservationMaterialInventory.repository.todo; + +import com.mhd.common.core.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 物料库存对象 material_inventory + * + * @author gen + * @date 2024-05-29 + */ + +@Data +public class ReservationMaterialInventoryDTO extends MaterialBaseDTO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物料库存id") + private Long materialInventoryId; + + @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 materialDetailId; + + @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 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("批次号") + @Excel(name = "批次号") + private String batchNumber; + + @ApiModelProperty("物料状态编码") + @Excel(name = "物料状态编码") + private String materialStatusCode; + + @ApiModelProperty("物料状态名称") + @Excel(name = "物料状态名称") + private String materialStatusName; + + @ApiModelProperty("容器id") + @Excel(name = "容器id") + private Long containerId; + + @ApiModelProperty("容器编码") + @Excel(name = "容器编码") + private String containerCode; + + @ApiModelProperty("容器号或批次号(PDA单输入框模糊查询,优先于 batchNumber/containerCode 单独传参)") + private String containerOrBatch; + + @ApiModelProperty("容器类型 数据字典") + @Excel(name = "容器类型 数据字典") + private String containerType; + + @ApiModelProperty("容器类型名称 数据字典") + @Excel(name = "容器类型名称 数据字典") + private String containerTypeName; + + @ApiModelProperty("库存数量") + @Excel(name = "库存数量") + private BigDecimal inventoryQuantity; + + @ApiModelProperty("可用数量") + @Excel(name = "可用数量") + private BigDecimal allocationQuantity; + + @ApiModelProperty("冻结数量") + @Excel(name = "冻结数量") + private BigDecimal freezeQuantity; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty("盘点是否可用:0-禁用 1-可用") + @Excel(name = "盘点是否可用:0-禁用 1-可用") + private Integer isAble; + + @ApiModelProperty("货主信息") + @Excel(name = "货主信息") + private String shipperInfo; + + @ApiModelProperty("物料信息") + @Excel(name = "物料信息") + private String materialInfo; + + @ApiModelProperty("物料/库位信息") + @Excel(name = "物料/库位信息") + private String storageInfo; + + @ApiModelProperty("货主id") + private Long shipperId; + + @ApiModelProperty("Batch Ref NO's") + @Excel(name = "Batch Ref NO's") + private String batchRefNo; + + @ApiModelProperty("Sheet Ref NO's") + @Excel(name = "Sheet Ref NO's") + private String sheetRefNo; + + @ApiModelProperty("箱号/卡板号") + @Excel(name = "箱号/卡板号") + private String boxPalletNo; + //查询规则 hz:货主,wl:物料,kw:库位,wlkw:物料库位,all:全部 + private String queryRule; + + @ApiModelProperty("净重(KG)") + @Excel(name = "净重(KG)") + private BigDecimal netWeight; + + @ApiModelProperty("毛重(KG)") + @Excel(name = "毛重(KG)") + private BigDecimal grossWeight; + + @ApiModelProperty("体积") + @Excel(name = "体积") + private BigDecimal volume; + + @ApiModelProperty("面积") + @Excel(name = "面积") + private BigDecimal area; + + @ApiModelProperty("冻结数量大于0条件") + @Excel(name = "冻结数量大于0条件") + private String greaterThanFreezeQuantity; + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/service/ReservationMaterialInventoryApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/service/ReservationMaterialInventoryApplicationService.java new file mode 100644 index 000000000..1aa314ba7 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/service/ReservationMaterialInventoryApplicationService.java @@ -0,0 +1,567 @@ +package com.mhd.oms.domain.reservationMaterialInventory.service; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.nacos.common.utils.CollectionUtils; +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.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper; +import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBarCodePO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO; +import com.mhd.oms.domain.reservationMaterialInventory.service.ReservationMaterialInventoryDomainService; +import com.mhd.system.api.SystemServiceFeign; +import com.mhd.system.api.domain.BatchDetailFeignPO; +import com.mhd.system.api.domain.MaterialInventoryOmsParamDO; +import com.mhd.system.api.domain.MaterialInventoryPO; +import com.mhd.system.api.domain.MaterialMoreDetailPO; +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.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 物料库存ApplicationService + * + * @author gen + * @date 2024-05-29 + */ +@Service +@Slf4j +public class ReservationMaterialInventoryApplicationService { + @Autowired + private ReservationMaterialInventoryDomainService materialInventoryDomainService; + @Autowired + private SystemServiceFeign systemServiceFeign; + @Autowired + private ReservationMaterialInventoryMapper materialInventoryMapper; + + + + /** + * 分页查询物料库存列表 + */ + + public List queryList(ReservationMaterialInventoryDO materialInventoryDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null && loginUser.getUserPo() != null){ + Long userOrganizationId = loginUser.getUserPo().getOrganizationId(); + Long frontendOrganizationId = materialInventoryDO.getOrganizationId(); // 前端传递的 organizationId + + // 数据权限:根据 organizationId 来设置查询权限 + // 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己 + if (userOrganizationId != null && userOrganizationId == 2827L) { + // 南光组织(organizationId=2827):可以查询所有组织的数据 + // 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤 + // 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据 + if (frontendOrganizationId != null) { + // 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤 + materialInventoryDO.setOrganizationId(frontendOrganizationId); + materialInventoryDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件 + } else { + // 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据 + materialInventoryDO.setOrganizationId(null); + materialInventoryDO.setTopOrganizationId(null); + } + } else { + // 其他组织:设置organizationId,只查询当前组织的数据 + // 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致 + if (frontendOrganizationId != null && userOrganizationId != null) { + // 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致 + if (!frontendOrganizationId.equals(userOrganizationId)) { + // 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询 + materialInventoryDO.setOrganizationId(userOrganizationId); + } + // 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值 + } else { + // 前端没有传递 organizationId,使用当前登录用户的组织ID + if (userOrganizationId != null) { + materialInventoryDO.setOrganizationId(userOrganizationId); + } + } + // 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件 + // 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId + if (materialInventoryDO.getOrganizationId() == null) { + Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); + if (topOrganizationId != null && topOrganizationId != 1) { + materialInventoryDO.setTopOrganizationId(topOrganizationId); + } + } else { + // 对于非2827组织,必须设置 topOrganizationId=2827 + materialInventoryDO.setTopOrganizationId(2827L); + } + } + // 前端有传warehouseId则优先使用传参;未传时才使用"用户关联仓库"作为默认值 +// if (materialInventoryDO.getWarehouseId() == null) { +// AssociationWarehouseCacheDO associationWarehouseCacheDO = +// SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid()); +// if (associationWarehouseCacheDO != null) { +// materialInventoryDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId()); +// } +// } + } + return materialInventoryDomainService.queryList(materialInventoryDO); + } + + /** + * 查询物料库存列表(带批次属性) + * 批次属性值从库存表中获取 + */ + public List queryListWithBatchAttributes(ReservationMaterialInventoryDO materialInventoryDO) { + List list = queryList(materialInventoryDO); + + if (CollectionUtils.isEmpty(list)) { + return list; + } + + // 性能优化:批量获取批次属性,避免N+1查询问题 + // 1. 收集所有唯一的materialBaseInfoId + Set materialBaseInfoIdSet = list.stream() + .map(ReservationMaterialInventoryPO::getMaterialBaseInfoId) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + + // 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId) + Map> batchDetailMap = new HashMap<>(); + for (Long materialBaseInfoId : materialBaseInfoIdSet) { + try { + AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId); + if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) { + List batchDetailFeignPOList = JSON.parseArray( + JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class); + if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) { + // 过滤isDisplay=1的属性 + List filteredList = batchDetailFeignPOList.stream() + .filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1) + .collect(Collectors.toList()); + batchDetailMap.put(materialBaseInfoId, filteredList); + } + } + } catch (Exception e) { + log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage()); + } + } + + // 3. 为每个物料库存设置更多属性(从库存表中获取值) + //setMaterialMoreDetailListFromInventory(list, batchDetailMap); + + return list; + } + + + + public BigDecimal sumInventoryQuantity(ReservationMaterialInventoryDO materialInventoryDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null){ + Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); + if (topOrganizationId != null && topOrganizationId != 1){ + materialInventoryDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + } + // 前端有传warehouseId则优先使用传参;未传时才使用“用户关联仓库”作为默认值 + if (materialInventoryDO.getWarehouseId() == null) { + AssociationWarehouseCacheDO associationWarehouseCacheDO = + SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid()); + if (associationWarehouseCacheDO != null) { + materialInventoryDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId()); + } + } + } + List materialInventoryPOS = materialInventoryDomainService.queryList(materialInventoryDO); + if (CollectionUtils.isNotEmpty(materialInventoryPOS)){ + return materialInventoryPOS.stream().map(ReservationMaterialInventoryPO::getAllocationQuantity).reduce(BigDecimal.ZERO, BigDecimal::add); + } + return BigDecimal.ZERO; + } + + /** + * 新增物料库存 + */ + public Boolean insert(ReservationMaterialInventoryDO materialInventoryDO) { + + return materialInventoryDomainService.insert(materialInventoryDO); + } + + /** + * 修改物料库存 + */ + public Boolean update(ReservationMaterialInventoryDO materialInventoryDO) { + return materialInventoryDomainService.update(materialInventoryDO); + } + + /** + * 批量删除物料库存 + */ + public boolean delete(Long[] materialInventoryIds) { + return materialInventoryDomainService.delete(materialInventoryIds); + } + + /** + * 获取物料库存详细信息 + */ + public ReservationMaterialInventoryPO getInfo(Long materialInventoryId) + { + return materialInventoryDomainService.getInfo(materialInventoryId); + } + + /** + * @description 根据库位Id和物料基础信息Id 获取物料库存详细信息 + * @author ZhouGY + * @date 2024/5/29 17:15 + * @param storageLocationId + * @param materialBaseInfoId + * @return BigDecimal + */ + public BigDecimal getInventoryByStorageLocationIdAndMaterialBaseInfoId(Long storageLocationId, Long materialBaseInfoId) { + return materialInventoryDomainService.getInventoryByStorageLocationIdAndMaterialBaseInfoId(storageLocationId, materialBaseInfoId); + } + + /** + * @description:库存查询列表 + * @param materialInventoryQueryListDO + * @return: java.util.List + * @author: lianzj + * @time: 2024-07-16 14:43:38 + */ +// public List materialQueryList(ReservationMaterialInventoryQueryListDO materialInventoryQueryListDO) { +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// //topOrganizationId 会查到一级组织下全部子组织 +// if (loginUser != null && loginUser.getUserPo() != null) { +// Long userOrganizationId = loginUser.getUserPo().getOrganizationId(); +// Long frontendOrganizationId = materialInventoryQueryListDO.getOrganizationId(); +// if (userOrganizationId != null && userOrganizationId == 2827L) { +// if (frontendOrganizationId != null) { +// materialInventoryQueryListDO.setOrganizationId(frontendOrganizationId); +// materialInventoryQueryListDO.setTopOrganizationId(null); +// } else { +// materialInventoryQueryListDO.setOrganizationId(null); +// materialInventoryQueryListDO.setTopOrganizationId(null); +// } +// } else { +// if (frontendOrganizationId != null && userOrganizationId != null) { +// if (!frontendOrganizationId.equals(userOrganizationId)) { +// materialInventoryQueryListDO.setOrganizationId(userOrganizationId); +// } +// } else { +// if (userOrganizationId != null) { +// materialInventoryQueryListDO.setOrganizationId(userOrganizationId); +// } +// } +// if (materialInventoryQueryListDO.getOrganizationId() == null) { +// Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); +// if (topOrganizationId != null && topOrganizationId != 1) { +// materialInventoryQueryListDO.setTopOrganizationId(topOrganizationId); +// } +// } else { +// materialInventoryQueryListDO.setTopOrganizationId(2827L); +// } +// } +// } +// List list = materialInventoryDomainService.materialQueryList(materialInventoryQueryListDO); +// // 批次属性填充,与按单移位一致 +// fillMaterialMoreDetailForInventoryQueryList(list); +// // 主项子项结构仅用于 0-全部、6-按容器,供移位表单复用;1-5 按货主/物料/批次/库位/物料库位 为合并汇总展示,不转主项子项 +// Integer queryType = materialInventoryQueryListDO.getQueryType(); +// if (queryType == null || queryType == 0 || queryType == 6) { +// buildParentChildForInventoryQueryList(list); +// } +// return list; +// } +// +// /** +// * 将库存查询列表转为主项子项结构,与移位详情一致,供 PDA 表单复用 +// */ +// private void buildParentChildForInventoryQueryList(List list) { +// if (CollectionUtils.isEmpty(list)) return; +// for (ReservationMaterialInventoryQueryListPO parent : list) { +// Long uid = parent.getReservationMaterialInventoryId(); +// parent.setLevel(1); +// parent.setUniqueId(uid); +// parent.setParentUniqueId(null); +// ReservationMaterialInventoryQueryListPO child = new ReservationMaterialInventoryQueryListPO(); +// BeanUtils.copyProperties(parent, child, "children"); +// child.setLevel(2); +// child.setUniqueId(uid); +// child.setParentUniqueId(uid); +// child.setChildren(null); +// BigDecimal qty = parent.getShiftQuantity() != null ? parent.getShiftQuantity() : parent.getAllocationQuantity(); +// if (qty == null) qty = BigDecimal.ONE; +// if (parent.getNetWeight() != null) child.setTotalNetWeight(parent.getNetWeight().multiply(qty)); +// if (parent.getGrossWeight() != null) child.setTotalGrossWeight(parent.getGrossWeight().multiply(qty)); +// if (parent.getVolume() != null) child.setTotalVolume(parent.getVolume().multiply(qty)); +// if (parent.getArea() != null) child.setTotalArea(parent.getArea().multiply(qty)); +// parent.setTotalNetWeight(child.getTotalNetWeight()); +// parent.setTotalGrossWeight(child.getTotalGrossWeight()); +// parent.setTotalVolume(child.getTotalVolume()); +// parent.setTotalArea(child.getTotalArea()); +// List children = new ArrayList<>(); +// children.add(child); +// parent.setChildren(children); +// } +// } +// +// /** +// * 根据 materialInventoryId 获取单条库存(含批次属性、shiftQuantity),供移位表单预填,内部使用 +// */ +// public ReservationMaterialInventoryQueryListPO getInventoryForShiftForm(Long materialInventoryId) { +// if (materialInventoryId == null) return null; +// ReservationMaterialInventoryQueryListDO do_ = new ReservationMaterialInventoryQueryListDO(); +// do_.setReservationMaterialInventoryId(materialInventoryId); +// do_.setQueryType(0); +// List list = materialQueryList(do_); +// return CollectionUtils.isEmpty(list) ? null : list.get(0); +// } + + /** + * 库存查询列表批次属性填充,与按单移位 fillMaterialMoreDetailForShiftDetail 一致 + * 物料条码、包装规格:优先用 material_base_info,为空时从 material_bar_code 取条码(参考收货单实现) + */ +// private void fillMaterialMoreDetailForInventoryQueryList(List list) { +// if (CollectionUtils.isEmpty(list)) { +// return; +// } +// Set materialBaseInfoIdSet = list.stream() +// .map(ReservationMaterialInventoryQueryListPO::getMaterialBaseInfoId) +// .filter(Objects::nonNull) +// .collect(Collectors.toSet()); +// // 物料条码:material_base_info.bar_code 为空时,从 material_bar_code 取第一条(参考 StockReceiptOrderApplicationService) +// Map materialBarCodeMap = buildMaterialBarCodeMap(materialBaseInfoIdSet); +// list.forEach(po -> { +// if (StringUtils.isBlank(po.getBarCode()) && po.getMaterialBaseInfoId() != null) { +// String barCode = materialBarCodeMap.get(po.getMaterialBaseInfoId()); +// if (StringUtils.isNotBlank(barCode)) { +// po.setBarCode(barCode); +// } +// } +// }); +// Map> batchDetailMap = new HashMap<>(); +// for (Long materialBaseInfoId : materialBaseInfoIdSet) { +// try { +// AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId); +// if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) { +// List batchList = JSON.parseArray( +// JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class); +// if (!CollectionUtils.isEmpty(batchList)) { +// batchDetailMap.put(materialBaseInfoId, batchList); +// } +// } +// } catch (Exception e) { +// log.warn("获取物料批次属性失败,materialBaseInfoId={}, error={}", materialBaseInfoId, e.getMessage()); +// } +// } +// list.forEach(po -> { +// fillMaterialMoreDetailForInventoryQueryPO(po, batchDetailMap); +// // 移位数量供 PDA 底部表单区显示,库存查询时等于可用数量 +// po.setShiftQuantity(po.getAllocationQuantity()); +// }); +// } +// +// private void fillMaterialMoreDetailForInventoryQueryPO(ReservationMaterialInventoryQueryListPO po, +// Map> batchDetailMap) { +// if (po == null || po.getMaterialBaseInfoId() == null) { +// po.setMaterialMoreDetailList(new ArrayList<>()); +// return; +// } +// List materialMoreDetailList = new ArrayList<>(); +// List batchList = batchDetailMap.get(po.getMaterialBaseInfoId()); +// if (!CollectionUtils.isEmpty(batchList)) { +// materialMoreDetailList = filterAndConvertToMaterialMoreDetail(batchList); +// } +// // 与按单移位一致:净重、毛重、体积、面积、移位数量不放在上面 materialMoreDetailList,由 PO 顶层字段在底部表单区(移入数量、移入库位、容器旁)显示 +// materialMoreDetailList = excludeWeightVolumeAreaShiftFromList(materialMoreDetailList); +// fillAttributeValueFromInventoryQueryPO(po, materialMoreDetailList); +// List filtered = materialMoreDetailList.stream() +// .filter(m -> m.getAttributeValue() != null && !m.getAttributeValue().trim().isEmpty()) +// .collect(Collectors.toList()); +// po.setMaterialMoreDetailList(filtered); +// } + + /** + * 批量查询物料条码,取 material_bar_code 表第一条 barCode(参考 StockReceiptOrderApplicationService) + */ +// private Map buildMaterialBarCodeMap(Set materialBaseInfoIdSet) { +// Map map = new HashMap<>(); +// if (materialBaseInfoIdSet == null || materialBaseInfoIdSet.isEmpty()) return map; +// for (Long materialBaseInfoId : materialBaseInfoIdSet) { +// try { +// List list = materialBarCodeService.getInfoByMaterialBaseInfoIds(materialBaseInfoId); +// if (!CollectionUtils.isEmpty(list) && StringUtils.isNotBlank(list.get(0).getBarCode())) { +// map.put(materialBaseInfoId, list.get(0).getBarCode()); +// } +// } catch (Exception e) { +// log.warn("获取物料条码失败,materialBaseInfoId={}, error={}", materialBaseInfoId, e.getMessage()); +// } +// } +// return map; +// } +// +// /** 净重、毛重、体积、面积、移位数量在底部表单区显示,从上面 materialMoreDetailList 中排除,与按单移位一致 */ +// private static final String[] WEIGHT_VOLUME_AREA_SHIFT_LABELS = { +// "净重(KG)", "净重", "总净重", +// "毛重(KG)", "毛重", "总毛重", +// "体积(CBM)", "体积", "总体积", +// "面积(SQM)", "面积", "总面积", +// "移位数量", "可移位数量" +// }; +// +// private List excludeWeightVolumeAreaShiftFromList(List list) { +// if (CollectionUtils.isEmpty(list)) { +// return list; +// } +// return list.stream() +// .filter(m -> { +// String label = m.getBatchLabels(); +// if (label == null) return true; +// for (String exclude : WEIGHT_VOLUME_AREA_SHIFT_LABELS) { +// if (exclude.equals(label.trim())) return false; +// } +// return true; +// }) +// .collect(Collectors.toList()); +// } +// +// private List filterAndConvertToMaterialMoreDetail(List batchList) { +// List result = new ArrayList<>(); +// if (CollectionUtils.isEmpty(batchList)) { +// return result; +// } +// for (BatchDetailFeignPO po : batchList) { +// if (po.getIsDisplay() == null || po.getIsDisplay() != 1) { +// continue; +// } +// MaterialMoreDetailPO mpo = new MaterialMoreDetailPO(); +// mpo.setBatchId(po.getBatchId()); +// mpo.setBatchDetailId(po.getBatchDetailId()); +// mpo.setBatchLabels(po.getBatchLabels()); +// mpo.setInputControl(po.getInputControl()); +// mpo.setAttributeFormat(po.getAttributeFormat()); +// mpo.setAttributeOption(po.getAttributeOption()); +// result.add(mpo); +// } +// return result; +// } +// +// private void fillAttributeValueFromInventoryQueryPO(ReservationMaterialInventoryQueryListPO po, +// List materialMoreDetailList) { +// if (CollectionUtils.isEmpty(materialMoreDetailList)) { +// return; +// } +// for (MaterialMoreDetailPO materialMoreDetail : materialMoreDetailList) { +// if (materialMoreDetail.getAttributeValue() != null && !materialMoreDetail.getAttributeValue().trim().isEmpty()) { +// continue; +// } +// String batchLabels = materialMoreDetail.getBatchLabels(); +// String attributeOption = materialMoreDetail.getAttributeOption(); +// String refVal = null; +// if (StringUtils.isNotBlank(batchLabels)) { +// switch (batchLabels.trim()) { +// case "Invoice No.": +// case "Invoice No": +// case "发票号": +// refVal = po.getExtAttr1(); +// break; +// case "Batch Ref NO's": +// case "Batch Ref NO": +// case "批次参考号": +// refVal = po.getBatchRefNo(); +// break; +// case "Sheet Ref NO's": +// case "Sheet Ref NO": +// case "单据参考号": +// refVal = po.getSheetRefNo(); +// break; +// case "箱号/卡板号": +// case "箱号": +// case "卡板号": +// refVal = po.getBoxPalletNo(); +// break; +// case "扩展字段1": +// case "扩展属性1": +// refVal = po.getExtAttr1(); +// break; +// case "扩展字段2": +// case "扩展属性2": +// refVal = po.getExtAttr2(); +// break; +// case "扩展字段3": +// case "扩展属性3": +// refVal = po.getExtAttr3() != null ? new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(po.getExtAttr3()) : null; +// break; +// case "扩展字段4": +// case "扩展属性4": +// refVal = po.getExtAttr4() != null ? new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(po.getExtAttr4()) : null; +// break; +// case "生产日期": +// refVal = po.getProductionDate() != null ? new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(po.getProductionDate()) : null; +// break; +// case "过期日期": +// refVal = po.getExpiryDate() != null ? new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(po.getExpiryDate()) : null; +// break; +// case "存货日期": +// refVal = po.getInventoryDate() != null ? new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(po.getInventoryDate()) : null; +// break; +// case "批次号": +// refVal = po.getBatchNumber(); +// break; +// case "总净重": +// case "净重(KG)": +// case "净重": +// refVal = po.getNetWeight() != null ? po.getNetWeight().toString() : null; +// break; +// case "总毛重": +// case "毛重(KG)": +// case "毛重": +// refVal = po.getGrossWeight() != null ? po.getGrossWeight().toString() : null; +// break; +// case "总体积": +// case "体积(CBM)": +// case "体积": +// refVal = po.getVolume() != null ? po.getVolume().toString() : null; +// break; +// case "总面积": +// case "面积(SQM)": +// case "面积": +// refVal = po.getArea() != null ? po.getArea().toString() : null; +// break; +// default: +// if ("InvoiceNo".equalsIgnoreCase(attributeOption)) refVal = po.getExtAttr1(); +// else if ("BatchRefNo".equalsIgnoreCase(attributeOption)) refVal = po.getBatchRefNo(); +// else if ("SheetRefNo".equalsIgnoreCase(attributeOption)) refVal = po.getSheetRefNo(); +// else if ("BoxPalletNo".equalsIgnoreCase(attributeOption)) refVal = po.getBoxPalletNo(); +// else if ("ProductionDate".equalsIgnoreCase(attributeOption) && po.getProductionDate() != null) +// refVal = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(po.getProductionDate()); +// else if ("ExpiryDate".equalsIgnoreCase(attributeOption) && po.getExpiryDate() != null) +// refVal = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(po.getExpiryDate()); +// else if ("InventoryDate".equalsIgnoreCase(attributeOption) && po.getInventoryDate() != null) +// refVal = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(po.getInventoryDate()); +// else if ("NetWeight".equalsIgnoreCase(attributeOption) && po.getNetWeight() != null) refVal = po.getNetWeight().toString(); +// else if ("GrossWeight".equalsIgnoreCase(attributeOption) && po.getGrossWeight() != null) refVal = po.getGrossWeight().toString(); +// else if ("Volume".equalsIgnoreCase(attributeOption) && po.getVolume() != null) refVal = po.getVolume().toString(); +// else if ("Area".equalsIgnoreCase(attributeOption) && po.getArea() != null) refVal = po.getArea().toString(); +// break; +// } +// } +// if (refVal != null) { +// materialMoreDetail.setAttributeValue(refVal); +// } +// } +// } + + /** + * 获取物料库存详细信息 + */ + public Boolean omsEdit(MaterialInventoryOmsParamDO materialInventoryOmsParamDO) + { + return materialInventoryDomainService.omsEdit(materialInventoryOmsParamDO); + } +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/service/ReservationMaterialInventoryAssembler.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/service/ReservationMaterialInventoryAssembler.java new file mode 100644 index 000000000..9a83ec3c9 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/service/ReservationMaterialInventoryAssembler.java @@ -0,0 +1,73 @@ +package com.mhd.oms.domain.reservationMaterialInventory.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.reservationMaterialInventory.repository.todo.MaterialInventoryQueryListDO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialInventoryQueryListDTO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDTO; +import com.mhd.system.api.model.LoginUser; +import org.springframework.stereotype.Component; + +import java.util.Date; + +/** + * 物料库存Assembler + * + * @author gen + * @date 2024-05-29 + */ +@Component +public class ReservationMaterialInventoryAssembler { + + /** + * 转换实体 + */ + public ReservationMaterialInventoryDO toDO(ReservationMaterialInventoryDTO materialInventoryDTO) { + ReservationMaterialInventoryDO materialInventoryDO = new ReservationMaterialInventoryDO(); + // 拷贝 + BeanUtils.copyProperties(materialInventoryDTO, materialInventoryDO, IgnoreNullUtil.getNullPropertyNames(materialInventoryDTO)); + return materialInventoryDO; + } + + /** + * 转换实体 + */ + public ReservationMaterialInventoryDO toDOByEdit(ReservationMaterialInventoryDTO materialInventoryDTO) { + ReservationMaterialInventoryDO materialInventoryDO = new ReservationMaterialInventoryDO(); + // 拷贝 + BeanUtils.copyProperties(materialInventoryDTO, materialInventoryDO, IgnoreNullUtil.getNullPropertyNames(materialInventoryDTO)); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + String userName = loginUser.getUsername(); + // 获取登录人id + Long userId = loginUser.getUserid(); + if(materialInventoryDTO.getMaterialInventoryId() != null){ + materialInventoryDO.setUpdateBy(userId); + materialInventoryDO.setUpdateByName(userName); + materialInventoryDO.setUpdateTime(new Date()); + }else { + materialInventoryDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); + materialInventoryDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + materialInventoryDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + materialInventoryDO.setCreateBy(userId); + materialInventoryDO.setCreateByName(userName); + materialInventoryDO.setCreateTime(new Date()); + materialInventoryDO.setDelFlag(1); + } + return materialInventoryDO; + } + + public MaterialInventoryQueryListDO toDOByQueryList(MaterialInventoryQueryListDTO materialInventoryQueryListDTO) { + MaterialInventoryQueryListDO materialInventoryQueryListDO = new MaterialInventoryQueryListDO(); + // 拷贝 + BeanUtils.copyProperties(materialInventoryQueryListDTO, materialInventoryQueryListDO, IgnoreNullUtil.getNullPropertyNames(materialInventoryQueryListDTO)); + return materialInventoryQueryListDO; + } +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/service/ReservationMaterialInventoryDomainService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/service/ReservationMaterialInventoryDomainService.java new file mode 100644 index 000000000..fc73a5f42 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationMaterialInventory/service/ReservationMaterialInventoryDomainService.java @@ -0,0 +1,113 @@ +package com.mhd.oms.domain.reservationMaterialInventory.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory; +import com.mhd.oms.domain.reservationMaterialInventory.repository.facade.IReservationMaterialInventoryService; +import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO; +import com.mhd.system.api.domain.MaterialInventoryOmsParamDO; +import com.mhd.system.api.domain.MaterialInventoryPO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 物料库存 + * + * @author gen + * @date 2024-05-29 + */ +@Service +@Slf4j +public class ReservationMaterialInventoryDomainService { + + @Autowired + private IReservationMaterialInventoryService materialInventoryService; + + + /** + * 分页查询物料库存列表 + */ + public List queryList(ReservationMaterialInventoryDO materialInventoryDO) { + return materialInventoryService.queryList(materialInventoryDO); + } + + + /** + * 新增物料库存 + */ + public Boolean insert(ReservationMaterialInventoryDO materialInventoryDO) { + + return materialInventoryService.insert(materialInventoryDO); + } + + /** + * 修改物料库存 + */ + public Boolean update(ReservationMaterialInventoryDO materialInventoryDO) { + return materialInventoryService.update(materialInventoryDO); + } + + /** + * 批量删除物料库存 + */ + public Boolean delete(Long[] materialInventoryIds) { + return materialInventoryService.delete(materialInventoryIds); + } + + /** + * 获取物料库存详细信息 + */ + public ReservationMaterialInventoryPO getInfo(Long materialInventoryId) + { + return materialInventoryService.getInfo(materialInventoryId); + } + + public Boolean omsEdit(MaterialInventoryOmsParamDO materialInventoryOmsParamDO) + { + return materialInventoryService.omsEdit(materialInventoryOmsParamDO); + } + + + /** + * 根据库位Id和物料基础信息Id 获取物料库存详细信息 + */ + public BigDecimal getInventoryByStorageLocationIdAndMaterialBaseInfoId(Long storageLocationId, Long materialBaseInfoId) { + ReservationMaterialInventory materialInventory = materialInventoryService.getOne(new QueryWrapper().lambda() + .select(ReservationMaterialInventory::getAllocationQuantity) + .eq(ReservationMaterialInventory::getStorageLocationId, storageLocationId) + .eq(ReservationMaterialInventory::getMaterialBaseInfoId, materialBaseInfoId) + .eq(ReservationMaterialInventory::getDelFlag, 1)); + if (materialInventory == null){ + return BigDecimal.ZERO; + } + return materialInventory.getInventoryQuantity(); + } + + /** + * @description:库存查询列表 + * @param materialInventoryQueryListDO + * @return: java.util.List + * @author: lianzj + * @time: 2024-07-16 14:45:23 + */ +// public List materialQueryList(ReservationMaterialInventoryQueryListDO materialInventoryQueryListDO) { +// return materialInventoryService.materialQueryList(materialInventoryQueryListDO); +// } +// +// +// /** +// * 分页查询即时库存列表 +// */ +// public List queryImmediateInventoryList(ImmediateInventoryDO immediateInventoryDO) { +// return materialInventoryService.queryImmediateInventoryList(immediateInventoryDO); +// } +// +// public ReservationMaterialInventoryPO selectOneByWhere(ReservationMaterialInventoryDO materialInventoryDO) { +// return materialInventoryService.selectOneByWhere(materialInventoryDO); +// } +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/inventoryAdjustmentRecord/ReservationInventoryAdjustmentRecordApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/inventoryAdjustmentRecord/ReservationInventoryAdjustmentRecordApi.java new file mode 100644 index 000000000..1f6405492 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/inventoryAdjustmentRecord/ReservationInventoryAdjustmentRecordApi.java @@ -0,0 +1,120 @@ +package com.mhd.oms.interfaces.facade.inventoryAdjustmentRecord; + +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.reservationInventoryAdjustmentRecord.repository.po.ReservationInventoryAdjustmentRecordPO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDTO; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.service.ReservationInventoryAdjustmentRecordApplicationService; +import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.service.ReservationInventoryAdjustmentRecordAssembler; +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; + +/** + * 库存调整记录 + * + * @author gen + * @date 2024-07-17 + */ +@RestController +@RequestMapping("/reservationInventoryAdjustmentRecordApi") +public class ReservationInventoryAdjustmentRecordApi extends BaseController { + @Autowired + private ReservationInventoryAdjustmentRecordApplicationService inventoryAdjustmentRecordApplicationService; + + @Resource + private ReservationInventoryAdjustmentRecordAssembler inventoryAdjustmentRecordAssembler; + + /** + * 分页查询库存调整记录列表 + */ + @ApiOperation("查询库存调整记录列表") + @GetMapping("/list") + public TableDataInfo list(ReservationInventoryAdjustmentRecordDTO inventoryAdjustmentRecordDTO) + { + //转换实体 + ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO = inventoryAdjustmentRecordAssembler.toDO(inventoryAdjustmentRecordDTO); + startPage(); + List list = inventoryAdjustmentRecordApplicationService.queryList(inventoryAdjustmentRecordDO); + return getDataTable(list); + } + + /** + * 编辑库存调整记录 + */ + @ApiOperation("编辑库存调整记录") + @PostMapping("/edit") + public AjaxResult edit(@RequestBody ReservationInventoryAdjustmentRecordDTO inventoryAdjustmentRecordDTO) + { + //转换实体 + ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO = inventoryAdjustmentRecordAssembler.toDO(inventoryAdjustmentRecordDTO); + if(inventoryAdjustmentRecordDTO.getInventoryAdjustmentId() != null){ + return toAjax(inventoryAdjustmentRecordApplicationService.update(inventoryAdjustmentRecordDO)); + } else { + return toAjax(inventoryAdjustmentRecordApplicationService.insert(inventoryAdjustmentRecordDO)); + } + } + + /** + * 批量删除库存调整记录 + */ + @ApiOperation("批量删除库存调整记录") + @DeleteMapping("/deleteByIds/{inventoryAdjustmentIds}") + public AjaxResult delete(@PathVariable Long[] inventoryAdjustmentIds) + { + return toAjax(inventoryAdjustmentRecordApplicationService.delete(inventoryAdjustmentIds)); + } + + /** + * 获取库存调整记录详细信息 + */ + @ApiOperation("获取库存调整记录") + @GetMapping(value = "/getInfo/{inventoryAdjustmentId}") + public AjaxResult getInfo(@PathVariable("inventoryAdjustmentId") Long inventoryAdjustmentId) + { + return AjaxResult.success(inventoryAdjustmentRecordApplicationService.getInfo(inventoryAdjustmentId)); + } + + /** + * @description:库存调整 + * @param inventoryAdjustmentRecordDTO + * @return: com.mhd.common.core.web.domain.AjaxResult + * @author: lianzj + * @time: 2024-07-18 9:28:47 + */ +// @ApiOperation("库存调整") +// @PostMapping("/inventoryAdjust") +// public AjaxResult inventoryAdjust(@RequestBody ReservationInventoryAdjustmentRecordDTO inventoryAdjustmentRecordDTO) +// { +// //转换实体 +// ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO = inventoryAdjustmentRecordAssembler.toDO(inventoryAdjustmentRecordDTO); +// return AjaxResult.success(inventoryAdjustmentRecordApplicationService.inventoryAdjust(inventoryAdjustmentRecordDO)); +// } + + + /** + * @description:库存冻结 + * @param inventoryAdjustmentRecordDTO + * @return: com.mhd.common.core.web.domain.AjaxResult + * @author: lianzj + * @time: 2024-07-18 14:57:51 + */ +// @ApiOperation("库存冻结") +// @PostMapping("/inventoryFrozen") +// public AjaxResult inventoryFrozen(@RequestBody ReservationInventoryAdjustmentRecordDTO inventoryAdjustmentRecordDTO) +// { +// //转换实体 +// ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO = inventoryAdjustmentRecordAssembler.toDO(inventoryAdjustmentRecordDTO); +// return AjaxResult.success(inventoryAdjustmentRecordApplicationService.inventoryFrozenForAll(inventoryAdjustmentRecordDO)); +// } + + + + + +} \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationMaterialInventory/ReservationMaterialInventoryApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationMaterialInventory/ReservationMaterialInventoryApi.java new file mode 100644 index 000000000..398cce5d8 --- /dev/null +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationMaterialInventory/ReservationMaterialInventoryApi.java @@ -0,0 +1,194 @@ +package com.mhd.oms.interfaces.facade.reservationMaterialInventory; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.mhd.common.core.domain.po.UserPo; +import com.mhd.common.core.utils.StringUtils; +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.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDTO; +import com.mhd.oms.domain.reservationMaterialInventory.service.ReservationMaterialInventoryApplicationService; +import com.mhd.oms.domain.reservationMaterialInventory.service.ReservationMaterialInventoryAssembler; +import com.mhd.system.api.UserServiceFeign; +import com.mhd.system.api.domain.MaterialInventoryDTO; +import com.mhd.system.api.domain.MaterialInventoryOmsParamDO; +import com.mhd.system.api.domain.MaterialInventoryPO; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * 物料库存Api + * + * @author gen + * @date 2024-05-29 + */ +@RestController +@RequestMapping("/materialInventoryApi") +@Slf4j +public class ReservationMaterialInventoryApi extends BaseController { + @Autowired + private ReservationMaterialInventoryApplicationService materialInventoryApplicationService; + + @Resource + private ReservationMaterialInventoryAssembler materialInventoryAssembler; + + @Autowired + private UserServiceFeign userServiceFeign; + + /** + * 分页查询物料库存列表 + */ + @ApiOperation("查询物料库存列表") + @GetMapping("/list") + public TableDataInfo list(ReservationMaterialInventoryDTO materialInventoryDTO, + @RequestParam(value = "customerName", required = false) String customerName) + { + // 出库分配前端传的是客户名称 customerName,这里通过名称查询货主ID,使用精确匹配(不模糊匹配) + String shipperName = null; // 保存查询到的货主名称 + if (StringUtils.isNotBlank(customerName) && materialInventoryDTO.getShipperId() == null) { + try { + AjaxResult ajaxResult = userServiceFeign.getInfoByName(customerName); + 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 && userPo.getUserId() != null) { + materialInventoryDTO.setShipperId(userPo.getUserId()); + // 获取货主名称:优先使用企业名称,如果没有则使用用户名称 + shipperName = StringUtils.isNotBlank(userPo.getShipperEnterpriseName()) + ? userPo.getShipperEnterpriseName() + : userPo.getUserName(); + log.info("根据客户名称查询到货主信息,客户名称:{},货主ID:{},货主名称:{}", + customerName, userPo.getUserId(), shipperName); + } + } + } catch (Exception e) { + log.warn("根据客户名称查询货主ID失败,客户名称:{},错误:{}", customerName, e.getMessage()); + } + } + + //转换实体 + ReservationMaterialInventoryDO materialInventoryDO = materialInventoryAssembler.toDO(materialInventoryDTO); + startPage(); + // 使用带批次属性的查询方法,批次属性值从库存表中获取 + List list = materialInventoryApplicationService.queryListWithBatchAttributes(materialInventoryDO); + // 按更新时间倒序排序;update_time 为空的数据放最后 + list.sort((o1, o2) -> { + Date t1 = o1.getUpdateTime(); + Date t2 = o2.getUpdateTime(); + if (t1 == null && t2 == null) return 0; + if (t1 == null) return 1; + if (t2 == null) return -1; + return t2.compareTo(t1); // desc + }); + TableDataInfo tableDataInfo = getDataTable(list); + return tableDataInfo; + } + + @ApiOperation("查询物料库存列表不分页") + @GetMapping("/listAll") + public TableDataInfo listAll(ReservationMaterialInventoryDTO materialInventoryDTO) + { + //转换实体 + ReservationMaterialInventoryDO materialInventoryDO = materialInventoryAssembler.toDO(materialInventoryDTO); + List list = materialInventoryApplicationService.queryList(materialInventoryDO); + return getDataTable(list); + } + + /** + * 编辑物料库存 + */ + @ApiOperation("编辑物料库存") + @PostMapping("/edit") + public AjaxResult edit(@RequestBody ReservationMaterialInventoryDTO materialInventoryDTO) + { + //转换实体 + ReservationMaterialInventoryDO materialInventoryDO = materialInventoryAssembler.toDOByEdit(materialInventoryDTO); + if(materialInventoryDTO.getMaterialInventoryId() != null){ + return toAjax(materialInventoryApplicationService.update(materialInventoryDO)); + }else { + // 新增时补齐更新时间(update_time),避免新增数据 update_time 为空 + materialInventoryDO.setUpdateTime(new Date()); + // update_by/update_by_name 与 create_by/create_by_name 保持一致 + materialInventoryDO.setUpdateBy(materialInventoryDO.getCreateBy()); + materialInventoryDO.setUpdateByName(materialInventoryDO.getCreateByName()); + return toAjax(materialInventoryApplicationService.insert(materialInventoryDO)); + } + } + + /** + * 批量删除物料库存 + */ + @ApiOperation("批量删除物料库存") + @DeleteMapping("/deleteByIds/{materialInventoryIds}") + public AjaxResult delete(@PathVariable Long[] materialInventoryIds) + { + return toAjax(materialInventoryApplicationService.delete(materialInventoryIds)); + } + + /** + * 获取物料库存详细信息 + */ + @ApiOperation("获取物料库存") + @GetMapping(value = "/getInfo/{materialInventoryId}") + public AjaxResult getInfo(@PathVariable("materialInventoryId") Long materialInventoryId) + { + return AjaxResult.success(materialInventoryApplicationService.getInfo(materialInventoryId)); + } + + + + /** + * 根据库位Id和物料基础信息Id 获取物料库存详细信息 + */ + @ApiOperation("根据库位Id和物料基础信息Id 获取物料库存详细信息") + @GetMapping(value = "/getInventory/{storageLocationId}/{materialBaseInfoId}") + public AjaxResult getInventoryByStorageLocationIdAndMaterialBaseInfoId(@PathVariable("storageLocationId") Long storageLocationId, @PathVariable("materialBaseInfoId") Long materialBaseInfoId) + { + return AjaxResult.success(materialInventoryApplicationService.getInventoryByStorageLocationIdAndMaterialBaseInfoId(storageLocationId, materialBaseInfoId)); + } + + + + /** + * 分页库存列表 + */ +// @ApiOperation("查询库存列表") +// @GetMapping("/queryList") +// public TableDataInfo queryList(MaterialInventoryQueryListDTO materialInventoryQueryListDTO) +// { +// //转换实体 +// MaterialInventoryQueryListDO materialInventoryQueryListDO = materialInventoryAssembler.toDOByQueryList(materialInventoryQueryListDTO); +// startPage(); +// List list = materialInventoryApplicationService.materialQueryList(materialInventoryQueryListDO); +// return getDataTable(list); +// } + + @ApiOperation("查询物料库存数量") + @GetMapping("/sumInventoryQuantity") + public AjaxResult sumInventoryQuantity(ReservationMaterialInventoryDTO materialInventoryDTO) + { + //转换实体 + ReservationMaterialInventoryDO materialInventoryDO = materialInventoryAssembler.toDO(materialInventoryDTO); + return AjaxResult.success(materialInventoryApplicationService.sumInventoryQuantity(materialInventoryDO)); + } + + /** + * 编辑物料库存 + */ + @ApiOperation("编辑物料库存") + @PostMapping("/omsEdit") + public AjaxResult omsEdit(@RequestBody MaterialInventoryOmsParamDO materialInventoryOmsParamDO) + { + materialInventoryApplicationService.omsEdit(materialInventoryOmsParamDO); + return AjaxResult.success(); + } + +} \ No newline at end of file diff --git a/mhd_oms/src/main/resources/mapper/reservationInventoryAdjustmentRecord/InventoryAdjustmentRecordMapper.xml b/mhd_oms/src/main/resources/mapper/reservationInventoryAdjustmentRecord/InventoryAdjustmentRecordMapper.xml new file mode 100644 index 000000000..6dec04c8d --- /dev/null +++ b/mhd_oms/src/main/resources/mapper/reservationInventoryAdjustmentRecord/InventoryAdjustmentRecordMapper.xml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select a.inventory_adjustment_id, a.organization_id, a.organization_name, a.top_organization_id, a.material_inventory_id, + a.material_base_info_id, a.material_code, a.material_name, a.bar_code, a.shipper_id, a.shipper_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.adjust_type, a.adjust_direction, a.adjust_before_status_code, + a.adjust_before_status_name, a.adjust_after_status_code, a.adjust_after_status_name, a.inventory_before_quantity, + a.allocation_before_quantity, a.freeze_before_quantity, a.inventory_after_quantity, a.allocation_after_quantity, + a.freeze_after_quantity, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, + a.del_flag,a.net_weight, + a.gross_weight, + a.volume, + a.area, + a.adjusted_net_weight, + a.adjusted_gross_weight, + a.adjusted_volume, + a.adjusted_area, + b.ext_attr_1, b.ext_attr_2, b.ext_attr_3, b.ext_attr_4, + b.production_date, b.expiry_date, b.inventory_date, + b.batch_ref_no, b.sheet_ref_no, b.box_pallet_no,a.ADJUST_ACTION,a.RELATE_NO, + a.in_order_number,a.lot_number,b.batch_number + from inventory_adjustment_record a left join material_inventory b on a.material_inventory_id = b.material_inventory_id + where a.del_flag = 1 + + + + + and a.organization_id = #{organizationId} + + + and a.organization_name like concat('%', #{organizationName}, '%') + + + and a.top_organization_id = #{topOrganizationId} + + + and a.material_base_info_id = #{materialBaseInfoId} + + + and a.material_inventory_id = #{materialInventoryId} + + + and a.material_code = #{materialCode} + + + and a.adjust_action = #{adjustAction} + + + and a.relate_no = #{relateNo} + + + and a.material_name like concat('%', #{materialName}, '%') + + + and a.bar_code = #{barCode} + + + and a.shipper_id = #{shipperId} + + + and a.shipper_name like concat('%', #{shipperName}, '%') + + + and a.warehouse_id = #{warehouseId} + + + and a.warehouse_code = #{warehouseCode} + + + and a.warehouse_name like concat('%', #{warehouseName}, '%') + + + and a.storage_section_id = #{storageSectionId} + + + and a.storage_code = #{storageCode} + + + and a.storage_name like concat('%', #{storageName}, '%') + + + and a.storage_location_id = #{storageLocationId} + + + and a.storage_location_code = #{storageLocationCode} + + + and a.storage_location_name like concat('%', #{storageLocationName}, '%') + + + and a.adjust_type = #{adjustType} + + + and a.adjust_direction = #{adjustDirection} + + + and a.adjust_before_status_code = #{adjustBeforeStatusCode} + + + and a.adjust_before_status_name = #{adjustBeforeStatusName} + + + and a.adjust_after_status_code = #{adjustAfterStatusCode} + + + and a.adjust_after_status_name = #{adjustAfterStatusName} + + + and a.inventory_before_quantity = #{inventoryBeforeQuantity} + + + and a.allocation_before_quantity = #{allocationBeforeQuantity} + + + and a.freeze_before_quantity = #{freezeBeforeQuantity} + + + and a.inventory_after_quantity = #{inventoryAfterQuantity} + + + and a.allocation_after_quantity = #{allocationAfterQuantity} + + + and a.freeze_after_quantity = #{freezeAfterQuantity} + + + and a.create_by_name like concat('%', #{createByName}, '%') + + + and a.update_by_name like concat('%', #{updateByName}, '%') + + order by a.create_time desc + + + + \ No newline at end of file diff --git a/mhd_oms/src/main/resources/mapper/reservationMaterialInventory/MaterialInventoryMapper.xml b/mhd_oms/src/main/resources/mapper/reservationMaterialInventory/MaterialInventoryMapper.xml new file mode 100644 index 000000000..dddb25bcb --- /dev/null +++ b/mhd_oms/src/main/resources/mapper/reservationMaterialInventory/MaterialInventoryMapper.xml @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a.material_inventory_id, a.organization_id, a.organization_name, a.top_organization_id, + a.shipper_id, a.shipper_code, a.shipper_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.material_base_info_id,a.material_detail_id, + a.batch_number,a.material_status_code,a.material_status_name,a.container_id,a.container_code,a.container_type,a.container_type_name + ,IFNULL (sum(a.freeze_quantity), 0) freeze_quantity,a.is_able, + IFNULL (sum(a.inventory_quantity), 0) inventory_quantity, + IFNULL (sum(a.allocation_quantity), 0) allocation_quantity, + a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, + a.del_flag,a.unit, + IFNULL (sum(a.area), 0) area, + IFNULL (sum(a.NET_WEIGHT), 0) NET_WEIGHT, + IFNULL (sum(a.GROSS_WEIGHT), 0) GROSS_WEIGHT, + IFNULL (sum(a.VOLUME), 0) VOLUME, + a.ext_attr_1, a.ext_attr_2, a.ext_attr_3, a.ext_attr_4, + a.production_date, a.expiry_date, a.inventory_date, + a.BATCH_REF_NO, a.SHEET_REF_NO, a.BOX_PALLET_NO,nvl(a.unit_name,b.unit_name) as unit_name, + a.bar_code as inv_bar_code, + a.in_order_number,a.lot_number + + + + + and a.material_inventory_id = #{materialInventoryId} + + + and a.organization_id = #{organizationId} + + + and a.organization_name like concat('%', #{organizationName}, '%') + + + and a.top_organization_id = #{topOrganizationId} + + + and a.warehouse_id = #{warehouseId} + + + and a.shipper_id = #{shipperId} + + + and a.warehouse_code = #{warehouseCode} + + + and a.warehouse_name like concat('%', #{warehouseName}, '%') + + + and a.storage_section_id = #{storageSectionId} + + + and a.storage_code = #{storageCode} + + + and a.storage_name like concat('%', #{storageName}, '%') + + + and a.storage_location_id = #{storageLocationId} + + + and a.storage_location_code = #{storageLocationCode} + + + and a.storage_location_name like concat('%', #{storageLocationName}, '%') + + + and a.material_base_info_id = #{materialBaseInfoId} + + + and a.material_detail_id, = #{materialDetailId} + + + + + and (a.container_code like concat('%', #{containerOrBatch}, '%') or a.batch_number like concat('%', #{containerOrBatch}, '%')) + + + and (a.batch_number like concat('%', #{batchNumber}, '%') or a.container_code like concat('%', #{containerCode}, '%')) + + + + and a.batch_number like concat('%', #{batchNumber}, '%') + + + and a.container_code like concat('%', #{containerCode}, '%') + + + + + and a.material_status_code like concat('%', #{materialStatusCode}, '%') + + + and a.material_status_name like concat('%', #{materialStatusName}, '%') + + + and a.container_id = #{containerId} + + + and a.container_type like concat('%', #{containerType}, '%') + + + and a.container_type_name like concat('%', #{containerTypeName}, '%') + + + and a.inventory_quantity = #{inventoryQuantity} + and a.inventory_quantity != 0 + + + and a.allocation_quantity = #{allocationQuantity} + + + and a.freeze_quantity = #{freezeQuantity} + + + + and a.create_by_name like concat('%', #{createByName}, '%') + + + and a.update_by_name like concat('%', #{updateByName}, '%') + + + and a.del_flag = #{delFlag} + and a.del_flag = 1 + + + and (a.storage_location_code = #{storageInfo} or material_code = #{storageInfo} or material_name like concat('%', #{storageInfo}, '%') or bar_code = #{storageInfo}) + + + and a.BATCH_REF_NO like concat('%', #{batchRefNo}, '%') + + + and a.SHEET_REF_NO like concat('%', #{sheetRefNo}, '%') + + + and a.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + group by a.shipper_id + order by max(a.shipper_name) + + + group by b.material_base_info_id, a.shipper_id + order by max(b.material_name), max(a.shipper_name) + + + group by b.material_base_info_id, a.shipper_id, a.batch_number + order by max(b.material_name), max(a.shipper_name), a.batch_number + + + group by a.storage_location_id + order by max(a.storage_location_code) + + + group by b.material_base_info_id, a.storage_location_id, a.shipper_id + order by max(b.material_name), max(a.storage_location_code), max(a.shipper_name) + + + group by a.container_id, a.container_code, a.container_type, a.container_type_name + order by a.container_type_name, b.material_name, a.storage_location_name + + + group by a.material_inventory_id + order by a.shipper_name, b.material_name, a.storage_location_name, a.batch_number + + + + + + + + + + + + + \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java index 78088622d..44ef09502 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java @@ -8,6 +8,8 @@ import com.mhd.common.core.exception.ServiceException; import com.mhd.common.core.utils.OrderSequence; import com.mhd.common.core.utils.bean.BeanUtils; import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.system.api.OmsServiceFeign; +import com.mhd.system.api.domain.MaterialInventoryOmsParamDO; import com.mhd.system.api.model.LoginUser; import com.mhd.wms.domain.copyCodeReference.entity.CopyCodeReference; import com.mhd.wms.domain.copyCodeReference.repository.facade.ICopyCodeReferenceService; @@ -79,6 +81,8 @@ public class HandoverTaskOrderDomainService { private IStockOutOrderService stockOutOrderService; @Autowired private CopyCodeReferenceDomainService copyCodeReferenceDomainService; + @Autowired + private OmsServiceFeign omsServiceFeign; /** @@ -423,6 +427,12 @@ public class HandoverTaskOrderDomainService { materialInventoryParamDO.setType("4"); materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser); materialInventoryService.xgkc(materialInventoryParamDO); + MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO(); + BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO); + materialInventoryOmsParamDO.setKctzType("出库"); + materialInventoryOmsParamDO.setLoginUser(loginUser); + //库存推送oms + omsServiceFeign.omsEdit(materialInventoryOmsParamDO); //库存调整记录 // InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord(); // inventoryAdjustmentRecord.setAdjustAction("出库"); diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java index 5afbda11b..e8cf5ed71 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/inventoryAdjustmentRecord/service/InventoryAdjustmentRecordDomainService.java @@ -11,6 +11,7 @@ import com.mhd.common.core.web.domain.BaseVOEntity; import com.mhd.common.security.utils.SecurityUtils; import com.mhd.system.api.OmsServiceFeign; import com.mhd.system.api.domain.InMaterialDetail; +import com.mhd.system.api.domain.MaterialInventoryOmsParamDO; import com.mhd.system.api.domain.OutMaterialDetail; import com.mhd.system.api.domain.StockOutOrder; import com.mhd.system.api.model.LoginUser; @@ -466,6 +467,11 @@ public class InventoryAdjustmentRecordDomainService { materialInventoryParamDO.setType("7"); materialInventoryService.kctzjl(materialInventoryParamDO,"库存冻结",loginUser); materialInventoryService.xgkc(materialInventoryParamDO); + MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO(); + BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO); + materialInventoryOmsParamDO.setKctzType("库存冻结"); + materialInventoryOmsParamDO.setLoginUser(loginUser); + omsServiceFeign.omsEdit(materialInventoryOmsParamDO); return true; } catch (Exception e) { e.printStackTrace(); diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/outMaterialDetail/repository/persistence/OutMaterialDetailImpl.java b/mhd_wms/src/main/java/com/mhd/wms/domain/outMaterialDetail/repository/persistence/OutMaterialDetailImpl.java index f61eff64e..2a483b3f5 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/outMaterialDetail/repository/persistence/OutMaterialDetailImpl.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/outMaterialDetail/repository/persistence/OutMaterialDetailImpl.java @@ -13,6 +13,8 @@ import com.mhd.common.core.utils.StringUtils; 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.system.api.OmsServiceFeign; +import com.mhd.system.api.domain.MaterialInventoryOmsParamDO; import com.mhd.system.api.model.LoginUser; import com.mhd.wms.domain.copyCodeReference.entity.CopyCodeReference; import com.mhd.wms.domain.copyCodeReference.repository.facade.ICopyCodeReferenceService; @@ -84,6 +86,8 @@ public class OutMaterialDetailImpl extends ServiceImpl