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
@@ -2,10 +2,7 @@ package com.mhd.system.api;
import com.mhd.common.core.constant.ServiceNameConstants; import com.mhd.common.core.constant.ServiceNameConstants;
import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.api.domain.InMaterialDetail; import com.mhd.system.api.domain.*;
import com.mhd.system.api.domain.OutMaterialDetail;
import com.mhd.system.api.domain.StockInOrder;
import com.mhd.system.api.domain.StockOutOrder;
import com.mhd.system.api.factory.RemoteBmsFeignFallbackFactory; import com.mhd.system.api.factory.RemoteBmsFeignFallbackFactory;
import com.mhd.system.api.feign.FeignAutoConfiguration; import com.mhd.system.api.feign.FeignAutoConfiguration;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@@ -33,4 +30,8 @@ public interface OmsServiceFeign {
@ApiOperation("wms推送入库单明细") @ApiOperation("wms推送入库单明细")
@PostMapping(value = "/reservationStockOutOrderApi/pushOutOrderDetail") @PostMapping(value = "/reservationStockOutOrderApi/pushOutOrderDetail")
public AjaxResult pushOutOrderDetail(@RequestBody OutMaterialDetail outMaterialDetail); public AjaxResult pushOutOrderDetail(@RequestBody OutMaterialDetail outMaterialDetail);
@ApiOperation("编辑物料库存")
@PostMapping("/materialInventoryApi/omsEdit")
public AjaxResult omsEdit(@RequestBody MaterialInventoryOmsParamDO materialInventoryOmsParamDO);
} }
@@ -0,0 +1,79 @@
package com.mhd.system.api.domain;
import com.mhd.common.core.web.domain.BaseVOEntity;
import com.mhd.system.api.model.LoginUser;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 物料库存对象 material_inventory
*
* @author gen
* @date 2024-05-29
*/
@Data
public class MaterialInventoryOmsParamDO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
//库存id
private Long materialInventoryId;
//物料基础信息id
private Long materialBaseInfoId;
//物料明细ID
private Long materialDetailId;
//仓库信息参数
private Long organizationId;
private String organizationName;
private Long topOrganizationId;
//仓库ID
private Long warehouseId;
//仓库编码
private String warehouseCode;
//仓库名称
private String warehouseName;
//存储区ID
private Long storageSectionId;
//存储区编码
private String storageCode;
//存储区名称
private String storageName;
//存储位置ID
private Long storageLocationId;
//存储位置编码
private String storageLocationCode;
//存储位置名称
private String storageLocationName;
//调整数量
private BigDecimal quantity;
//净重
private BigDecimal netWeight;
//毛重
private BigDecimal grossWeight;
//体积
private BigDecimal volume;
//面积
private BigDecimal area;
//类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
private String type;
private String barCode;
private String inOrderNumber;
private String lotNumber;
private String batchNumber;
private String isNew;
/** 业务关联单号(出库单号、交接单对应单号等),用于库存调整记录 relate_no;可与入库单号区分 */
private String relateNo;
private String kctzType;
private LoginUser loginUser;
}
@@ -356,4 +356,10 @@ public class StockInOrder extends BaseVOEntity {
@ApiModelProperty("oms入库单id") @ApiModelProperty("oms入库单id")
@Excel(name = "oms入库单id") @Excel(name = "oms入库单id")
private String omsStockInOrderId; private String omsStockInOrderId;
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("业务员名称")
private String salesmanName;
} }
@@ -395,4 +395,11 @@ public class StockOutOrder extends BaseVOEntity {
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date documentDate; private Date documentDate;
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("业务员名称")
private String salesmanName;
} }
@@ -203,7 +203,7 @@ public class UserPo {
private Integer esignEnterpriseStatus; private Integer esignEnterpriseStatus;
@ApiModelProperty(name = "部门ID") @ApiModelProperty(name = "部门ID")
private Integer departmentId; private String departmentId;
@ApiModelProperty(name = "钉钉user_id") @ApiModelProperty(name = "钉钉user_id")
private String dingUserId; private String dingUserId;
@@ -17,7 +17,6 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -73,36 +72,6 @@ public class AssociationWarehouseApplicationService {
} }
} }
/**
* 排除「默认仓」关联(is_default=2),与 Mapper 条件双保险,避免 OGNL/参数未绑定导致仍查出默认行。
*/
private List<AssociationWarehousePO> filterExcludeDefaultWarehouse(
AssociationWarehouseDO associationWarehouseDO,
List<AssociationWarehousePO> list) {
if (!Boolean.TRUE.equals(associationWarehouseDO.getExcludeDefaultWarehouse())
|| list == null || list.isEmpty()) {
return list;
}
return list.stream()
.filter(po -> po.getIsDefault() == null || !Objects.equals(po.getIsDefault(), 2))
.collect(Collectors.toList());
}
/**
* 按「组织 + 仓库」查该仓下全部绑定(未带 correlationId)时,默认排除新建仓自动产生的默认仓关联(is_default=2)。
* 需要保留时显式传 excludeDefaultWarehouse=false。
* 仅在没有显式指定 excludeDefaultWarehouse 时生效。
*/
private void applyDefaultExcludeForWarehouseBindList(AssociationWarehouseDO associationWarehouseDO) {
if (associationWarehouseDO.getExcludeDefaultWarehouse() != null) {
return;
}
if (associationWarehouseDO.getWarehouseId() != null
&& associationWarehouseDO.getCorrelationId() == null) {
associationWarehouseDO.setExcludeDefaultWarehouse(true);
}
}
/** /**
* 分页查询关联仓库列表 * 分页查询关联仓库列表
*/ */
@@ -128,16 +97,14 @@ public class AssociationWarehouseApplicationService {
associationWarehousePO.setTopOrganizationId(warehousePO.getTopOrganizationId()); associationWarehousePO.setTopOrganizationId(warehousePO.getTopOrganizationId());
associationWarehousePOList.add(associationWarehousePO); associationWarehousePOList.add(associationWarehousePO);
}); });
return filterExcludeDefaultWarehouse(associationWarehouseDO, associationWarehousePOList); return associationWarehousePOList;
}else { }else {
applyAssociationWarehouseOrgScope(associationWarehouseDO, loginUser); applyAssociationWarehouseOrgScope(associationWarehouseDO, loginUser);
// 未指定仓库时:只查当前登录人在关联表中的记录;指定了 warehouseId 时:查该仓下全部绑定(绑定用户列表),勿收窄为当前用户 // 未指定仓库时:只查当前登录人在关联表中的记录;指定了 warehouseId 时:查该仓下全部绑定(绑定用户列表),勿收窄为当前用户
if (associationWarehouseDO.getWarehouseId() == null) { if (associationWarehouseDO.getWarehouseId() == null) {
associationWarehouseDO.setCorrelationId(loginUser.getUserid()); associationWarehouseDO.setCorrelationId(loginUser.getUserid());
} }
applyDefaultExcludeForWarehouseBindList(associationWarehouseDO); return associationWarehouseDomainService.queryList(associationWarehouseDO);
return filterExcludeDefaultWarehouse(associationWarehouseDO,
associationWarehouseDomainService.queryList(associationWarehouseDO));
} }
} }
@@ -146,9 +113,7 @@ public class AssociationWarehouseApplicationService {
if (loginUser != null && loginUser.getUserPo() != null) { if (loginUser != null && loginUser.getUserPo() != null) {
applyAssociationWarehouseOrgScope(associationWarehouseDO, loginUser); applyAssociationWarehouseOrgScope(associationWarehouseDO, loginUser);
} }
applyDefaultExcludeForWarehouseBindList(associationWarehouseDO); List<AssociationWarehousePO> associationWarehousePOList = associationWarehouseDomainService.queryList(associationWarehouseDO);
List<AssociationWarehousePO> associationWarehousePOList = filterExcludeDefaultWarehouse(associationWarehouseDO,
associationWarehouseDomainService.queryList(associationWarehouseDO));
return associationWarehousePOList.stream() return associationWarehousePOList.stream()
.map(AssociationWarehousePO::getCorrelationId) .map(AssociationWarehousePO::getCorrelationId)
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -133,17 +133,30 @@ public class AssociationWarehouseImpl extends ServiceImpl<AssociationWarehouseMa
} }
/** /**
* 批量删除关联仓库 * 批量删除关联仓库。is_default=2(新建仓自动产生的默认仓绑定)不可删,调用方传入的 id 会被过滤。
*/ */
@Override @Override
public Boolean delete(Long[] associationWarehouseIds ) { public Boolean delete(Long[] associationWarehouseIds ) {
List<AssociationWarehouse> list = new ArrayList<>(); List<AssociationWarehouse> list = new ArrayList<>();
for (Long id : associationWarehouseIds) { for (Long id : associationWarehouseIds) {
if (id == null) {
continue;
}
AssociationWarehouse row = this.getById(id);
if (row == null) {
continue;
}
if (row.getIsDefault() != null && row.getIsDefault() == 2) {
continue;
}
AssociationWarehouse associationWarehouse = new AssociationWarehouse(); AssociationWarehouse associationWarehouse = new AssociationWarehouse();
associationWarehouse.setAssociationWarehouseId(id); associationWarehouse.setAssociationWarehouseId(id);
associationWarehouse.setDelFlag(2); associationWarehouse.setDelFlag(2);
list.add(associationWarehouse); list.add(associationWarehouse);
} }
if (list.isEmpty()) {
return Boolean.TRUE;
}
return this.updateBatchById(list); return this.updateBatchById(list);
} }
@@ -40,9 +40,9 @@ public class AssociationWarehouseApi extends BaseController{
private AssociationWarehouseAssembler associationWarehouseAssembler; private AssociationWarehouseAssembler associationWarehouseAssembler;
/** /**
* 分页查询关联仓库列表。按组织+仓库(warehouseId)查该仓全部绑定时,默认不返回 is_default=2默认仓关联行;需要含该条时传 excludeDefaultWarehouse=false * 分页查询关联仓库列表;含 is_default=2默认仓关联。删除时此类记录不可删
*/ */
@ApiOperation("查询关联仓库列表(按仓查绑定时默认不含 is_default=2") @ApiOperation("查询关联仓库列表")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(AssociationWarehouseDTO associationWarehouseDTO) public AjaxResult list(AssociationWarehouseDTO associationWarehouseDTO)
{ {
@@ -52,7 +52,7 @@ public class AssociationWarehouseApi extends BaseController{
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@ApiOperation("查询仓库关联的用户 id 集合(按仓查时默认不含仅 is_default=2 的绑定)") @ApiOperation("查询仓库关联的用户 id 集合")
@GetMapping("/queryListCorrelationId") @GetMapping("/queryListCorrelationId")
public AjaxResult listUser(AssociationWarehouseDTO associationWarehouseDTO) public AjaxResult listUser(AssociationWarehouseDTO associationWarehouseDTO)
{ {
@@ -49,9 +49,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseId != null "> <if test="warehouseId != null ">
and a.warehouse_id = #{warehouseId} and a.warehouse_id = #{warehouseId}
</if> </if>
<!-- 查询含 is_default=2 的默认仓关联行;is_default=2 仅在删除/保存绑定时在 Service 中过滤,不再在 SQL 中排除 -->
<!--
<if test="excludeDefaultWarehouse != null and excludeDefaultWarehouse"> <if test="excludeDefaultWarehouse != null and excludeDefaultWarehouse">
and (a.is_default is null or a.is_default &lt;&gt; 2) and (a.is_default is null or a.is_default &lt;&gt; 2)
</if> </if>
-->
<if test="warehouseCode != null and warehouseCode != ''"> <if test="warehouseCode != null and warehouseCode != ''">
and a.warehouse_code = #{warehouseCode} and a.warehouse_code = #{warehouseCode}
</if> </if>
@@ -193,6 +193,11 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
// billManageMapper.updateById(billManage); // billManageMapper.updateById(billManage);
// } // }
List<Long> billManageIds = bmsInvoiceListAddDTO.getBillManageIds(); List<Long> billManageIds = bmsInvoiceListAddDTO.getBillManageIds();
if (billManageIds != null && billManageIds.size() > 0){
} else {
billManageIds = new ArrayList<>();
billManageIds.add(bmsInvoiceListAddDTO.getBillManageId());
}
List<BillManage> billManages = billManageMapper.selectList(new LambdaQueryWrapper<BillManage>().in(BillManage::getBillManageId, billManageIds)); List<BillManage> billManages = billManageMapper.selectList(new LambdaQueryWrapper<BillManage>().in(BillManage::getBillManageId, billManageIds));
if (billManages != null && billManages.size() > 0) { if (billManages != null && billManages.size() > 0) {
for (BillManage billManage : billManages) { for (BillManage billManage : billManages) {
@@ -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 = "计划数量") @Excel(name = "计划数量")
private BigDecimal quantity; private BigDecimal quantity;
@ApiModelProperty("入库数量")
@Excel(name = "入库数量")
private BigDecimal inQuantity;
@ApiModelProperty("净重 单位:千克") @ApiModelProperty("净重 单位:千克")
@Excel(name = "净重 单位:千克") @Excel(name = "净重 单位:千克")
private BigDecimal weightLimit; private BigDecimal weightLimit;
@@ -154,6 +154,10 @@ public class ReservationStockInOrderPO extends BaseVOEntity {
@Excel(name = "计划数量(原字段)") @Excel(name = "计划数量(原字段)")
private BigDecimal quantity; private BigDecimal quantity;
@ApiModelProperty("入库数量")
@Excel(name = "入库数量")
private BigDecimal inQuantity;
/** /**
* 计划入库数量取入库单明细中的入库数量汇总 * 计划入库数量取入库单明细中的入库数量汇总
*/ */
@@ -151,6 +151,10 @@ public class ReservationStockInOrderDO extends BaseVOEntity {
@Excel(name = "计划数量") @Excel(name = "计划数量")
private BigDecimal quantity; private BigDecimal quantity;
@ApiModelProperty("入库数量")
@Excel(name = "入库数量")
private BigDecimal inQuantity;
@ApiModelProperty("净重 单位:千克") @ApiModelProperty("净重 单位:千克")
@Excel(name = "净重 单位:千克") @Excel(name = "净重 单位:千克")
private BigDecimal weightLimit; private BigDecimal weightLimit;
@@ -149,6 +149,10 @@ public class ReservationStockInOrderDTO extends ReservationStockInOrderBaseDTO {
@Excel(name = "计划数量") @Excel(name = "计划数量")
private BigDecimal quantity; private BigDecimal quantity;
@ApiModelProperty("入库数量")
@Excel(name = "入库数量")
private BigDecimal inQuantity;
@ApiModelProperty("净重 单位:千克") @ApiModelProperty("净重 单位:千克")
@Excel(name = "净重 单位:千克") @Excel(name = "净重 单位:千克")
private BigDecimal weightLimit; 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();
}
}
@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.mapper.ReservationInventoryAdjustmentRecordMapper">
<resultMap type="com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.po.ReservationInventoryAdjustmentRecordPO" id="InventoryAdjustmentRecordResult">
<result property="inventoryAdjustmentId" column="inventory_adjustment_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="materialInventoryId" column="material_inventory_id" />
<result property="materialBaseInfoId" column="material_base_info_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="barCode" column="bar_code" />
<result property="shipperId" column="shipper_id" />
<result property="shipperName" column="shipper_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="storageSectionId" column="storage_section_id" />
<result property="storageCode" column="storage_code" />
<result property="storageName" column="storage_name" />
<result property="storageLocationId" column="storage_location_id" />
<result property="storageLocationCode" column="storage_location_code" />
<result property="storageLocationName" column="storage_location_name" />
<result property="adjustType" column="adjust_type" />
<result property="adjustDirection" column="adjust_direction" />
<result property="adjustBeforeStatusCode" column="adjust_before_status_code" />
<result property="adjustBeforeStatusName" column="adjust_before_status_name" />
<result property="adjustAfterStatusCode" column="adjust_after_status_code" />
<result property="adjustAfterStatusName" column="adjust_after_status_name" />
<result property="inventoryBeforeQuantity" column="inventory_before_quantity" />
<result property="allocationBeforeQuantity" column="allocation_before_quantity" />
<result property="freezeBeforeQuantity" column="freeze_before_quantity" />
<result property="inventoryAfterQuantity" column="inventory_after_quantity" />
<result property="allocationAfterQuantity" column="allocation_after_quantity" />
<result property="freezeAfterQuantity" column="freeze_after_quantity" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="createByName" column="create_by_name" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="extAttr1" column="ext_attr_1" />
<result property="extAttr2" column="ext_attr_2" />
<result property="extAttr3" column="ext_attr_3" />
<result property="extAttr4" column="ext_attr_4" />
<result property="productionDate" column="production_date" />
<result property="expiryDate" column="expiry_date" />
<result property="inventoryDate" column="inventory_date" />
<result property="batchRefNo" column="batch_ref_no" />
<result property="sheetRefNo" column="sheet_ref_no" />
<result property="boxPalletNo" column="box_pallet_no" />
<result property="adjustAction" column="adjust_action" />
<result property="relateNo" column="relate_no" />
<result property="inOrderNumber" column="in_order_number" />
<result property="lotNumber" column="lot_number" />
<result property="batchNumber" column="batch_number" />
</resultMap>
<sql id="selectInventoryAdjustmentRecordPo">
select a.inventory_adjustment_id, a.organization_id, a.organization_name, a.top_organization_id, a.material_inventory_id,
a.material_base_info_id, a.material_code, a.material_name, a.bar_code, a.shipper_id, a.shipper_name, a.warehouse_id,
a.warehouse_code, a.warehouse_name, a.storage_section_id, a.storage_code, a.storage_name, a.storage_location_id,
a.storage_location_code, a.storage_location_name, a.adjust_type, a.adjust_direction, a.adjust_before_status_code,
a.adjust_before_status_name, a.adjust_after_status_code, a.adjust_after_status_name, a.inventory_before_quantity,
a.allocation_before_quantity, a.freeze_before_quantity, a.inventory_after_quantity, a.allocation_after_quantity,
a.freeze_after_quantity, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name,
a.del_flag,a.net_weight,
a.gross_weight,
a.volume,
a.area,
a.adjusted_net_weight,
a.adjusted_gross_weight,
a.adjusted_volume,
a.adjusted_area,
b.ext_attr_1, b.ext_attr_2, b.ext_attr_3, b.ext_attr_4,
b.production_date, b.expiry_date, b.inventory_date,
b.batch_ref_no, b.sheet_ref_no, b.box_pallet_no,a.ADJUST_ACTION,a.RELATE_NO,
a.in_order_number,a.lot_number,b.batch_number
from inventory_adjustment_record a left join material_inventory b on a.material_inventory_id = b.material_inventory_id
where a.del_flag = 1
</sql>
<sql id="selectInventoryAdjustmentRecordPo1">
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and a.organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialInventoryId != null ">
and a.material_inventory_id = #{materialInventoryId}
</if>
<if test="materialCode != null and materialCode != ''">
and a.material_code = #{materialCode}
</if>
<if test="adjustAction != null and adjustAction != ''">
and a.adjust_action = #{adjustAction}
</if>
<if test="relateNo != null and relateNo != ''">
and a.relate_no = #{relateNo}
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
<if test="barCode != null and barCode != ''">
and a.bar_code = #{barCode}
</if>
<if test="shipperId != null ">
and a.shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and a.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="warehouseId != null ">
and a.warehouse_id = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
and a.warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''">
and a.warehouse_name like concat('%', #{warehouseName}, '%')
</if>
<if test="storageSectionId != null ">
and a.storage_section_id = #{storageSectionId}
</if>
<if test="storageCode != null and storageCode != ''">
and a.storage_code = #{storageCode}
</if>
<if test="storageName != null and storageName != ''">
and a.storage_name like concat('%', #{storageName}, '%')
</if>
<if test="storageLocationId != null ">
and a.storage_location_id = #{storageLocationId}
</if>
<if test="storageLocationCode != null and storageLocationCode != ''">
and a.storage_location_code = #{storageLocationCode}
</if>
<if test="storageLocationName != null and storageLocationName != ''">
and a.storage_location_name like concat('%', #{storageLocationName}, '%')
</if>
<if test="adjustType != null ">
and a.adjust_type = #{adjustType}
</if>
<if test="adjustDirection != null ">
and a.adjust_direction = #{adjustDirection}
</if>
<if test="adjustBeforeStatusCode != null ">
and a.adjust_before_status_code = #{adjustBeforeStatusCode}
</if>
<if test="adjustBeforeStatusName != null ">
and a.adjust_before_status_name = #{adjustBeforeStatusName}
</if>
<if test="adjustAfterStatusCode != null ">
and a.adjust_after_status_code = #{adjustAfterStatusCode}
</if>
<if test="adjustAfterStatusName != null ">
and a.adjust_after_status_name = #{adjustAfterStatusName}
</if>
<if test="inventoryBeforeQuantity != null ">
and a.inventory_before_quantity = #{inventoryBeforeQuantity}
</if>
<if test="allocationBeforeQuantity != null ">
and a.allocation_before_quantity = #{allocationBeforeQuantity}
</if>
<if test="freezeBeforeQuantity != null ">
and a.freeze_before_quantity = #{freezeBeforeQuantity}
</if>
<if test="inventoryAfterQuantity != null ">
and a.inventory_after_quantity = #{inventoryAfterQuantity}
</if>
<if test="allocationAfterQuantity != null ">
and a.allocation_after_quantity = #{allocationAfterQuantity}
</if>
<if test="freezeAfterQuantity != null ">
and a.freeze_after_quantity = #{freezeAfterQuantity}
</if>
<if test="createByName != null and createByName != ''">
and a.create_by_name like concat('%', #{createByName}, '%')
</if>
<if test="updateByName != null and updateByName != ''">
and a.update_by_name like concat('%', #{updateByName}, '%')
</if>
order by a.create_time desc
</sql>
<select id="queryList" parameterType="com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.todo.ReservationInventoryAdjustmentRecordDO" resultMap="InventoryAdjustmentRecordResult">
<include refid="selectInventoryAdjustmentRecordPo"/>
<include refid="selectInventoryAdjustmentRecordPo1"/>
</select>
</mapper>
@@ -0,0 +1,468 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper">
<resultMap type="com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO" id="MaterialInventoryResult">
<result property="materialInventoryId" column="material_inventory_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="shipperId" column="shipper_id" />
<result property="shipperCode" column="shipper_code" />
<result property="shipperName" column="shipper_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="storageSectionId" column="storage_section_id" />
<result property="storageCode" column="storage_code" />
<result property="storageName" column="storage_name" />
<result property="storageLocationId" column="storage_location_id" />
<result property="storageLocationCode" column="storage_location_code" />
<result property="storageLocationName" column="storage_location_name" />
<result property="materialBaseInfoId" column="material_base_info_id" />
<result property="materialDetailId" column="material_detail_id" />
<result property="batchNumber" column="batch_number" />
<result property="materialStatusCode" column="material_status_code" />
<result property="materialStatusName" column="material_status_name" />
<result property="containerId" column="container_id" />
<result property="containerCode" column="container_code" />
<result property="containerType" column="container_type" />
<result property="containerTypeName" column="container_type_name" />
<result property="freezeQuantity" column="freeze_quantity" />
<result property="inventoryQuantity" column="inventory_quantity" />
<result property="allocationQuantity" column="allocation_quantity" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="createByName" column="create_by_name" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="isAble" column="is_able" />
<result property="unit" column="unit" />
<result property="netWeight" column="net_weight" />
<result property="grossWeight" column="gross_weight" />
<result property="volume" column="volume" />
<result property="area" column="area" />
<result property="extAttr1" column="ext_attr_1" />
<result property="extAttr2" column="ext_attr_2" />
<result property="extAttr3" column="ext_attr_3" />
<result property="extAttr4" column="ext_attr_4" />
<result property="productionDate" column="production_date" />
<result property="expiryDate" column="expiry_date" />
<result property="inventoryDate" column="inventory_date" />
<result property="batchRefNo" column="batch_ref_no" />
<result property="sheetRefNo" column="sheet_ref_no" />
<result property="boxPalletNo" column="box_pallet_no" />
<result property="packName" column="pack_name" />
<result property="unitName" column="unit_name" />
<result property="barCode" column="inv_bar_code" />
<result property="inOrderNumber" column="in_order_number" />
<result property="lotNumber" column="lot_number" />
</resultMap>
<sql id="JoinMaterialBaseInfoPo">
<!-- 注意:物料基础信息表中的货主字段统一使用别名,避免与主表中的 shipper_id/shipper_code/shipper_name 冲突 -->
,b.shipper_id AS base_shipper_id,
b.shipper_code AS base_shipper_code,
b.shipper_name AS base_shipper_name,
b.material_code,
b.material_name,
b.bar_code,
b.material_classify_code,
b.material_classify_name,
b.material_type,
b.material_type_name,
b.common,
b.pack_id,
b.pack_code,
b.pack_name
</sql>
<sql id="JoinMaterialBaseInfoPoWhere">
<!-- 该片段总是在物料基础信息表使用别名 b 时被 include,例如:
FROM ... LEFT JOIN material_base_info b ON ...
因此这里所有列名都加上 b. 前缀以避免和主表列名歧义 -->
<if test="shipperId != null ">
and b.shipper_id = #{shipperId}
</if>
<if test="shipperCode != null and shipperCode != ''">
and b.shipper_code like concat('%', #{shipperCode}, '%')
</if>
<if test="shipperName != null and shipperName != ''">
and b.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="materialCode != null and materialCode != ''">
and b.material_code = #{materialCode}
</if>
<if test="materialName != null and materialName != ''">
and b.material_name like concat('%', #{materialName}, '%')
</if>
<if test="barCode != null and barCode != ''">
and b.bar_code = #{barCode}
</if>
<if test="materialClassifyCode != null and materialClassifyCode.size() > 0">
<foreach collection="materialClassifyCode" item="code" open="and (" separator="or" close=")">
FIND_IN_SET(#{code}, b.material_classify_code) > 0
</foreach>
</if>
<if test="materialClassifyName != null and materialClassifyName.size() > 0">
<foreach collection="materialClassifyName" item="name" open="and (" separator="or" close=")">
b.material_classify_name like concat('%', #{name}, '%')
</foreach>
</if>
<if test="materialType != null and materialType != ''">
and b.material_type = #{materialType}
</if>
<if test="materialTypeName != null and materialTypeName != ''">
and b.material_type_name like concat('%', #{materialTypeName}, '%')
</if>
<if test="shipperInfo != null and shipperInfo != ''">
and (b.shipper_code like concat('%', #{shipperInfo}, '%') or b.shipper_name like concat('%', #{shipperInfo}, '%'))
</if>
<if test="materialInfo != null and materialInfo != ''">
and (b.material_code = #{materialInfo} or b.material_name like concat('%', #{materialInfo}, '%') or b.bar_code = #{materialInfo})
</if>
</sql>
<sql id="selectMaterialInventoryPo">
a.material_inventory_id, a.organization_id, a.organization_name, a.top_organization_id,
a.shipper_id, a.shipper_code, a.shipper_name,
a.warehouse_id, a.warehouse_code, a.warehouse_name,
a.storage_section_id, a.storage_code, a.storage_name, a.storage_location_id, a.storage_location_code, a.storage_location_name, a.material_base_info_id,a.material_detail_id,
a.batch_number,a.material_status_code,a.material_status_name,a.container_id,a.container_code,a.container_type,a.container_type_name
,IFNULL (sum(a.freeze_quantity), 0) freeze_quantity,a.is_able,
IFNULL (sum(a.inventory_quantity), 0) inventory_quantity,
IFNULL (sum(a.allocation_quantity), 0) allocation_quantity,
a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name,
a.del_flag,a.unit,
IFNULL (sum(a.area), 0) area,
IFNULL (sum(a.NET_WEIGHT), 0) NET_WEIGHT,
IFNULL (sum(a.GROSS_WEIGHT), 0) GROSS_WEIGHT,
IFNULL (sum(a.VOLUME), 0) VOLUME,
a.ext_attr_1, a.ext_attr_2, a.ext_attr_3, a.ext_attr_4,
a.production_date, a.expiry_date, a.inventory_date,
a.BATCH_REF_NO, a.SHEET_REF_NO, a.BOX_PALLET_NO,nvl(a.unit_name,b.unit_name) as unit_name,
a.bar_code as inv_bar_code,
a.in_order_number,a.lot_number
</sql>
<sql id="selectMaterialInventoryPo1">
<if test="materialInventoryId != null ">
and a.material_inventory_id = #{materialInventoryId}
</if>
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and a.organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="warehouseId != null ">
and a.warehouse_id = #{warehouseId}
</if>
<if test="shipperId != null ">
and a.shipper_id = #{shipperId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
and a.warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''">
and a.warehouse_name like concat('%', #{warehouseName}, '%')
</if>
<if test="storageSectionId != null ">
and a.storage_section_id = #{storageSectionId}
</if>
<if test="storageCode != null and storageCode != ''">
and a.storage_code = #{storageCode}
</if>
<if test="storageName != null and storageName != ''">
and a.storage_name like concat('%', #{storageName}, '%')
</if>
<if test="storageLocationId != null ">
and a.storage_location_id = #{storageLocationId}
</if>
<if test="storageLocationCode != null and storageLocationCode != ''">
and a.storage_location_code = #{storageLocationCode}
</if>
<if test="storageLocationName != null and storageLocationName != ''">
and a.storage_location_name like concat('%', #{storageLocationName}, '%')
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialDetailId != null ">
and a.material_detail_id, = #{materialDetailId}
</if>
<!-- 容器号或批次号:containerOrBatch 优先;若 batchNumber 与 containerCode 相同则按 OR 查(PDA 单输入框传两个相同值) -->
<choose>
<when test="containerOrBatch != null and containerOrBatch != ''">
and (a.container_code like concat('%', #{containerOrBatch}, '%') or a.batch_number like concat('%', #{containerOrBatch}, '%'))
</when>
<when test="batchNumber != null and batchNumber != '' and containerCode != null and containerCode != '' and batchNumber == containerCode">
and (a.batch_number like concat('%', #{batchNumber}, '%') or a.container_code like concat('%', #{containerCode}, '%'))
</when>
<otherwise>
<if test="batchNumber != null and batchNumber != ''">
and a.batch_number like concat('%', #{batchNumber}, '%')
</if>
<if test="containerCode != null and containerCode != ''">
and a.container_code like concat('%', #{containerCode}, '%')
</if>
</otherwise>
</choose>
<if test="materialStatusCode != null and materialStatusCode != ''">
and a.material_status_code like concat('%', #{materialStatusCode}, '%')
</if>
<if test="materialStatusName != null and materialStatusName != ''">
and a.material_status_name like concat('%', #{materialStatusName}, '%')
</if>
<if test="containerId != null ">
and a.container_id = #{containerId}
</if>
<if test="containerType != null and containerType != ''">
and a.container_type like concat('%', #{containerType}, '%')
</if>
<if test="containerTypeName != null and containerTypeName != ''">
and a.container_type_name like concat('%', #{containerTypeName}, '%')
</if>
<choose>
<when test="inventoryQuantity != null"> and a.inventory_quantity = #{inventoryQuantity} </when>
<otherwise> and a.inventory_quantity != 0 </otherwise>
</choose>
<if test="allocationQuantity != null ">
and a.allocation_quantity = #{allocationQuantity}
</if>
<if test="freezeQuantity != null ">
and a.freeze_quantity = #{freezeQuantity}
</if>
<if test="createByName != null and createByName != ''">
and a.create_by_name like concat('%', #{createByName}, '%')
</if>
<if test="updateByName != null and updateByName != ''">
and a.update_by_name like concat('%', #{updateByName}, '%')
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
<if test="storageInfo != null and storageInfo != ''">
and (a.storage_location_code = #{storageInfo} or material_code = #{storageInfo} or material_name like concat('%', #{storageInfo}, '%') or bar_code = #{storageInfo})
</if>
<if test="batchRefNo != null and batchRefNo != ''">
and a.BATCH_REF_NO like concat('%', #{batchRefNo}, '%')
</if>
<if test="sheetRefNo != null and sheetRefNo != ''">
and a.SHEET_REF_NO like concat('%', #{sheetRefNo}, '%')
</if>
<if test="boxPalletNo != null and boxPalletNo != ''">
and a.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%')
</if>
</sql>
<select id="queryList" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="JoinMaterialBaseInfoPoWhere"/>
</where>
group by a.MATERIAL_INVENTORY_ID order by a.update_time desc
</select>
<select id="queryListByWlKw" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.MATERIAL_BASE_INFO_ID,a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID
</select>
<select id="queryListByKw" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID
</select>
<select id="queryListByWl" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.MATERIAL_BASE_INFO_ID
</select>
<select id="queryListByHz" parameterType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.ReservationMaterialInventoryDO" resultMap="MaterialInventoryResult">
select
<include refid="selectMaterialInventoryPo"/>
<include refid="JoinMaterialBaseInfoPo"/>
from reservation_material_inventory a
left join NGWL_TEST_WMS.material_base_info b on a.material_base_info_id = b.material_base_info_id
<where>
<include refid="selectMaterialInventoryPo1"/>
<include refid="JoinMaterialBaseInfoPoWhere"/>
</where>
GROUP BY a.SHIPPER_ID
</select>
<resultMap type="com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryQueryListPO" id="MaterialQueryListResult">
<result property="materialInventoryId" column="material_inventory_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="shipperId" column="shipper_id" />
<result property="shipperCode" column="shipper_code" />
<result property="shipperName" column="shipper_name" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="barCode" column="inv_bar_code" />
<result property="packId" column="pack_id" />
<result property="packCode" column="pack_code" />
<result property="packName" column="pack_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="storageSectionId" column="storage_section_id" />
<result property="storageCode" column="storage_code" />
<result property="storageName" column="storage_name" />
<result property="storageLocationId" column="storage_location_id" />
<result property="storageLocationCode" column="storage_location_code" />
<result property="storageLocationName" column="storage_location_name" />
<result property="materialBaseInfoId" column="material_base_info_id" />
<result property="batchNumber" column="batch_number" />
<result property="inOrderNumber" column="in_order_number" />
<result property="lotNumber" column="lot_number" />
<result property="materialStatusCode" column="material_status_code" />
<result property="materialStatusName" column="material_status_name" />
<result property="containerId" column="container_id" />
<result property="containerCode" column="container_code" />
<result property="containerType" column="container_type" />
<result property="containerTypeName" column="container_type_name" />
<result property="inventoryQuantity" column="inventory_quantity" />
<result property="allocationQuantity" column="allocation_quantity" />
<result property="freezeQuantity" column="freeze_quantity" />
<result property="isAble" column="is_able" />
<result property="unit" column="unit" />
<result property="unitName" column="unit_name" />
<result property="netWeight" column="NET_WEIGHT" />
<result property="grossWeight" column="GROSS_WEIGHT" />
<result property="volume" column="VOLUME" />
<result property="area" column="area" />
<result property="batchRefNo" column="BATCH_REF_NO" />
<result property="sheetRefNo" column="SHEET_REF_NO" />
<result property="boxPalletNo" column="BOX_PALLET_NO" />
<result property="extAttr1" column="ext_attr_1" />
<result property="extAttr2" column="ext_attr_2" />
<result property="productionDate" column="production_date" />
<result property="expiryDate" column="expiry_date" />
<result property="inventoryDate" column="inventory_date" />
<result property="extAttr3" column="ext_attr_3" />
<result property="extAttr4" column="ext_attr_4" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="createByName" column="create_by_name" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
</resultMap>
<!-- 1-按货主 2-按物料 3-按批次 4-按库位 5-按物料/库位 6-按容器 0-全部 -->
<sql id="materialQueryListByGroup">
<choose>
<when test="queryType != null and queryType == 1">
group by a.shipper_id
order by max(a.shipper_name)
</when>
<when test="queryType != null and queryType == 2">
group by b.material_base_info_id, a.shipper_id
order by max(b.material_name), max(a.shipper_name)
</when>
<when test="queryType != null and queryType == 3">
group by b.material_base_info_id, a.shipper_id, a.batch_number
order by max(b.material_name), max(a.shipper_name), a.batch_number
</when>
<when test="queryType != null and queryType == 4">
group by a.storage_location_id
order by max(a.storage_location_code)
</when>
<when test="queryType != null and queryType == 5">
group by b.material_base_info_id, a.storage_location_id, a.shipper_id
order by max(b.material_name), max(a.storage_location_code), max(a.shipper_name)
</when>
<when test="queryType != null and queryType == 6">
group by a.container_id, a.container_code, a.container_type, a.container_type_name
order by a.container_type_name, b.material_name, a.storage_location_name
</when>
<otherwise>
group by a.material_inventory_id
order by a.shipper_name, b.material_name, a.storage_location_name, a.batch_number
</otherwise>
</choose>
</sql>
<!-- 根据库存ID查询库存信息(包含批次属性字段) -->
<select id="selectByIdWithBatchAttributes" parameterType="java.lang.Long" resultMap="MaterialInventoryResult">
SELECT
material_inventory_id, organization_id, organization_name, top_organization_id,
material_base_info_id, shipper_id, shipper_code, shipper_name, material_detail_id,
warehouse_id, warehouse_code, warehouse_name,
storage_section_id, storage_code, storage_name, storage_location_id, storage_location_code, storage_location_name,
batch_number, material_status_code, material_status_name,
container_id, container_code, container_type, container_type_name,
inventory_quantity, allocation_quantity, freeze_quantity, remark, is_able, unit,
net_weight, gross_weight, volume, area,
ext_attr_1, ext_attr_2, ext_attr_3, ext_attr_4,
production_date, expiry_date, inventory_date,
batch_ref_no, sheet_ref_no, box_pallet_no,
create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag
FROM reservation_material_inventory
WHERE material_inventory_id = #{materialInventoryId} AND del_flag = 1
</select>
<!-- 根据库存ID查询库存信息(包含批次属性字段) -->
<select id="getByInfoId" parameterType="java.lang.Long" resultType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBaseInfo">
SELECT
*
FROM NGWL_TEST_WMS.material_base_info
WHERE material_base_info_id = #{id} AND del_flag = 1
</select>
<select id="getInfoByMaterialBaseInfoIds" parameterType="java.lang.Long" resultType="com.mhd.oms.domain.reservationMaterialInventory.repository.todo.MaterialBarCodePO">
SELECT
*
FROM NGWL_TEST_WMS.material_bar_code
WHERE material_base_info_id = #{id} AND del_flag = 1
</select>
</mapper>
@@ -92,6 +92,7 @@
<result property="directorPhone" column="DIRECTOR_PHONE" /> <result property="directorPhone" column="DIRECTOR_PHONE" />
<result property="directorName" column="DIRECTOR_NAME" /> <result property="directorName" column="DIRECTOR_NAME" />
<result property="storageTime" column="STORAGE_TIME" /> <result property="storageTime" column="STORAGE_TIME" />
<result property="inQuantity" column="IN_QUANTITY" />
</resultMap> </resultMap>
@@ -127,7 +128,7 @@
a.TRANSPORT_METHOD, a.SUPERVISION_METHOD, a.CUSTOMS_INSPECTION, a.NEED_CUSTOMS_DECLARATION, a.NEED_TRANSPORT, a.TRANSPORT_METHOD, a.SUPERVISION_METHOD, a.CUSTOMS_INSPECTION, a.NEED_CUSTOMS_DECLARATION, a.NEED_TRANSPORT,
a.WAREHOUSE_DATE, a.COMPLETION_TIME, a.ORDER_DATE,a.reservation_audit_time,a.reservation_audit_name a.WAREHOUSE_DATE, a.COMPLETION_TIME, a.ORDER_DATE,a.reservation_audit_time,a.reservation_audit_name
,a.reservation_audit_id,a.issue_name,a.issue_id,a.issue_time,a.issue_status,a.RESERVATION_ORDER_SOURCE,a.tms_order_number ,a.reservation_audit_id,a.issue_name,a.issue_id,a.issue_time,a.issue_status,a.RESERVATION_ORDER_SOURCE,a.tms_order_number
,a.DIRECTOR_NAME ,a.DIRECTOR_PHONE,a.DIRECTOR_ID,a.STORAGE_TIME ,a.DIRECTOR_NAME ,a.DIRECTOR_PHONE,a.DIRECTOR_ID,a.STORAGE_TIME,a.in_quantity
</sql> </sql>
<sql id="joinStockInOrderPo"> <sql id="joinStockInOrderPo">
+17
View File
@@ -42,4 +42,21 @@ ALTER TABLE NGWL_TEST_WMS.RECEIPT_MATERIAL_DETAIL ADD oms_in_material_detail var
ALTER TABLE NGWL_TEST_WMS.SHELF_MATERIAL_DETAIL ADD OMS_IN_MATERIAL_DETAIL varchar(100) NULL; ALTER TABLE NGWL_TEST_WMS.SHELF_MATERIAL_DETAIL ADD OMS_IN_MATERIAL_DETAIL varchar(100) NULL;
ALTER TABLE NGWL_TEST_OMS.RESERVATION_IN_MATERIAL_DETAIL ADD INBOUND_ITEMS varchar(100) NULL; ALTER TABLE NGWL_TEST_OMS.RESERVATION_IN_MATERIAL_DETAIL ADD INBOUND_ITEMS varchar(100) NULL;
ALTER TABLE NGWL_TEST_OMS.RESERVATION_OUT_MATERIAL_DETAIL ADD INBOUND_ITEMS varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.STOCK_RECEIPT_ORDER ADD BUSINESS_ORDER_NO varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.PICKING_ORDER ADD BUSINESS_ORDER_NO varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.PICKING_ORDER ADD OUT_ORDER_NUMBER varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.PICKING_ORDER ADD ORDER_TYPE_CODE varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.PICKING_ORDER ADD ORDER_TYPE_NAME varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.PICKING_ORDER ADD PRIORITY_LEVEL_CODE varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.PICKING_ORDER ADD PRIORITY_LEVEL_NAME varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.PICKING_MATERIAL_DETAIL ADD lotNo varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.REVIEW_MATERIAL_DETAIL ADD PACK_ID varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.REVIEW_MATERIAL_DETAIL ADD PACK_CODE varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.REVIEW_MATERIAL_DETAIL ADD PACK_NAME varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.REVIEW_MATERIAL_DETAIL ADD PACK_DETAIL_ID varchar(100) NULL;
ALTER TABLE NGWL_TEST_WMS.PICKING_MATERIAL_DETAIL ADD IN_ORDER_NUMBER varchar(100) NULL;
@@ -32,13 +32,33 @@ public class InOrderAbnormalApplicationService {
public List<InOrderAbnormalPO> queryList(InOrderAbnormalDO inOrderAbnormalDO) { public List<InOrderAbnormalPO> queryList(InOrderAbnormalDO inOrderAbnormalDO) {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){ if (loginUser != null && loginUser.getUserPo() != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); AssociationWarehouseCacheDO cache =
if (topOrganizationId != null && topOrganizationId != 1){ SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
inOrderAbnormalDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); if (inOrderAbnormalDO.getWarehouseId() == null && cache != null
&& cache.getWarehouseId() != null) {
inOrderAbnormalDO.setWarehouseId(cache.getWarehouseId());
}
if (inOrderAbnormalDO.getTopOrganizationId() == null) {
Long top = loginUser.getUserPo().getTopOrganizationId();
if (top == null || Long.valueOf(1L).equals(top)) {
if (cache != null) {
top = cache.getTopOrganizationId();
}
}
if (top != null && !Long.valueOf(1L).equals(top)) {
inOrderAbnormalDO.setTopOrganizationId(top);
}
}
if (inOrderAbnormalDO.getOrganizationId() == null) {
Long orgId = loginUser.getUserPo().getOrganizationId();
if (orgId == null && cache != null) {
orgId = cache.getOrganizationId();
}
if (orgId != null) {
inOrderAbnormalDO.setOrganizationId(orgId);
}
} }
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
inOrderAbnormalDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
} }
return inOrderAbnormalDomainService.queryList(inOrderAbnormalDO); return inOrderAbnormalDomainService.queryList(inOrderAbnormalDO);
} }
@@ -1,6 +1,8 @@
package com.mhd.wms.application.service.outOrderAbnormal; package com.mhd.wms.application.service.outOrderAbnormal;
import com.mhd.common.security.utils.SecurityUtils; import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
import com.mhd.system.api.model.LoginUser; import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.outOrderAbnormal.repository.po.OutOrderAbnormalPO; import com.mhd.wms.domain.outOrderAbnormal.repository.po.OutOrderAbnormalPO;
import com.mhd.wms.domain.outOrderAbnormal.repository.todo.OutOrderAbnormalDO; import com.mhd.wms.domain.outOrderAbnormal.repository.todo.OutOrderAbnormalDO;
@@ -30,10 +32,33 @@ public class OutOrderAbnormalApplicationService {
public List<OutOrderAbnormalPO> queryList(OutOrderAbnormalDO outOrderAbnormalDO) { public List<OutOrderAbnormalPO> queryList(OutOrderAbnormalDO outOrderAbnormalDO) {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){ if (loginUser != null && loginUser.getUserPo() != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); // 请求带仓库时也会读关联缓存用于补全会话里为空的组织UserPo 常见无 organizationId
if (topOrganizationId != null && topOrganizationId != 1){ AssociationWarehouseCacheDO cache =
outOrderAbnormalDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
if (outOrderAbnormalDO.getWarehouseId() == null && cache != null
&& cache.getWarehouseId() != null) {
outOrderAbnormalDO.setWarehouseId(cache.getWarehouseId());
}
if (outOrderAbnormalDO.getTopOrganizationId() == null) {
Long top = loginUser.getUserPo().getTopOrganizationId();
if (top == null || Long.valueOf(1L).equals(top)) {
if (cache != null) {
top = cache.getTopOrganizationId();
}
}
if (top != null && !Long.valueOf(1L).equals(top)) {
outOrderAbnormalDO.setTopOrganizationId(top);
}
}
if (outOrderAbnormalDO.getOrganizationId() == null) {
Long orgId = loginUser.getUserPo().getOrganizationId();
if (orgId == null && cache != null) {
orgId = cache.getOrganizationId();
}
if (orgId != null) {
outOrderAbnormalDO.setOrganizationId(orgId);
}
} }
} }
return outOrderAbnormalDomainService.queryList(outOrderAbnormalDO); return outOrderAbnormalDomainService.queryList(outOrderAbnormalDO);
@@ -2844,6 +2844,7 @@ public class StockReceiptOrderApplicationService {
throw new ServiceException("收货单已完成收货"); throw new ServiceException("收货单已完成收货");
} }
StockReceiptOrderDO returnStockReceiptOrderDO = new StockReceiptOrderDO(); StockReceiptOrderDO returnStockReceiptOrderDO = new StockReceiptOrderDO();
returnStockReceiptOrderDO.setBusinessOrderNo(stockReceiptOrderPO.getBusinessOrderNo());
returnStockReceiptOrderDO.setBillingJson(stockReceiptOrderDO.getBillingJson()); returnStockReceiptOrderDO.setBillingJson(stockReceiptOrderDO.getBillingJson());
returnStockReceiptOrderDO.setReceiptOrderAccountList(stockReceiptOrderDO.getReceiptOrderAccountList()); returnStockReceiptOrderDO.setReceiptOrderAccountList(stockReceiptOrderDO.getReceiptOrderAccountList());
returnStockReceiptOrderDO.setUpdateTime(stockReceiptOrderDO.getUpdateTime()); returnStockReceiptOrderDO.setUpdateTime(stockReceiptOrderDO.getUpdateTime());
@@ -8,6 +8,8 @@ import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.utils.OrderSequence; import com.mhd.common.core.utils.OrderSequence;
import com.mhd.common.core.utils.bean.BeanUtils; import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.security.utils.SecurityUtils; import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.OmsServiceFeign;
import com.mhd.system.api.domain.MaterialInventoryOmsParamDO;
import com.mhd.system.api.model.LoginUser; import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.copyCodeReference.entity.CopyCodeReference; import com.mhd.wms.domain.copyCodeReference.entity.CopyCodeReference;
import com.mhd.wms.domain.copyCodeReference.repository.facade.ICopyCodeReferenceService; import com.mhd.wms.domain.copyCodeReference.repository.facade.ICopyCodeReferenceService;
@@ -30,7 +32,9 @@ import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
import com.mhd.wms.domain.outMaterialDetail.repository.mapper.OutMaterialDetailMapper; import com.mhd.wms.domain.outMaterialDetail.repository.mapper.OutMaterialDetailMapper;
import com.mhd.wms.domain.pickingMaterialDetail.repository.mapper.PickingMaterialDetailMapper; import com.mhd.wms.domain.pickingMaterialDetail.repository.mapper.PickingMaterialDetailMapper;
import com.mhd.wms.domain.pickingMaterialDetail.repository.po.PickingMaterialDetailPO; import com.mhd.wms.domain.pickingMaterialDetail.repository.po.PickingMaterialDetailPO;
import com.mhd.wms.domain.shelfMaterialDetail.repository.todo.ShelfMaterialDetailDO;
import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService; import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService;
import com.mhd.wms.domain.stockShelfOrder.repository.facade.IStockShelfOrderService;
import com.mhd.wms.domain.taskHandoverMaterialDetail.repository.po.TaskHandoverMaterialDetailPO; import com.mhd.wms.domain.taskHandoverMaterialDetail.repository.po.TaskHandoverMaterialDetailPO;
import com.mhd.wms.domain.shiftManage.repository.po.ShiftManagePO; import com.mhd.wms.domain.shiftManage.repository.po.ShiftManagePO;
import com.mhd.wms.domain.shiftManage.repository.todo.ShiftManageDO; import com.mhd.wms.domain.shiftManage.repository.todo.ShiftManageDO;
@@ -79,6 +83,8 @@ public class HandoverTaskOrderDomainService {
private IStockOutOrderService stockOutOrderService; private IStockOutOrderService stockOutOrderService;
@Autowired @Autowired
private CopyCodeReferenceDomainService copyCodeReferenceDomainService; private CopyCodeReferenceDomainService copyCodeReferenceDomainService;
@Autowired
private OmsServiceFeign omsServiceFeign;
/** /**
@@ -333,6 +339,8 @@ public class HandoverTaskOrderDomainService {
.eq(OutMaterialDetail::getDelFlag, 1)); .eq(OutMaterialDetail::getDelFlag, 1));
Integer review = stockOutOrder != null ? stockOutOrder.getReview() : null; Integer review = stockOutOrder != null ? stockOutOrder.getReview() : null;
for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) { for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) {
//oms详情同步
OMSWarehouseEntryDetails(outMaterialDetail);
if (outMaterialDetail.getCopyCodeReferenceIds() != null){ if (outMaterialDetail.getCopyCodeReferenceIds() != null){
List<Integer> copyCodeReferenceIds = Arrays.stream(outMaterialDetail.getCopyCodeReferenceIds().split(",")) List<Integer> copyCodeReferenceIds = Arrays.stream(outMaterialDetail.getCopyCodeReferenceIds().split(","))
.map(Integer::parseInt).collect(Collectors.toList()); .map(Integer::parseInt).collect(Collectors.toList());
@@ -423,6 +431,12 @@ public class HandoverTaskOrderDomainService {
materialInventoryParamDO.setType("4"); materialInventoryParamDO.setType("4");
materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser); materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser);
materialInventoryService.xgkc(materialInventoryParamDO); materialInventoryService.xgkc(materialInventoryParamDO);
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO);
materialInventoryOmsParamDO.setKctzType("出库");
materialInventoryOmsParamDO.setLoginUser(loginUser);
//库存推送oms
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
//库存调整记录 //库存调整记录
// InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord(); // InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
// inventoryAdjustmentRecord.setAdjustAction("出库"); // inventoryAdjustmentRecord.setAdjustAction("出库");
@@ -486,6 +500,22 @@ public class HandoverTaskOrderDomainService {
} }
} }
@Autowired
private IStockShelfOrderService stockShelfOrderService;
private void OMSWarehouseEntryDetails(OutMaterialDetail outMaterialDetail) {
outMaterialDetail.getOutOrderNumber();//出库单号
outMaterialDetail.getUniqueId();
outMaterialDetail.getCheckQuantity();//入库件数
outMaterialDetail.getTotalNetWeight();//重量
//以出库单号和业务唯一id判断
stockShelfOrderService.updateOmsHandover(
outMaterialDetail.getCheckQuantity(),
outMaterialDetail.getTotalNetWeight(),
outMaterialDetail.getOutOrderNumber(),
outMaterialDetail.getUniqueId()
);
}
private void getBarCode(MaterialInventory materialInventoryPO, InventoryAdjustmentRecord inventoryAdjustmentRecord) { private void getBarCode(MaterialInventory materialInventoryPO, InventoryAdjustmentRecord inventoryAdjustmentRecord) {
List<MaterialBarCodePO> materialBarCodePOList = materialBarCodeService.getInfoByMaterialBaseInfoIds(materialInventoryPO.getMaterialBaseInfoId()); List<MaterialBarCodePO> materialBarCodePOList = materialBarCodeService.getInfoByMaterialBaseInfoIds(materialInventoryPO.getMaterialBaseInfoId());
@@ -11,6 +11,7 @@ import com.mhd.common.core.web.domain.BaseVOEntity;
import com.mhd.common.security.utils.SecurityUtils; import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.OmsServiceFeign; import com.mhd.system.api.OmsServiceFeign;
import com.mhd.system.api.domain.InMaterialDetail; import com.mhd.system.api.domain.InMaterialDetail;
import com.mhd.system.api.domain.MaterialInventoryOmsParamDO;
import com.mhd.system.api.domain.OutMaterialDetail; import com.mhd.system.api.domain.OutMaterialDetail;
import com.mhd.system.api.domain.StockOutOrder; import com.mhd.system.api.domain.StockOutOrder;
import com.mhd.system.api.model.LoginUser; import com.mhd.system.api.model.LoginUser;
@@ -466,6 +467,11 @@ public class InventoryAdjustmentRecordDomainService {
materialInventoryParamDO.setType("7"); materialInventoryParamDO.setType("7");
materialInventoryService.kctzjl(materialInventoryParamDO,"库存冻结",loginUser); materialInventoryService.kctzjl(materialInventoryParamDO,"库存冻结",loginUser);
materialInventoryService.xgkc(materialInventoryParamDO); materialInventoryService.xgkc(materialInventoryParamDO);
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO);
materialInventoryOmsParamDO.setKctzType("库存冻结");
materialInventoryOmsParamDO.setLoginUser(loginUser);
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@@ -584,9 +584,23 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName()); inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId()); inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setLotNumber(materialInventoryParamDO.getLotNumber()); // 分配/取消分配/完成交接(出库)调整记录 LOT 以库存行 material_inventory.lot_number 为准仅库存为空时再用入参兜底
inventoryAdjustmentRecord.setInOrderNumber(materialInventoryParamDO.getInOrderNumber()); // 其它业务入上架移库等入参优先入参无则取库存
inventoryAdjustmentRecord.setBatchNumber(materialInventoryParamDO.getBatchNumber()); String lotForRecord;
if ("分配库存".equals(adjustAction) || "取消分配".equals(adjustAction) || "出库".equals(adjustAction)) {
lotForRecord = StringUtils.hasText(materialInventory.getLotNumber())
? materialInventory.getLotNumber() : materialInventoryParamDO.getLotNumber();
} else {
lotForRecord = StringUtils.hasText(materialInventoryParamDO.getLotNumber())
? materialInventoryParamDO.getLotNumber() : materialInventory.getLotNumber();
}
inventoryAdjustmentRecord.setLotNumber(lotForRecord);
String inOrderForRecord = StringUtils.hasText(materialInventoryParamDO.getInOrderNumber())
? materialInventoryParamDO.getInOrderNumber() : materialInventory.getInOrderNumber();
inventoryAdjustmentRecord.setInOrderNumber(inOrderForRecord);
String batchForRecord = StringUtils.hasText(materialInventoryParamDO.getBatchNumber())
? materialInventoryParamDO.getBatchNumber() : materialInventory.getBatchNumber();
inventoryAdjustmentRecord.setBatchNumber(batchForRecord);
if (ObjectUtil.isNotNull(materialBaseInfo)) { if (ObjectUtil.isNotNull(materialBaseInfo)) {
inventoryAdjustmentRecord.setMaterialCode(materialBaseInfo.getMaterialCode()); inventoryAdjustmentRecord.setMaterialCode(materialBaseInfo.getMaterialCode());
inventoryAdjustmentRecord.setMaterialName(materialBaseInfo.getMaterialName()); inventoryAdjustmentRecord.setMaterialName(materialBaseInfo.getMaterialName());
@@ -13,6 +13,8 @@ import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.core.utils.bean.BeanUtils; import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.utils.uuid.IdGenerator; import com.mhd.common.core.utils.uuid.IdGenerator;
import com.mhd.common.security.utils.SecurityUtils; import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.OmsServiceFeign;
import com.mhd.system.api.domain.MaterialInventoryOmsParamDO;
import com.mhd.system.api.model.LoginUser; import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.copyCodeReference.entity.CopyCodeReference; import com.mhd.wms.domain.copyCodeReference.entity.CopyCodeReference;
import com.mhd.wms.domain.copyCodeReference.repository.facade.ICopyCodeReferenceService; import com.mhd.wms.domain.copyCodeReference.repository.facade.ICopyCodeReferenceService;
@@ -84,6 +86,8 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
private IMaterialBarCodeService materialBarCodeService; private IMaterialBarCodeService materialBarCodeService;
@Autowired @Autowired
private IMaterialInventoryService materialInventoryService; private IMaterialInventoryService materialInventoryService;
@Autowired
private OmsServiceFeign omsServiceFeign;
/** /**
@@ -570,6 +574,12 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
materialInventoryParamDO.setInOrderNumber(outMaterialDetail.getInOrderNumber()); materialInventoryParamDO.setInOrderNumber(outMaterialDetail.getInOrderNumber());
materialInventoryService.kctzjl(materialInventoryParamDO,"分配库存",loginUser); materialInventoryService.kctzjl(materialInventoryParamDO,"分配库存",loginUser);
materialInventoryService.xgkc(materialInventoryParamDO); materialInventoryService.xgkc(materialInventoryParamDO);
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO);
materialInventoryOmsParamDO.setKctzType("分配库存");
materialInventoryOmsParamDO.setLoginUser(loginUser);
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
//materialInventoryMapper.updateById(materialInventory); //materialInventoryMapper.updateById(materialInventory);
//库存调整记录 //库存调整记录
@@ -955,6 +965,11 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
materialInventoryParamDO.setRelateNo(cancelRelateNo); materialInventoryParamDO.setRelateNo(cancelRelateNo);
materialInventoryService.kctzjl(materialInventoryParamDO,"取消分配",loginUser); materialInventoryService.kctzjl(materialInventoryParamDO,"取消分配",loginUser);
materialInventoryService.xgkc(materialInventoryParamDO); materialInventoryService.xgkc(materialInventoryParamDO);
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO);
materialInventoryOmsParamDO.setKctzType("取消分配");
materialInventoryOmsParamDO.setLoginUser(loginUser);
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
// //更新库存数量 // //更新库存数量
// //可用数量 // //可用数量
// BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity(); // BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
@@ -1050,6 +1065,11 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
materialInventoryParamDO.setRelateNo(cancelRelateNoCh); materialInventoryParamDO.setRelateNo(cancelRelateNoCh);
materialInventoryService.kctzjl(materialInventoryParamDO,"取消分配",loginUser); materialInventoryService.kctzjl(materialInventoryParamDO,"取消分配",loginUser);
materialInventoryService.xgkc(materialInventoryParamDO); materialInventoryService.xgkc(materialInventoryParamDO);
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO);
materialInventoryOmsParamDO.setKctzType("取消分配");
materialInventoryOmsParamDO.setLoginUser(loginUser);
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
// //更新库存数量 // //更新库存数量
// //可用数量 // //可用数量
@@ -1,6 +1,7 @@
package com.mhd.wms.domain.outMaterialDetail.repository.todo; package com.mhd.wms.domain.outMaterialDetail.repository.todo;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.mhd.common.core.annotation.Excel; import com.mhd.common.core.annotation.Excel;
@@ -8,8 +9,10 @@ import com.mhd.common.core.web.domain.BaseVOEntity;
import com.mhd.wms.domain.outMaterialDetailSerialNumber.repository.todo.OutMaterialDetailSerialNumberDO; import com.mhd.wms.domain.outMaterialDetailSerialNumber.repository.todo.OutMaterialDetailSerialNumberDO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
@@ -485,4 +488,10 @@ public class OutMaterialDetailDO extends BaseVOEntity {
@ApiModelProperty("取消分配抄码id数组") @ApiModelProperty("取消分配抄码id数组")
@Excel(name = "取消分配抄码id数组") @Excel(name = "取消分配抄码id数组")
private List<Integer> copyCodeReferenceIdsCancel; private List<Integer> copyCodeReferenceIdsCancel;
@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;
} }
@@ -291,4 +291,12 @@ public class PickingMaterialDetail extends BaseVOEntity {
@ApiModelProperty("已拣抄码对照id(逗号分隔,乱序拣货用)") @ApiModelProperty("已拣抄码对照id(逗号分隔,乱序拣货用)")
@Excel(name = "已拣抄码对照id") @Excel(name = "已拣抄码对照id")
private String pickedCopyCodeReferenceIds; private String pickedCopyCodeReferenceIds;
@ApiModelProperty("lot编号")
@Excel(name = "lot编号")
private String lotNo;
@ApiModelProperty("入库单号")
@Excel(name = "入库单号")
private String inOrderNumber;
} }
@@ -184,6 +184,9 @@ public class PickingMaterialDetailImpl extends ServiceImpl<PickingMaterialDetail
.update(); .update();
} }
} }
pickingMaterialDetail.setLotNo(pickingMaterialDetailDO.getLotNo());
pickingMaterialDetail.setInOrderNumber(pickingMaterialDetailDO.getInOrderNumber());
pickingMaterialDetail.setProductionDate(pickingMaterialDetailDO.getProductionDate());
pickingMaterialDetail.setMaterialDetailId(pickingMaterialDetailDO.getMaterialDetailId()); pickingMaterialDetail.setMaterialDetailId(pickingMaterialDetailDO.getMaterialDetailId());
pickingMaterialDetail.setUpdateBy(loginUser.getUserid()); pickingMaterialDetail.setUpdateBy(loginUser.getUserid());
pickingMaterialDetail.setUpdateByName(loginUser.getUsername()); pickingMaterialDetail.setUpdateByName(loginUser.getUsername());
@@ -321,4 +321,7 @@ public class PickingMaterialDetailPO extends BaseVOEntity {
@TableField(exist = false) @TableField(exist = false)
private List<CopyCodeReferencePO> weightList; private List<CopyCodeReferencePO> weightList;
@ApiModelProperty("LOT编码2")
private String lotNo;
} }
@@ -298,4 +298,12 @@ public class PickingMaterialDetailDO extends BaseVOEntity {
@ApiModelProperty("已拣抄码对照id(逗号分隔,合并写入)") @ApiModelProperty("已拣抄码对照id(逗号分隔,合并写入)")
private String pickedCopyCodeReferenceIds; private String pickedCopyCodeReferenceIds;
@ApiModelProperty("lot编号")
@Excel(name = "lot编号")
private String lotNo;
@ApiModelProperty("入库单号")
@Excel(name = "入库单号")
private String inOrderNumber;
} }
@@ -122,6 +122,30 @@ public class PickingOrderPO extends StockOutOrderBasePO {
@ApiModelProperty("物料明细") @ApiModelProperty("物料明细")
private List<PickingMaterialDetailPO> materialDetailList; private List<PickingMaterialDetailPO> materialDetailList;
@ApiModelProperty("出库单号")
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("业务单号")
@Excel(name = "业务单号")
private String businessOrderNo;
@ApiModelProperty("出库单类型编码")
@Excel(name = "出库单类型编码")
private String orderTypeCode;
@ApiModelProperty("出库单类型名称")
@Excel(name = "出库单类型名称")
private String orderTypeName;
@ApiModelProperty("优先级别编码")
@Excel(name = "优先级别编码")
private String priorityLevelCode;
@ApiModelProperty("优先级别名称")
@Excel(name = "优先级别名称")
private String priorityLevelName;
} }
@@ -168,4 +168,28 @@ public class PickingOrderDO extends BaseVOEntity {
@ApiModelProperty("作业拣货物料种数(当前拣货作业物料种数)") @ApiModelProperty("作业拣货物料种数(当前拣货作业物料种数)")
@Excel(name = "作业拣货物料种数(当前拣货作业物料种数)") @Excel(name = "作业拣货物料种数(当前拣货作业物料种数)")
private Integer actualPickingMaterialQuantity; private Integer actualPickingMaterialQuantity;
@ApiModelProperty("出库单号")
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("业务单号")
@Excel(name = "业务单号")
private String businessOrderNo;
@ApiModelProperty("出库单类型编码")
@Excel(name = "出库单类型编码")
private String orderTypeCode;
@ApiModelProperty("出库单类型名称")
@Excel(name = "出库单类型名称")
private String orderTypeName;
@ApiModelProperty("优先级别编码")
@Excel(name = "优先级别编码")
private String priorityLevelCode;
@ApiModelProperty("优先级别名称")
@Excel(name = "优先级别名称")
private String priorityLevelName;
} }
@@ -163,7 +163,7 @@ public class ReviewOrderDomainService {
if (reviewOrderId == null) { if (reviewOrderId == null) {
throw new ServiceException("复核单主表保存失败"); throw new ServiceException("复核单主表保存失败");
} }
String outOrderNumber1 = stockOutOrder.getOutOrderNumber();
int detailInserted = 0; int detailInserted = 0;
for (PickingOrder po : pickingOrders) { for (PickingOrder po : pickingOrders) {
List<PickingMaterialDetail> lines = pickingMaterialDetailService.list(new LambdaQueryWrapper<PickingMaterialDetail>() List<PickingMaterialDetail> lines = pickingMaterialDetailService.list(new LambdaQueryWrapper<PickingMaterialDetail>()
@@ -175,6 +175,7 @@ public class ReviewOrderDomainService {
continue; continue;
} }
ReviewMaterialDetail row = buildDetailFromPicking(line, reviewOrderId, reviewOrderNumber, outOrderNumber, loginUser, now); ReviewMaterialDetail row = buildDetailFromPicking(line, reviewOrderId, reviewOrderNumber, outOrderNumber, loginUser, now);
row.setOutOrderNumber(outOrderNumber1);
reviewMaterialDetailMapper.insert(row); reviewMaterialDetailMapper.insert(row);
detailInserted++; detailInserted++;
} }
@@ -211,6 +212,11 @@ public class ReviewOrderDomainService {
d.setBarCode(line.getBarCode()); d.setBarCode(line.getBarCode());
d.setUnitCode(line.getUnitCode()); d.setUnitCode(line.getUnitCode());
d.setUnitName(line.getUnitName()); d.setUnitName(line.getUnitName());
d.setLotNo(line.getLotNo());
d.setPackId(String.valueOf(line.getPackId()));
d.setPackCode(line.getPackCode());
d.setPackName(line.getPackName());
d.setPackDetailId(String.valueOf(line.getPackDetailId()));
BigDecimal pending = line.getPickingQuantity() != null ? line.getPickingQuantity() : line.getQuantity(); BigDecimal pending = line.getPickingQuantity() != null ? line.getPickingQuantity() : line.getQuantity();
if (pending == null) { if (pending == null) {
@@ -733,7 +733,7 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl<ReceiptMaterialDetail
QueryWrapper<InMaterialDetail> queryWrapper = new QueryWrapper<>(); QueryWrapper<InMaterialDetail> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("unique_id", receiptMaterialDetailPO.getInUniqueId()); queryWrapper.eq("unique_id", receiptMaterialDetailPO.getInUniqueId());
queryWrapper.eq("del_flag", 1); queryWrapper.eq("del_flag", 1);
InMaterialDetail inMaterialDetail = iInMaterialDetailService.getOne(queryWrapper); InMaterialDetail inMaterialDetail = iInMaterialDetailService.list(queryWrapper).get(0);
if (inMaterialDetail == null) { if (inMaterialDetail == null) {
return; return;
} }
@@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity; import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@@ -54,6 +58,10 @@ public class ReviewMaterialDetail extends BaseVOEntity {
private String batchNumber; private String batchNumber;
@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; private Date productionDate;
private Date expiryDate; private Date expiryDate;
@@ -89,4 +97,20 @@ public class ReviewMaterialDetail extends BaseVOEntity {
private BigDecimal areaSqm; private BigDecimal areaSqm;
private String remark; private String remark;
@ApiModelProperty("包装规格id")
@Excel(name = "包装规格id")
private String packId;
@ApiModelProperty("包装规格编码")
@Excel(name = "包装规格编码")
private String packCode;
@ApiModelProperty("包装规格名称")
@Excel(name = "包装规格名称")
private String packName;
@ApiModelProperty("包装详情id")
@Excel(name = "包装详情id")
private String packDetailId;
} }
@@ -470,13 +470,19 @@ public class ShelfMaterialDetailImpl extends ServiceImpl<ShelfMaterialDetailMapp
@Autowired @Autowired
private IStockShelfOrderService stockShelfOrderService; private IStockShelfOrderService stockShelfOrderService;
private void OMSWarehouseEntryDetails(ShelfMaterialDetailDO shelfMaterialDetailDO) { private void OMSWarehouseEntryDetails(ShelfMaterialDetailDO shelfMaterialDetailDO) {
if (shelfMaterialDetailDO.getOmsInMaterialDetail() == null){ if (shelfMaterialDetailDO.getOmsInMaterialDetail() != null){
return; String omsInMaterialDetail = shelfMaterialDetailDO.getOmsInMaterialDetail();//oms详情id
shelfMaterialDetailDO.getShelvesQuantity();//入库件数
shelfMaterialDetailDO.getTotalNetWeight();//重量
stockShelfOrderService.updateOmsDocument(shelfMaterialDetailDO.getShelvesQuantity(),shelfMaterialDetailDO.getTotalNetWeight(),omsInMaterialDetail);
}else {
shelfMaterialDetailDO.getLotNumber();
shelfMaterialDetailDO.getShelvesQuantity();//入库件数
shelfMaterialDetailDO.getTotalNetWeight();//重量
stockShelfOrderService.updateOmsDocumentLot(shelfMaterialDetailDO.getShelvesQuantity(),
shelfMaterialDetailDO.getTotalNetWeight(),shelfMaterialDetailDO.getLotNumber());
} }
String omsInMaterialDetail = shelfMaterialDetailDO.getOmsInMaterialDetail();//oms详情id
shelfMaterialDetailDO.getShelvesQuantity();//入库件数
shelfMaterialDetailDO.getTotalNetWeight();//重量
stockShelfOrderService.updateOmsDocument(shelfMaterialDetailDO.getShelvesQuantity(),shelfMaterialDetailDO.getTotalNetWeight(),omsInMaterialDetail);
} }
/** /**
@@ -136,5 +136,9 @@ public class StockReceiptOrder extends BaseVOEntity {
@Excel(name = "oms入库单id") @Excel(name = "oms入库单id")
private String omsStockInOrderId; private String omsStockInOrderId;
@ApiModelProperty("业务单号")
@Excel(name = "业务单号")
private String businessOrderNo;
} }
@@ -186,4 +186,8 @@ public class StockReceiptOrderPO extends StockInOrderBasePO {
@ApiModelProperty(name = "费用参数json") @ApiModelProperty(name = "费用参数json")
private String billingJson; private String billingJson;
@ApiModelProperty("业务单号")
@Excel(name = "业务单号")
private String businessOrderNo;
} }
@@ -192,4 +192,8 @@ public class StockReceiptOrderDO extends StockInOrderBaseDO {
@ApiModelProperty("oms入库单id") @ApiModelProperty("oms入库单id")
@Excel(name = "oms入库单id") @Excel(name = "oms入库单id")
private String omsStockInOrderId; private String omsStockInOrderId;
@ApiModelProperty("业务单号")
@Excel(name = "业务单号")
private String businessOrderNo;
} }
@@ -51,4 +51,8 @@ public interface IStockShelfOrderService extends IService<StockShelfOrder>
public void updateOmsOrder(String orderNumber, Integer status, Integer shelvesQuantity); public void updateOmsOrder(String orderNumber, Integer status, Integer shelvesQuantity);
public void updateOmsDocument(BigDecimal shelvesQuantity, BigDecimal totalNetWeight, String omsInMaterialDetail); public void updateOmsDocument(BigDecimal shelvesQuantity, BigDecimal totalNetWeight, String omsInMaterialDetail);
public void updateOmsHandover(BigDecimal checkQuantity, BigDecimal totalNetWeight, String outOrderNumber, Long uniqueId);
public void updateOmsDocumentLot(BigDecimal shelvesQuantity, BigDecimal totalNetWeight, String lotNumber);
} }
@@ -24,5 +24,9 @@ public interface StockShelfOrderMapper extends BaseMapper<StockShelfOrder>
public void updateOmsOrder(@Param("orderNumber") String orderNumber, @Param("status") Integer status, @Param("shelvesQuantity") Integer shelvesQuantity); public void updateOmsOrder(@Param("orderNumber") String orderNumber, @Param("status") Integer status, @Param("shelvesQuantity") Integer shelvesQuantity);
void updateOmsDocument(BigDecimal shelvesQuantity, BigDecimal totalNetWeight, String omsInMaterialDetail); void updateOmsDocument(@Param("shelvesQuantity") BigDecimal shelvesQuantity, @Param("totalNetWeight") BigDecimal totalNetWeight, @Param("omsInMaterialDetail") String omsInMaterialDetail);
void updateOmsHandover(@Param("checkQuantity") BigDecimal checkQuantity, @Param("totalNetWeight") BigDecimal totalNetWeight, @Param("outOrderNumber") String outOrderNumber, @Param("uniqueId") Long uniqueId);
void updateOmsDocumentLot(@Param("shelvesQuantity") BigDecimal shelvesQuantity, @Param("totalNetWeight") BigDecimal totalNetWeight, @Param("lotNumber") String lotNumber);
} }
@@ -118,6 +118,16 @@ public class StockShelfOrderImpl extends ServiceImpl<StockShelfOrderMapper, Stoc
stockShelfOrderMapper.updateOmsDocument(shelvesQuantity, totalNetWeight, omsInMaterialDetail); stockShelfOrderMapper.updateOmsDocument(shelvesQuantity, totalNetWeight, omsInMaterialDetail);
} }
@Override
public void updateOmsHandover(BigDecimal checkQuantity, BigDecimal totalNetWeight, String outOrderNumber, Long uniqueId) {
stockShelfOrderMapper.updateOmsHandover(checkQuantity, totalNetWeight, outOrderNumber, uniqueId);
}
@Override
public void updateOmsDocumentLot(BigDecimal shelvesQuantity, BigDecimal totalNetWeight, String lotNumber) {
stockShelfOrderMapper.updateOmsDocumentLot(shelvesQuantity, totalNetWeight, lotNumber);
}
/** /**
* @description 更新订单任务下发状态 * @description 更新订单任务下发状态
* @author ZhouGY * @author ZhouGY
@@ -19,8 +19,10 @@ import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.utils.uuid.IdGenerator; import com.mhd.common.core.utils.uuid.IdGenerator;
import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.security.utils.SecurityUtils; import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.OmsServiceFeign;
import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.domain.ContainerFeignPO; import com.mhd.system.api.domain.ContainerFeignPO;
import com.mhd.system.api.domain.MaterialInventoryOmsParamDO;
import com.mhd.system.api.model.LoginUser; import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.containerUsageRecord.repository.facade.IContainerUsageRecordService; import com.mhd.wms.domain.containerUsageRecord.repository.facade.IContainerUsageRecordService;
import com.mhd.wms.domain.containerUsageRecord.repository.todo.ContainerUsageRecordDO; import com.mhd.wms.domain.containerUsageRecord.repository.todo.ContainerUsageRecordDO;
@@ -135,6 +137,8 @@ public class StockShelfOrderDomainService {
private MaterialBaseInfoMapper materialBaseInfoMapper; private MaterialBaseInfoMapper materialBaseInfoMapper;
@Autowired @Autowired
private ICopyCodeReferenceService copyCodeReferenceService; private ICopyCodeReferenceService copyCodeReferenceService;
@Autowired
private OmsServiceFeign omsServiceFeign;
/** /**
* 分页查询上架单列表 * 分页查询上架单列表
@@ -1068,6 +1072,11 @@ public class StockShelfOrderDomainService {
//库存调整记录 //库存调整记录
materialInventoryService.xgkc(inventoryParamDO); materialInventoryService.xgkc(inventoryParamDO);
materialInventoryService.kctzjl(inventoryParamDO,"入库", loginUser); materialInventoryService.kctzjl(inventoryParamDO,"入库", loginUser);
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(inventoryParamDO, materialInventoryOmsParamDO);
materialInventoryOmsParamDO.setKctzType("入库");
materialInventoryOmsParamDO.setLoginUser(loginUser);
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
//抄码商品对照数据插入 //抄码商品对照数据插入
copyCodeProductComparison(materialBaseInfo,shelfMaterialDetail,inventoryParamDO); copyCodeProductComparison(materialBaseInfo,shelfMaterialDetail,inventoryParamDO);
} else if (materialInventoryPOS.size() == 1) { } else if (materialInventoryPOS.size() == 1) {
@@ -1125,6 +1134,11 @@ public class StockShelfOrderDomainService {
//库存调整记录 //库存调整记录
materialInventoryService.kctzjl(inventoryParamDO, "入库", loginUser); materialInventoryService.kctzjl(inventoryParamDO, "入库", loginUser);
materialInventoryService.xgkc(inventoryParamDO); materialInventoryService.xgkc(inventoryParamDO);
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(inventoryParamDO, materialInventoryOmsParamDO);
materialInventoryOmsParamDO.setKctzType("入库");
materialInventoryOmsParamDO.setLoginUser(loginUser);
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
//抄码商品对照数据插入 //抄码商品对照数据插入
copyCodeProductComparison(materialBaseInfo,shelfMaterialDetail,inventoryParamDO); copyCodeProductComparison(materialBaseInfo,shelfMaterialDetail,inventoryParamDO);
} }
@@ -15,6 +15,15 @@ public class CopyCodeReferenceDTO extends BaseVOEntity {
@ApiModelProperty("ID") @ApiModelProperty("ID")
private Long id; private Long id;
@ApiModelProperty("组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
private String organizationName;
@ApiModelProperty("一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("货主ID") @ApiModelProperty("货主ID")
private Long shipperId; private Long shipperId;
@@ -82,6 +82,8 @@ public class InOrderAbnormalDTO extends BaseVOEntity {
@Excel(name = "备注") @Excel(name = "备注")
private String remark; private String remark;
@ApiModelProperty("仓库id(列表筛选,关联 stock_in_order")
private Long warehouseId;
@ApiModelProperty(name = "组织ID集合") @ApiModelProperty(name = "组织ID集合")
private List<Long> organizationIdList; private List<Long> organizationIdList;
@@ -1,5 +1,7 @@
package com.mhd.wms.interfaces.dto.outMaterialDetail; package com.mhd.wms.interfaces.dto.outMaterialDetail;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.mhd.common.core.annotation.Excel; import com.mhd.common.core.annotation.Excel;
@@ -8,8 +10,10 @@ import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
import com.mhd.wms.interfaces.dto.outMaterialDetailSerialNumber.OutMaterialDetailSerialNumberDTO; import com.mhd.wms.interfaces.dto.outMaterialDetailSerialNumber.OutMaterialDetailSerialNumberDTO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
@@ -475,4 +479,10 @@ public class OutMaterialDetailDTO extends BaseVOEntity {
@Excel(name = "取消分配抄码id数组") @Excel(name = "取消分配抄码id数组")
private List<Integer> copyCodeReferenceIdsCancel; private List<Integer> copyCodeReferenceIdsCancel;
@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;
} }
@@ -78,6 +78,14 @@ public class OutOrderAbnormalDTO extends BaseVOEntity {
@Excel(name = "备注") @Excel(name = "备注")
private String remark; private String remark;
@ApiModelProperty("仓库id(列表筛选,关联 stock_out_order")
private Long warehouseId;
@ApiModelProperty("货主id(列表筛选,关联 stock_out_order")
private Long shipperId;
@ApiModelProperty("出库单类型编码(列表筛选,关联 stock_out_order")
private String orderTypeCode;
@ApiModelProperty(name = "组织ID集合") @ApiModelProperty(name = "组织ID集合")
private List<Long> organizationIdList; private List<Long> organizationIdList;
@@ -1,5 +1,6 @@
package com.mhd.wms.interfaces.dto.pickingMaterialDetail; package com.mhd.wms.interfaces.dto.pickingMaterialDetail;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.mhd.common.core.annotation.Excel; import com.mhd.common.core.annotation.Excel;
@@ -7,8 +8,10 @@ import com.mhd.common.core.web.domain.BaseVOEntity;
import com.mhd.wms.domain.outMaterialDetailSerialNumber.repository.todo.OutMaterialDetailSerialNumberDO; import com.mhd.wms.domain.outMaterialDetailSerialNumber.repository.todo.OutMaterialDetailSerialNumberDO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -236,4 +239,18 @@ public class PickingMaterialDetailDTO extends BaseVOEntity {
@ApiModelProperty("抄码id数组 逗号分隔") @ApiModelProperty("抄码id数组 逗号分隔")
@Excel(name = "抄码id数组") @Excel(name = "抄码id数组")
private String copyCodeReferenceIds; private String copyCodeReferenceIds;
@ApiModelProperty("lot编号")
@Excel(name = "lot编号")
private String lotNo;
@ApiModelProperty("入库单号")
@Excel(name = "入库单号")
private String inOrderNumber;
@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;
} }
@@ -163,4 +163,8 @@ public class StockReceiptOrderDTO extends StockInOrderBaseDTO {
@ApiModelProperty("oms入库单id") @ApiModelProperty("oms入库单id")
@Excel(name = "oms入库单id") @Excel(name = "oms入库单id")
private String omsStockInOrderId; private String omsStockInOrderId;
@ApiModelProperty("业务单号")
@Excel(name = "业务单号")
private String businessOrderNo;
} }
@@ -84,6 +84,12 @@
del_flag del_flag
FROM copy_code_reference FROM copy_code_reference
WHERE del_flag = 1 WHERE del_flag = 1
<if test="topOrganizationId != null">
AND top_organization_id = #{topOrganizationId}
</if>
<if test="organizationId != null">
AND organization_id = #{organizationId}
</if>
<if test="warehouseId != null"> <if test="warehouseId != null">
AND warehouse_id = #{warehouseId} AND warehouse_id = #{warehouseId}
</if> </if>
@@ -119,6 +125,12 @@
AND material_code = #{materialCode} AND material_code = #{materialCode}
AND batch_number = #{batchNumber} AND batch_number = #{batchNumber}
AND box_pallet_no = #{boxPalletNo} AND box_pallet_no = #{boxPalletNo}
<if test="topOrganizationId != null">
AND top_organization_id = #{topOrganizationId}
</if>
<if test="organizationId != null">
AND organization_id = #{organizationId}
</if>
ORDER BY serial_number ORDER BY serial_number
</select> </select>
@@ -170,10 +170,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="containerTypeName != null and containerTypeName != ''"> <if test="containerTypeName != null and containerTypeName != ''">
and a.container_type_name like concat('%', #{containerTypeName}, '%') and a.container_type_name like concat('%', #{containerTypeName}, '%')
</if> </if>
<choose> <!--<choose>
<when test="inventoryQuantity != null"> and a.inventory_quantity = #{inventoryQuantity} </when> <when test="inventoryQuantity != null"> and a.inventory_quantity = #{inventoryQuantity} </when>
<otherwise> and a.inventory_quantity != 0 </otherwise> <otherwise> and a.inventory_quantity != 0 </otherwise>
</choose> </choose>-->
<if test="inventoryQuantity != null ">
and a.inventory_quantity = #{inventoryQuantity}
</if>
<if test="allocationQuantity != null "> <if test="allocationQuantity != null ">
and a.allocation_quantity = #{allocationQuantity} and a.allocation_quantity = #{allocationQuantity}
</if> </if>
@@ -92,14 +92,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<sql id="joinStockOutOrderPoWhere"> <sql id="joinStockOutOrderPoWhere">
<if test="warehouseId != null and warehouseId != '' "> <if test="warehouseId != null">
and b.warehouse_id = #{warehouseId} and b.warehouse_id = #{warehouseId}
</if> </if>
<if test="shipperId != null and shipperId != ''"> <if test="shipperId != null">
and b.shipper_id = #{shipperId} and b.shipper_id = #{shipperId}
</if> </if>
<if test="orderTypeCode != null and orderTypeCode != ''"> <if test="orderTypeCode != null and orderTypeCode != ''">
and a.order_type_code = #{orderTypeCode} and b.order_type_code = #{orderTypeCode}
</if> </if>
<choose> <choose>
<when test="delFlag != null"> and b.del_flag = #{delFlag} </when> <when test="delFlag != null"> and b.del_flag = #{delFlag} </when>
@@ -64,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="outUniqueId" column="out_unique_id" /> <result property="outUniqueId" column="out_unique_id" />
<result property="copyCodeReferenceIds" column="COPY_CODE_REFERENCE_IDS" /> <result property="copyCodeReferenceIds" column="COPY_CODE_REFERENCE_IDS" />
<result property="pickedCopyCodeReferenceIds" column="picked_copy_code_reference_ids" /> <result property="pickedCopyCodeReferenceIds" column="picked_copy_code_reference_ids" />
<result property="lotNo" column="lot_no" />
<result property="inOrderNumber" column="in_order_number" />
</resultMap> </resultMap>
@@ -81,7 +83,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.total_area, a.total_gross_weight, a.total_net_weight, a.total_volume, a.out_unique_id, a.total_area, a.total_gross_weight, a.total_net_weight, a.total_volume, a.out_unique_id,
a.COPY_CODE_REFERENCE_IDS, a.COPY_CODE_REFERENCE_IDS,
a.picked_copy_code_reference_ids, a.picked_copy_code_reference_ids,
omd.in_order_number, omd.lot_no as lot_number omd.in_order_number, omd.lot_no as lot_number,
a.lot_No,a.in_order_number
</sql> </sql>
<sql id="selectPickingMaterialDetailPo1"> <sql id="selectPickingMaterialDetailPo1">
@@ -26,6 +26,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" /> <result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
<result property="outOrderNumber" column="out_order_number" />
<result property="businessOrderNo" column="business_order_no" />
<result property="orderTypeCode" column="order_type_code" />
<result property="orderTypeName" column="order_type_name" />
<result property="priorityLevelCode" column="priority_level_code" />
<result property="priorityLevelName" column="priority_level_name" />
</resultMap> </resultMap>
@@ -34,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.status, a.type, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id, a.shipper_name, a.quantity, a.weight_limit, a.volume_limit, a.material_quantity, a.status, a.type, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id, a.shipper_name, a.quantity, a.weight_limit, a.volume_limit, a.material_quantity,
IFNULL((SELECT SUM(b.picking_quantity) FROM picking_material_detail b WHERE b.picking_order_number = a.picking_order_number AND b.del_flag = 1), 0) AS picking_quantity, IFNULL((SELECT SUM(b.picking_quantity) FROM picking_material_detail b WHERE b.picking_order_number = a.picking_order_number AND b.del_flag = 1), 0) AS picking_quantity,
a.picking_material_quantity, a.abnormal, a.task_distribution, a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time, a.picking_material_quantity, a.abnormal, a.task_distribution, a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time,
a.update_by, a.update_by_name, a.del_flag a.update_by, a.update_by_name, a.del_flag,a.out_order_number, a.business_order_no, a.order_type_code, a.order_type_name, a.priority_level_code, a.priority_level_name
</sql> </sql>
<sql id="selectPickingOrderPo1"> <sql id="selectPickingOrderPo1">
@@ -233,7 +233,8 @@
d.update_by, d.update_by,
d.update_by_name, d.update_by_name,
d.update_time, d.update_time,
d.del_flag d.del_flag,
d.pack_id, d.pack_code, d.pack_name, d.pack_detail_id
</sql> </sql>
<!-- 详情:明细 by 复核单主键 --> <!-- 详情:明细 by 复核单主键 -->
@@ -95,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="packName" column="pack_name" /> <result property="packName" column="pack_name" />
<result property="storageLocationName" column="storage_location_name" /> <result property="storageLocationName" column="storage_location_name" />
<result property="omsStockInOrderId" column="stock_in_order" /> <result property="omsStockInOrderId" column="stock_in_order" />
<result property="businessOrderNo" column="business_order_no" />
</resultMap> </resultMap>
<sql id="selectStockInOrderPo"> <sql id="selectStockInOrderPo">
@@ -128,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a."TO", a.CONTACT_PERSON, a.VEHICLE_INFO, a.CONSIGNMENT_NO, a.TEL, a.DRIVER_SIGNATURE, a.FAX, a.DECLARATION_AREA, a.MANUFACTURER, a."TO", a.CONTACT_PERSON, a.VEHICLE_INFO, a.CONSIGNMENT_NO, a.TEL, a.DRIVER_SIGNATURE, a.FAX, a.DECLARATION_AREA, a.MANUFACTURER,
a.CUSTOMS_BROKER_INFO, a.DELIVERY_ADDRESS, a.ENTRY_EXIT_CUSTOMS, a.ORIGIN_DESTINATION_COUNTRY, a.CARRIER, a.CONTAINER_NO, a.CUSTOMS_BROKER_INFO, a.DELIVERY_ADDRESS, a.ENTRY_EXIT_CUSTOMS, a.ORIGIN_DESTINATION_COUNTRY, a.CARRIER, a.CONTAINER_NO,
a.TRANSPORT_METHOD, a.SUPERVISION_METHOD, a.CUSTOMS_INSPECTION, a.NEED_CUSTOMS_DECLARATION, a.NEED_TRANSPORT, a.TRANSPORT_METHOD, a.SUPERVISION_METHOD, a.CUSTOMS_INSPECTION, a.NEED_CUSTOMS_DECLARATION, a.NEED_TRANSPORT,
a.WAREHOUSE_DATE, a.COMPLETION_TIME, a.ORDER_DATE,a.stock_in_order a.WAREHOUSE_DATE, a.COMPLETION_TIME, a.ORDER_DATE,a.stock_in_order,a.business_order_no
</sql> </sql>
<sql id="joinStockInOrderPo"> <sql id="joinStockInOrderPo">
@@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="boxPalletNo" column="boxPalletNo"/> <result property="boxPalletNo" column="boxPalletNo"/>
<result property="serialNumber" column="serial_number"/> <result property="serialNumber" column="serial_number"/>
<result property="billingJson" column="billing_json" /> <result property="billingJson" column="billing_json" />
<result property="businessOrderNo" column="business_order_no" />
</resultMap> </resultMap>
@@ -51,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.status, a.platform_id, a.platform_code, a.platform_name, a.platform_use_time_id, a.platform_use_start_time, a.platform_use_end_time, a.status, a.platform_id, a.platform_code, a.platform_name, a.platform_use_time_id, a.platform_use_start_time, a.platform_use_end_time,
a.platform_use_status, a.quantity, a.receipt_quantity, a.receipt_material_quantity, a.material_quantity, a.abnormal, a.task_distribution, a.task_distribution_time, a.platform_use_status, a.quantity, a.receipt_quantity, a.receipt_material_quantity, a.material_quantity, a.abnormal, a.task_distribution, a.task_distribution_time,
a.operators_by, a.operators_name, a.remark, a.create_time, a.create_by, a.create_by_name, a.operators_by, a.operators_name, a.remark, a.create_time, a.create_by, a.create_by_name,
a.update_time, a.update_by, a.update_by_name, a.del_flag, a.billing_json a.update_time, a.update_by, a.update_by_name, a.del_flag, a.billing_json,a.business_order_no
</sql> </sql>
<sql id="selectStockReceiptOrderPo1"> <sql id="selectStockReceiptOrderPo1">
@@ -126,9 +126,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<update id="updateOmsOrder"> <update id="updateOmsOrder">
update "NGWL_TEST_OMS".RESERVATION_STOCK_IN_ORDER set ISSUE_STATUS = #{status},quantity = #{shelvesQuantity},STORAGE_TIME = CURRENT_TIMESTAMP where IN_ORDER_NUMBER = #{orderNumber} update "NGWL_TEST_OMS".RESERVATION_STOCK_IN_ORDER set ISSUE_STATUS = #{status},in_quantity = #{shelvesQuantity},STORAGE_TIME = CURRENT_TIMESTAMP where IN_ORDER_NUMBER = #{orderNumber}
</update> </update>
<update id="updateOmsDocument"> <update id="updateOmsDocument">
update "NGWL_TEST_OMS".RESERVATION_IN_MATERIAL_DETAIL set INBOUND_ITEMS = #{shelvesQuantity}, TOTAL_NET_WEIGHT= #{totalNetWeight},STORAGE_TIME = CURRENT_TIMESTAMP where MATERIAL_DETAIL_ID = #{omsInMaterialDetail} update "NGWL_TEST_OMS".RESERVATION_IN_MATERIAL_DETAIL set INBOUND_ITEMS = #{shelvesQuantity}, TOTAL_NET_WEIGHT= #{totalNetWeight},STORAGE_TIME = CURRENT_TIMESTAMP where MATERIAL_DETAIL_ID = #{omsInMaterialDetail}
</update> </update>
<update id="updateOmsHandover">
update "NGWL_TEST_OMS".RESERVATION_OUT_MATERIAL_DETAIL set INBOUND_ITEMS = #{checkQuantity},
TOTAL_NET_WEIGHT= #{totalNetWeight}
,STORAGE_TIME = CURRENT_TIMESTAMP
where OUT_ORDER_NUMBER = #{outOrderNumber} and UNIQUE_ID = #{uniqueId}
</update>
<update id="updateOmsDocumentLot">
update "NGWL_TEST_OMS".RESERVATION_IN_MATERIAL_DETAIL set INBOUND_ITEMS = #{shelvesQuantity}, TOTAL_NET_WEIGHT= #{totalNetWeight},STORAGE_TIME = CURRENT_TIMESTAMP
where LOT_NO = #{lotNumber}
</update>
</mapper> </mapper>
+286 -1
View File
@@ -176,4 +176,289 @@ COMMENT ON COLUMN "NGWL_TEST_WMS"."OUT_MATERIAL_DETAIL"."CONTRACT_FEE" IS '合
COMMENT ON COLUMN "NGWL_TEST_WMS"."OUT_MATERIAL_DETAIL"."STOCK_UNIT" IS '库存单位'; COMMENT ON COLUMN "NGWL_TEST_WMS"."OUT_MATERIAL_DETAIL"."STOCK_UNIT" IS '库存单位';
COMMENT ON COLUMN "NGWL_TEST_WMS"."OUT_MATERIAL_DETAIL"."STOCK_QUANTITY" IS '库存件数' COMMENT ON COLUMN "NGWL_TEST_WMS"."OUT_MATERIAL_DETAIL"."STOCK_QUANTITY" IS '库存件数'
----------------------------------已发布生产----------------------------------------
/*
Navicat Premium Dump SQL
Source Server : 113.44.106.61
Source Server Type : Dameng
Source Server Version : 8014116 (08.01.4116)
Source Host : 113.44.106.61:5236
Source Schema : NGWL_TEST_OMS
Target Server Type : Dameng
Target Server Version : 8014116 (08.01.4116)
File Encoding : 65001
Date: 22/04/2026 08:57:55
*/
-- ----------------------------
-- Table structure for RESERVATION_MATERIAL_INVENTORY
-- ----------------------------
DROP TABLE IF EXISTS "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY";
CREATE TABLE "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY" (
"RESERVATION_MATERIAL_INVENTORY_ID" BIGINT IDENTITY(1,1) NOT NULL,
"ORGANIZATION_ID" BIGINT DEFAULT 0,
"ORGANIZATION_NAME" VARCHAR(100 CHAR) DEFAULT '',
"TOP_ORGANIZATION_ID" BIGINT DEFAULT 0,
"MATERIAL_BASE_INFO_ID" BIGINT DEFAULT 0,
"MATERIAL_DETAIL_ID" BIGINT,
"WAREHOUSE_ID" BIGINT DEFAULT 0,
"WAREHOUSE_CODE" VARCHAR(32 CHAR) DEFAULT '',
"WAREHOUSE_NAME" VARCHAR(64 CHAR) DEFAULT '',
"STORAGE_SECTION_ID" BIGINT DEFAULT 0,
"STORAGE_CODE" VARCHAR(32 CHAR) DEFAULT '',
"STORAGE_NAME" VARCHAR(64 CHAR) DEFAULT '',
"STORAGE_LOCATION_ID" BIGINT DEFAULT 0,
"STORAGE_LOCATION_CODE" VARCHAR(32 CHAR) DEFAULT '',
"STORAGE_LOCATION_NAME" VARCHAR(64 CHAR) DEFAULT '',
"BATCH_NUMBER" VARCHAR(50 CHAR) DEFAULT '',
"MATERIAL_STATUS_CODE" VARCHAR(32 CHAR) DEFAULT '',
"MATERIAL_STATUS_NAME" VARCHAR(64 CHAR) DEFAULT '',
"CONTAINER_ID" BIGINT DEFAULT 0 NOT NULL,
"CONTAINER_CODE" VARCHAR(32 CHAR) DEFAULT '',
"CONTAINER_TYPE" VARCHAR(32 CHAR) DEFAULT '',
"CONTAINER_TYPE_NAME" VARCHAR(64 CHAR) DEFAULT '',
"INVENTORY_QUANTITY" DECIMAL(20,2) DEFAULT 0.,
"ALLOCATION_QUANTITY" DECIMAL(20,2) DEFAULT 0.,
"FREEZE_QUANTITY" DECIMAL(20,2) DEFAULT 0.,
"REMARK" VARCHAR(255 CHAR) DEFAULT '',
"CREATE_TIME" TIMESTAMP,
"CREATE_BY" BIGINT DEFAULT 0,
"CREATE_BY_NAME" VARCHAR(20 CHAR) DEFAULT '',
"UPDATE_TIME" TIMESTAMP,
"UPDATE_BY" BIGINT DEFAULT 0,
"UPDATE_BY_NAME" VARCHAR(20 CHAR) DEFAULT '',
"DEL_FLAG" TINYINT DEFAULT 1,
"IS_ABLE" TINYINT DEFAULT 1,
"UNIT" VARCHAR2(128),
"NET_WEIGHT" DECIMAL(10,2),
"GROSS_WEIGHT" DECIMAL(10,2),
"VOLUME" DECIMAL(10,2),
"AREA" DECIMAL(10,2),
"SHIPPER_ID" BIGINT,
"SHIPPER_CODE" VARCHAR(50),
"SHIPPER_NAME" VARCHAR(100),
"PRODUCTION_DATE" DATE,
"EXPIRY_DATE" DATE,
"INVENTORY_DATE" DATE,
"BATCH_REF_NO" VARCHAR(100),
"SHEET_REF_NO" VARCHAR(100),
"BOX_PALLET_NO" VARCHAR(200),
"EXT_ATTR_1" VARCHAR2(255),
"EXT_ATTR_2" VARCHAR2(255),
"EXT_ATTR_3" DATE DEFAULT '',
"EXT_ATTR_4" DATE,
"UNIT_NAME" VARCHAR2(255),
"BAR_CODE" VARCHAR(255),
"IN_ORDER_NUMBER" VARCHAR(100),
"LOT_NUMBER" VARCHAR(100)
)
;
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."RESERVATION_MATERIAL_INVENTORY_ID" IS '物料库存id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."ORGANIZATION_ID" IS '组织表ID';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."ORGANIZATION_NAME" IS '组织名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."TOP_ORGANIZATION_ID" IS '一级组织表ID';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."MATERIAL_BASE_INFO_ID" IS '物料基础信息id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."MATERIAL_DETAIL_ID" IS '上架单物料明细id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."WAREHOUSE_ID" IS '仓库id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."WAREHOUSE_CODE" IS '仓库编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."WAREHOUSE_NAME" IS '仓库名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."STORAGE_SECTION_ID" IS '库区id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."STORAGE_CODE" IS '库区编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."STORAGE_NAME" IS '库区名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."STORAGE_LOCATION_ID" IS '库位id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."STORAGE_LOCATION_CODE" IS '库位编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."STORAGE_LOCATION_NAME" IS '库位名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."BATCH_NUMBER" IS '批次号';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."MATERIAL_STATUS_CODE" IS '物料状态编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."MATERIAL_STATUS_NAME" IS '物料状态名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."CONTAINER_ID" IS '容器id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."CONTAINER_CODE" IS '容器编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."CONTAINER_TYPE" IS '容器类型 数据字典';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."CONTAINER_TYPE_NAME" IS '容器类型名称 数据字典';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."INVENTORY_QUANTITY" IS '库存数量';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."ALLOCATION_QUANTITY" IS '可用数量';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."FREEZE_QUANTITY" IS '冻结数量';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."REMARK" IS '备注';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."CREATE_BY" IS '创建人用户ID';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."CREATE_BY_NAME" IS '创建人姓名';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."UPDATE_TIME" IS '最后修改时间';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."UPDATE_BY" IS '最后修改人用户ID';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."UPDATE_BY_NAME" IS '修改人姓名';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."DEL_FLAG" IS '删除标记:0-无状态,1-正常,2-已删除';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."IS_ABLE" IS '盘点是否可用:0-禁用 1-可用';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."UNIT" IS '单位';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."NET_WEIGHT" IS '净重(KG)';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."GROSS_WEIGHT" IS '毛重(KG)';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."VOLUME" IS '体积(CBM)';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."AREA" IS '面积(SQM)';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."SHIPPER_ID" IS '货主ID';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."SHIPPER_CODE" IS '货主编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."SHIPPER_NAME" IS '货主名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."PRODUCTION_DATE" IS '生产日期';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."EXPIRY_DATE" IS '过期日期';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."INVENTORY_DATE" IS '存货日期';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."BATCH_REF_NO" IS 'Batch Ref NO''s';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."SHEET_REF_NO" IS 'Sheet Ref NO''s';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."BOX_PALLET_NO" IS '箱号/卡板号';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."EXT_ATTR_1" IS '扩展字段1';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."EXT_ATTR_2" IS '扩展字段2';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."EXT_ATTR_3" IS '扩展字段3';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."EXT_ATTR_4" IS '扩展字段4';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."UNIT_NAME" IS '单位名';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."IN_ORDER_NUMBER" IS '入库单号';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY"."LOT_NUMBER" IS 'LOT编号';
COMMENT ON TABLE "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY" IS '物料库存表';
-- ----------------------------
-- Primary Key structure for table RESERVATION_MATERIAL_INVENTORY
-- ----------------------------
ALTER TABLE "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY" ADD PRIMARY KEY ("RESERVATION_MATERIAL_INVENTORY_ID");
-- ----------------------------
-- Indexes structure for table RESERVATION_MATERIAL_INVENTORY
-- ----------------------------
CREATE INDEX "NGWL_TEST_OMS"."IDX_MAT_INV_BASE_ID"
ON "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY" ("MATERIAL_BASE_INFO_ID" ASC)
UNUSABLE;
CREATE INDEX "NGWL_TEST_OMS"."IDX_MAT_INV_LOC_MAT_SHIPPER_ID"
ON "NGWL_TEST_OMS"."RESERVATION_MATERIAL_INVENTORY" ("MATERIAL_BASE_INFO_ID" ASC, "SHIPPER_ID" ASC)
UNUSABLE;
/*
Navicat Premium Dump SQL
Source Server : 113.44.106.61
Source Server Type : Dameng
Source Server Version : 8014116 (08.01.4116)
Source Host : 113.44.106.61:5236
Source Schema : NGWL_TEST_OMS
Target Server Type : Dameng
Target Server Version : 8014116 (08.01.4116)
File Encoding : 65001
Date: 22/04/2026 09:00:34
*/
-- ----------------------------
-- Table structure for RESERVATION_INVENTORY_ADJUSTMENT_RECORD
-- ----------------------------
DROP TABLE IF EXISTS "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD";
CREATE TABLE "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD" (
"INVENTORY_ADJUSTMENT_ID" BIGINT IDENTITY(1,1) NOT NULL,
"ORGANIZATION_ID" BIGINT DEFAULT 0,
"ORGANIZATION_NAME" VARCHAR(100 CHAR) DEFAULT '',
"TOP_ORGANIZATION_ID" BIGINT DEFAULT 0,
"MATERIAL_INVENTORY_ID" BIGINT,
"MATERIAL_BASE_INFO_ID" BIGINT DEFAULT 0,
"MATERIAL_CODE" VARCHAR(32 CHAR) DEFAULT '',
"MATERIAL_NAME" VARCHAR(64 CHAR) DEFAULT '',
"BAR_CODE" VARCHAR(32 CHAR) DEFAULT '',
"SHIPPER_ID" BIGINT DEFAULT 0,
"SHIPPER_NAME" VARCHAR(50 CHAR) DEFAULT '',
"WAREHOUSE_ID" BIGINT DEFAULT 0,
"WAREHOUSE_CODE" VARCHAR(32 CHAR) DEFAULT '',
"WAREHOUSE_NAME" VARCHAR(64 CHAR) DEFAULT '',
"STORAGE_SECTION_ID" BIGINT DEFAULT 0,
"STORAGE_CODE" VARCHAR(32 CHAR) DEFAULT '',
"STORAGE_NAME" VARCHAR(64 CHAR) DEFAULT '',
"STORAGE_LOCATION_ID" BIGINT DEFAULT 0,
"STORAGE_LOCATION_CODE" VARCHAR(32 CHAR) DEFAULT '',
"STORAGE_LOCATION_NAME" VARCHAR(64 CHAR) DEFAULT '',
"ADJUST_TYPE" TINYINT DEFAULT 0,
"ADJUST_DIRECTION" TINYINT DEFAULT 0,
"ADJUST_BEFORE_STATUS_CODE" VARCHAR(32 CHAR) DEFAULT '0',
"ADJUST_BEFORE_STATUS_NAME" VARCHAR(64 CHAR) DEFAULT '',
"ADJUST_AFTER_STATUS_CODE" VARCHAR(32 CHAR) DEFAULT '0',
"ADJUST_AFTER_STATUS_NAME" VARCHAR(64 CHAR) DEFAULT '',
"INVENTORY_BEFORE_QUANTITY" DECIMAL(20,2) DEFAULT 0.,
"ALLOCATION_BEFORE_QUANTITY" DECIMAL(20,2),
"FREEZE_BEFORE_QUANTITY" DECIMAL(20,2),
"INVENTORY_AFTER_QUANTITY" DECIMAL(20,2) DEFAULT 0.,
"ALLOCATION_AFTER_QUANTITY" DECIMAL(20,2),
"FREEZE_AFTER_QUANTITY" DECIMAL(20,2),
"CREATE_TIME" TIMESTAMP,
"CREATE_BY" BIGINT DEFAULT 0,
"CREATE_BY_NAME" VARCHAR(20 CHAR) DEFAULT '',
"UPDATE_TIME" TIMESTAMP,
"UPDATE_BY" BIGINT DEFAULT 0,
"UPDATE_BY_NAME" VARCHAR(20 CHAR) DEFAULT '',
"DEL_FLAG" TINYINT DEFAULT 1,
"ADJUST_ACTION" VARCHAR2(100),
"RELATE_NO" VARCHAR2(128),
"NET_WEIGHT" DECIMAL(18,3) DEFAULT NULL,
"GROSS_WEIGHT" DECIMAL(18,3) DEFAULT NULL,
"VOLUME" DECIMAL(18,3) DEFAULT NULL,
"AREA" DECIMAL(18,3) DEFAULT NULL,
"ADJUSTED_NET_WEIGHT" DECIMAL(18,3) DEFAULT NULL,
"ADJUSTED_GROSS_WEIGHT" DECIMAL(18,3) DEFAULT NULL,
"ADJUSTED_VOLUME" DECIMAL(18,3) DEFAULT NULL,
"ADJUSTED_AREA" DECIMAL(18,3) DEFAULT NULL,
"IN_ORDER_NUMBER" VARCHAR(100),
"LOT_NUMBER" VARCHAR(100),
"BATCH_NUMBER" VARCHAR(50 CHAR) DEFAULT ''
)
;
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."INVENTORY_ADJUSTMENT_ID" IS '库存调整记录id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ORGANIZATION_ID" IS '组织表ID';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ORGANIZATION_NAME" IS '组织名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."TOP_ORGANIZATION_ID" IS '一级组织表ID';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."MATERIAL_INVENTORY_ID" IS '物料库存id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."MATERIAL_BASE_INFO_ID" IS '物料基础信息id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."MATERIAL_CODE" IS '物料编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."MATERIAL_NAME" IS '物料名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."BAR_CODE" IS '物料条形码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."SHIPPER_ID" IS '货主id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."SHIPPER_NAME" IS '货主名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."WAREHOUSE_ID" IS '仓库id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."WAREHOUSE_CODE" IS '仓库编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."WAREHOUSE_NAME" IS '仓库名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."STORAGE_SECTION_ID" IS '库区id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."STORAGE_CODE" IS '库区编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."STORAGE_NAME" IS '库区名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."STORAGE_LOCATION_ID" IS '库位id';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."STORAGE_LOCATION_CODE" IS '库位编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."STORAGE_LOCATION_NAME" IS '库位名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ADJUST_TYPE" IS '调整类型:0:无状态 1:数量调整 2:状态调整 3:库存冻结';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ADJUST_DIRECTION" IS '调整方向:0:无状态 1:增库存 2:减库存';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ADJUST_BEFORE_STATUS_CODE" IS '调整前状态编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ADJUST_BEFORE_STATUS_NAME" IS '调整前状态名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ADJUST_AFTER_STATUS_CODE" IS '调整后状态编码';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ADJUST_AFTER_STATUS_NAME" IS '调整后状态名称';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."INVENTORY_BEFORE_QUANTITY" IS '调整前库存数量';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ALLOCATION_BEFORE_QUANTITY" IS '调整前可用数量';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."FREEZE_BEFORE_QUANTITY" IS '调整前冻结数量';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."INVENTORY_AFTER_QUANTITY" IS '调整后库存数量';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ALLOCATION_AFTER_QUANTITY" IS '调整后可用数量';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."FREEZE_AFTER_QUANTITY" IS '调整后冻结数量';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."CREATE_TIME" IS '创建时间';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."CREATE_BY" IS '创建人用户ID';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."CREATE_BY_NAME" IS '创建人姓名';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."UPDATE_TIME" IS '最后修改时间';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."UPDATE_BY" IS '最后修改人用户ID';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."UPDATE_BY_NAME" IS '修改人姓名';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."DEL_FLAG" IS '删除标记:0-无状态,1-正常,2-已删除';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."ADJUST_ACTION" IS '调整动作';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."RELATE_NO" IS '关联单号';
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD"."BATCH_NUMBER" IS '批次号';
COMMENT ON TABLE "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD" IS '库存调整记录';
-- ----------------------------
-- Primary Key structure for table RESERVATION_INVENTORY_ADJUSTMENT_RECORD
-- ----------------------------
ALTER TABLE "NGWL_TEST_OMS"."RESERVATION_INVENTORY_ADJUSTMENT_RECORD" ADD PRIMARY KEY ("INVENTORY_ADJUSTMENT_ID");
ALTER TABLE "NGWL_TEST_OMS"."RESERVATION_STOCK_IN_ORDER" ADD COLUMN "IN_QUANTITY" DECIMAL(20,2) DEFAULT 0.;
COMMENT ON COLUMN "NGWL_TEST_OMS"."RESERVATION_STOCK_IN_ORDER"."IN_QUANTITY" IS '计划数量';