Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
赵辉
2026-04-22 17:22:18 +08:00
92 changed files with 7561 additions and 82 deletions
@@ -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;
}
@@ -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<ReservationInventoryAdjustmentRecord>
{
/**
* 分页查询库存调整记录列表
*/
public List<ReservationInventoryAdjustmentRecordPO> queryList(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO);
/**
* 新增库存调整记录
*/
public Boolean insert(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO);
/**
* 修改库存调整记录
*/
public Boolean update(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO);
/**
* 批量删除库存调整记录
*/
public Boolean delete(Long[] inventoryAdjustmentIds);
/**
* 查询库存调整记录
*/
public ReservationInventoryAdjustmentRecordPO getInfo(Long inventoryAdjustmentId);
}
@@ -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<ReservationInventoryAdjustmentRecord>
{
/**
* 查询库存调整记录列表
*/
public List<ReservationInventoryAdjustmentRecordPO> queryList(ReservationInventoryAdjustmentRecordDO inventoryAdjustmentRecordDO);
}
@@ -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<ReservationInventoryAdjustmentRecordMapper, ReservationInventoryAdjustmentRecord> implements IReservationInventoryAdjustmentRecordService {
@Autowired
private ReservationInventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper;
/**
* 查询库存调整记录列表
*/
@Override
public List<ReservationInventoryAdjustmentRecordPO> 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<ReservationInventoryAdjustmentRecord> 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;
}
}
@@ -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<MaterialMoreDetailPO> 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;
}
@@ -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<Long> 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;
}
@@ -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<Long> organizationIdList;
@ApiModelProperty(name = "权限菜单ID")
private Long permissionMenuId;
}
@@ -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<ReservationInventoryAdjustmentRecordPO> 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<ReservationInventoryAdjustmentRecordPO> inventoryAdjustmentRecordPOS = inventoryAdjustmentRecordDomainService.queryList(inventoryAdjustmentRecordDO);
// 性能优化:批量获取批次属性,避免N+1查询问题
// 1. 收集所有唯一的materialBaseInfoId
Set<Long> materialBaseInfoIdSet = inventoryAdjustmentRecordPOS.stream()
.map(ReservationInventoryAdjustmentRecordPO::getMaterialBaseInfoId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
// 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
try {
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
// 过滤isDisplay=1的属性
List<BatchDetailFeignPO> 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);
}
}
@@ -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;
}
}
@@ -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<ReservationInventoryAdjustmentRecordPO> 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<MaterialBaseInfo>().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<ReservationMaterialInventory>().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<MaterialBaseInfo>().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<ReservationMaterialInventory>().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<MaterialBaseInfo>().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);
// }
}
@@ -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;
}
@@ -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<ReservationMaterialInventory>
{
/**
* 分页查询物料库存列表
*/
public List<ReservationMaterialInventoryPO> 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<ReservationMaterialInventoryDO> materialInventoryDOList, Integer type);
/**
* @description:库存查询列表
* @param materialInventoryQueryListDO
* @return: java.util.List<com.mhd.wms.domain.materialInventory.repository.po.ReservationMaterialInventoryQueryListPO>
* @author: lianzj
* @time: 2024-07-16 14:46:10
*/
//List<ReservationMaterialInventoryQueryListPO> materialQueryList(MaterialInventoryQueryListDO materialInventoryQueryListDO);
/**
* 分页查询物料库存列表
*/
//public List<ImmediateInventoryPO> 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);
}
@@ -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<ReservationMaterialInventory>
{
//查全部
public List<ReservationMaterialInventoryPO> queryList(ReservationMaterialInventoryDO materialInventoryDO);
//查物料库存列表-物料/库位
public List<ReservationMaterialInventoryPO> queryListByWlKw(ReservationMaterialInventoryDO materialInventoryDO);
//查物料库存列表-库位
public List<ReservationMaterialInventoryPO> queryListByKw(ReservationMaterialInventoryDO materialInventoryDO);
//查物料库存列表-物料
public List<ReservationMaterialInventoryPO> queryListByWl(ReservationMaterialInventoryDO materialInventoryDO);
//查物料库存列表-货主
public List<ReservationMaterialInventoryPO> queryListByHz(ReservationMaterialInventoryDO materialInventoryDO);
public MaterialBaseInfo getByInfoId(@Param("id") Long id);
public List<MaterialBarCodePO> getInfoByMaterialBaseInfoIds(@Param("id") Long id);
}
@@ -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<ReservationMaterialInventoryMapper, ReservationMaterialInventory> implements IReservationMaterialInventoryService {
@Autowired
private ReservationMaterialInventoryMapper materialInventoryMapper;
@Autowired
private ReservationInventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper;
/**
* 查询物料库存列表
*/
@Override
public List<ReservationMaterialInventoryPO> 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<ReservationMaterialInventory> 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<ReservationMaterialInventory> reservationMaterialInventories = materialInventoryMapper.selectList(new LambdaQueryWrapper<ReservationMaterialInventory>()
.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<ReservationMaterialInventoryDO> 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<ReservationMaterialInventory>().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<MaterialBarCodePO> materialBarCodePOList = materialInventoryMapper.getInfoByMaterialBaseInfoIds(materialInventoryPO.getMaterialBaseInfoId());
if (materialBarCodePOList != null && !materialBarCodePOList.isEmpty()) {
Map<Long, MaterialBarCodePO> 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);
}
}
}
@@ -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;
}
@@ -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<ReservationMaterialInventoryQueryListPO> 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;
}
@@ -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;
}
@@ -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<String> materialClassifyCode;
@ApiModelProperty("物料分类名称")
@Excel(name = "物料分类名称")
@TableField(typeHandler = ListTypeHandler.class)
private List<String> 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;
}
@@ -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<String> materialClassifyCode;
@ApiModelProperty("物料分类名称")
@Excel(name = "物料分类名称")
@TableField(typeHandler = ListTypeHandler.class)
private List<String> materialClassifyName;
@ApiModelProperty("物料种类编码 数据字典")
@Excel(name = "物料种类编码 数据字典")
private String materialType;
@ApiModelProperty("物料种类名称 数据字典")
@Excel(name = "物料种类名称 数据字典")
private String materialTypeName;
}
@@ -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<String> materialClassifyCode;
@ApiModelProperty("物料分类名称")
@Excel(name = "物料分类名称")
@TableField(typeHandler = ListTypeHandler.class)
private List<String> 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;
}
@@ -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<String> materialClassifyCode;
@ApiModelProperty("物料分类名称")
@Excel(name = "物料分类名称")
@TableField(typeHandler = ListTypeHandler.class)
private List<String> 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<Long> organizationIdList;
@ApiModelProperty(name = "权限菜单ID")
private Long permissionMenuId;
//
// @ApiModelProperty("商品规则")
// private MaterialGoodsRuleDO materialGoodsRule;
//
// @ApiModelProperty("公共信息")
// private MaterialCommonDTO materialCommon;
//
// @ApiModelProperty("仓库控制信息")
// private MaterialWarehouseControlDTO materialWarehouseControl;
//
// @ApiModelProperty("库存预警信息")
// private List<MaterialInventoryWarningDTO> materialInventoryWarningList;
//
// @ApiModelProperty("条码信息")
// private List<MaterialBarCodeDTO> 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;
}
@@ -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<String> materialClassifyCode;
@ApiModelProperty("物料分类名称")
@Excel(name = "物料分类名称")
@TableField(typeHandler = ListTypeHandler.class)
private List<String> materialClassifyName;
@ApiModelProperty("物料种类编码 数据字典")
@Excel(name = "物料种类编码 数据字典")
private String materialType;
@ApiModelProperty("物料种类名称 数据字典")
@Excel(name = "物料种类名称 数据字典")
private String materialTypeName;
}
@@ -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;
}
@@ -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<ReservationMaterialInventoryDO> materialInventoryDOList;
}
@@ -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<Long> 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;
}
@@ -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<Long> 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;
}
@@ -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<Long> 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;
}
@@ -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<Long> 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;
}
@@ -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<ReservationMaterialInventoryPO> 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<ReservationMaterialInventoryPO> queryListWithBatchAttributes(ReservationMaterialInventoryDO materialInventoryDO) {
List<ReservationMaterialInventoryPO> list = queryList(materialInventoryDO);
if (CollectionUtils.isEmpty(list)) {
return list;
}
// 性能优化:批量获取批次属性,避免N+1查询问题
// 1. 收集所有唯一的materialBaseInfoId
Set<Long> materialBaseInfoIdSet = list.stream()
.map(ReservationMaterialInventoryPO::getMaterialBaseInfoId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
// 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
try {
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
// 过滤isDisplay=1的属性
List<BatchDetailFeignPO> 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<ReservationMaterialInventoryPO> 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<com.mhd.wms.domain.materialInventory.repository.po.ReservationMaterialInventoryQueryListPO>
* @author: lianzj
* @time: 2024-07-16 14:43:38
*/
// public List<ReservationMaterialInventoryQueryListPO> 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<ReservationMaterialInventoryQueryListPO> 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<ReservationMaterialInventoryQueryListPO> 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<ReservationMaterialInventoryQueryListPO> 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<ReservationMaterialInventoryQueryListPO> list = materialQueryList(do_);
// return CollectionUtils.isEmpty(list) ? null : list.get(0);
// }
/**
* 库存查询列表批次属性填充,与按单移位 fillMaterialMoreDetailForShiftDetail 一致
* 物料条码、包装规格:优先用 material_base_info,为空时从 material_bar_code 取条码(参考收货单实现)
*/
// private void fillMaterialMoreDetailForInventoryQueryList(List<ReservationMaterialInventoryQueryListPO> list) {
// if (CollectionUtils.isEmpty(list)) {
// return;
// }
// Set<Long> materialBaseInfoIdSet = list.stream()
// .map(ReservationMaterialInventoryQueryListPO::getMaterialBaseInfoId)
// .filter(Objects::nonNull)
// .collect(Collectors.toSet());
// // 物料条码:material_base_info.bar_code 为空时,从 material_bar_code 取第一条(参考 StockReceiptOrderApplicationService
// Map<Long, String> 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<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
// for (Long materialBaseInfoId : materialBaseInfoIdSet) {
// try {
// AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
// if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
// List<BatchDetailFeignPO> 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<Long, List<BatchDetailFeignPO>> batchDetailMap) {
// if (po == null || po.getMaterialBaseInfoId() == null) {
// po.setMaterialMoreDetailList(new ArrayList<>());
// return;
// }
// List<MaterialMoreDetailPO> materialMoreDetailList = new ArrayList<>();
// List<BatchDetailFeignPO> batchList = batchDetailMap.get(po.getMaterialBaseInfoId());
// if (!CollectionUtils.isEmpty(batchList)) {
// materialMoreDetailList = filterAndConvertToMaterialMoreDetail(batchList);
// }
// // 与按单移位一致:净重、毛重、体积、面积、移位数量不放在上面 materialMoreDetailList,由 PO 顶层字段在底部表单区(移入数量、移入库位、容器旁)显示
// materialMoreDetailList = excludeWeightVolumeAreaShiftFromList(materialMoreDetailList);
// fillAttributeValueFromInventoryQueryPO(po, materialMoreDetailList);
// List<MaterialMoreDetailPO> 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<Long, String> buildMaterialBarCodeMap(Set<Long> materialBaseInfoIdSet) {
// Map<Long, String> map = new HashMap<>();
// if (materialBaseInfoIdSet == null || materialBaseInfoIdSet.isEmpty()) return map;
// for (Long materialBaseInfoId : materialBaseInfoIdSet) {
// try {
// List<MaterialBarCodePO> 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<MaterialMoreDetailPO> excludeWeightVolumeAreaShiftFromList(List<MaterialMoreDetailPO> 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<MaterialMoreDetailPO> filterAndConvertToMaterialMoreDetail(List<BatchDetailFeignPO> batchList) {
// List<MaterialMoreDetailPO> 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<MaterialMoreDetailPO> 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);
}
}
@@ -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;
}
}
@@ -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<ReservationMaterialInventoryPO> 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<ReservationMaterialInventory>().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<com.mhd.wms.domain.materialInventory.repository.po.ReservationMaterialInventoryQueryListPO>
* @author: lianzj
* @time: 2024-07-16 14:45:23
*/
// public List<ReservationMaterialInventoryQueryListPO> materialQueryList(ReservationMaterialInventoryQueryListDO materialInventoryQueryListDO) {
// return materialInventoryService.materialQueryList(materialInventoryQueryListDO);
// }
//
//
// /**
// * 分页查询即时库存列表
// */
// public List<ImmediateInventoryPO> queryImmediateInventoryList(ImmediateInventoryDO immediateInventoryDO) {
// return materialInventoryService.queryImmediateInventoryList(immediateInventoryDO);
// }
//
// public ReservationMaterialInventoryPO selectOneByWhere(ReservationMaterialInventoryDO materialInventoryDO) {
// return materialInventoryService.selectOneByWhere(materialInventoryDO);
// }
}
@@ -153,6 +153,10 @@ public class ReservationStockInOrder extends BaseVOEntity {
@Excel(name = "计划数量")
private BigDecimal quantity;
@ApiModelProperty("入库数量")
@Excel(name = "入库数量")
private BigDecimal inQuantity;
@ApiModelProperty("净重 单位:千克")
@Excel(name = "净重 单位:千克")
private BigDecimal weightLimit;
@@ -154,6 +154,10 @@ public class ReservationStockInOrderPO extends BaseVOEntity {
@Excel(name = "计划数量(原字段)")
private BigDecimal quantity;
@ApiModelProperty("入库数量")
@Excel(name = "入库数量")
private BigDecimal inQuantity;
/**
* 计划入库数量:取入库单明细中的入库数量汇总
*/
@@ -151,6 +151,10 @@ public class ReservationStockInOrderDO extends BaseVOEntity {
@Excel(name = "计划数量")
private BigDecimal quantity;
@ApiModelProperty("入库数量")
@Excel(name = "入库数量")
private BigDecimal inQuantity;
@ApiModelProperty("净重 单位:千克")
@Excel(name = "净重 单位:千克")
private BigDecimal weightLimit;
@@ -149,6 +149,10 @@ public class ReservationStockInOrderDTO extends ReservationStockInOrderBaseDTO {
@Excel(name = "计划数量")
private BigDecimal quantity;
@ApiModelProperty("入库数量")
@Excel(name = "入库数量")
private BigDecimal inQuantity;
@ApiModelProperty("净重 单位:千克")
@Excel(name = "净重 单位:千克")
private BigDecimal weightLimit;
@@ -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<ReservationInventoryAdjustmentRecordPO> 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));
// }
}
@@ -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<ReservationMaterialInventoryPO> 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<ReservationMaterialInventoryPO> 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<ReservationMaterialInventoryQueryListPO> 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();
}
}