Skip to content

采入库表 ​

1. 概述 ​

采入库表是梵医云ERP系统中用于管理采购入库流程的核心模块,包括采购订单、采购入库、采购退货、验收入库通知、其它入库等功能。该模块提供了完整的采购管理流程,从采购下单、验收入库到退货处理的全生命周期管理。

2. 表结构 ​

2.1 采购订单表 (erp_purchase_order) ​

采购订单表用于管理采购订单信息,记录采购计划、价格、数量等关键信息。

2.1.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-编号(主键)
novarchar64否-采购订单号
statustinyint4否-采购状态(0草稿 5待提交 10审核中 20通过 30拒绝)
supplier_idbigint20否-供应商编号
account_idbigint20是NULL结算账户编号
order_timedatetime-否-下单时间
total_countint11否0合计数量
total_priceint11否0最终合计价格(单位:分)
total_product_priceint11否0合计产品价格(单位:分)
total_tax_priceint11否0合计税额(单位:分)
discount_percentint11否0优惠率(百分比)
discount_priceint11否0优惠金额(单位:分)
deposit_priceint11是NULL定金金额(单位:分)
total_delivery_priceint11是NULL总配送价(单位:分)
file_urlvarchar512是NULL附件地址
remarkvarchar512是NULL备注
in_countint11否0采购入库数量
return_countint11否0采购退货数量
procure_personnel_idbigint20是NULL采购人员ID
operational_agencies_idbigint20是NULL业务机构ID
store_idbigint20是NULL申请门店ID
reviewerbigint20是NULL审核人ID
contract_typetinyint4是NULL合同类型(0书面合同 1口头协议 2电话要货)
transportation_methodtinyint4是NULL承运方式(0配送 1自提 2托运)
failure_timedatetime-是NULL失效时间
departure_timedatetime-是NULL启运时间
transportation_depart_idbigint20是NULL承运单位ID
transport_methodtinyint4是NULL运输方式(0保温箱 1空运 2陆运 3海运)
consign_idbigint20是NULL委托人ID
take_over_agencies_idbigint20是NULL收货机构ID
take_over_store_idbigint20是NULL收货门店ID
process_instance_idvarchar64是NULL对应的流程编号
okbit1否b'0'是否已经验证(审核通过之后为1)
payment_methodtinyint4是NULL结算方式(0现金结算 1代销现金 2帐期结算 3预付款 4实销实结)
procure_statustinyint4否-采购状态(10采购中 20采购结束)
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.1.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
uk_no唯一no采购订单号唯一索引
idx_supplier_id普通supplier_id供应商索引
idx_status普通status状态索引

2.1.3 Java 实体类 ​

java
@TableName(value = "erp_purchase_order")
@KeySequence("erp_purchase_order_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpPurchaseOrderDO extends BaseDO {

    @TableId
    private Long id;
    private String no;
    private Integer status;
    private Long supplierId;
    private Long accountId;
    private LocalDateTime orderTime;
    private Integer totalCount;
    private Integer totalPrice;
    private Integer totalProductPrice;
    private Integer totalTaxPrice;
    private Integer discountPercent;
    private Integer discountPrice;
    private Integer depositPrice;
    private Integer totalDeliveryPrice;
    private String fileUrl;
    private String remark;
    private Integer inCount;
    private Integer returnCount;
    private Long procurePersonnelId;
    private Long operationalAgenciesId;
    private Long storeId;
    private Long reviewer;
    private Integer contractType;
    private Integer transportationMethod;
    private LocalDateTime failureTime;
    private LocalDateTime departureTime;
    private Long transportationDepartId;
    private Integer transportMethod;
    private Long consignId;
    private Long takeOverAgenciesId;
    private Long takeOverStoreId;
    private String processInstanceId;
    private Boolean ok;
    private Integer paymentMethod;
    private Integer procureStatus;
}

2.2 采购订单项表 (erp_purchase_order_items) ​

采购订单项表用于管理采购订单的明细项。

2.2.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-编号(主键)
order_idbigint20否-采购订单编号
product_idbigint20否-产品编号
product_unit_idbigint20否-产品单位单位
product_priceint11否-产品单位单价(单位:分)
countint11否-数量
total_priceint11否-总价(单位:分)
tax_percentint11否-税率(百分比)
tax_priceint11否-税额(单位:分)
remarkvarchar512是NULL备注
in_countint11否0采购入库数量
return_countint11否0采购退货数量
delivery_priceint11是NULL配送价
min_supplier_idbigint20是NULL最低报价供应商ID
supplier_idbigint20是NULL供应商ID
min_quotation_priceint11是NULL最低报价
blend_novarchar64是NULL混合编号(商品合并)
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.2.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
idx_order_id普通order_id采购订单索引
idx_product_id普通product_id产品索引

2.2.3 Java 实体类 ​

java
@TableName("erp_purchase_order_items")
@KeySequence("erp_purchase_order_items_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpPurchaseOrderItemDO extends BaseDO {

    @TableId
    private Long id;
    private Long orderId;
    private Long productId;
    private Long productUnitId;
    private Integer productPrice;
    private Integer count;
    private Integer totalPrice;
    private Integer taxPercent;
    private Integer taxPrice;
    private String remark;
    private Integer inCount;
    private Integer returnCount;
    private Integer deliveryPrice;
    private Long minSupplierId;
    private Long supplierId;
    private Integer minQuotationPrice;
    private String blendNo;
}

2.3 采购入库表 (erp_purchase_in) ​

采购入库表用于管理采购入库单信息。

2.3.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-编号(主键)
novarchar64否-采购入库单号
statustinyint4否-入库状态(0草稿 5待提交 10审核中 20通过 30拒绝)
supplier_idbigint20否-供应商编号
account_idbigint20是NULL结算账户编号
in_timedatetime-否-入库时间
order_idbigint20是NULL采购订单编号
order_novarchar64是NULL采购订单号
total_countint11否0合计数量
total_priceint11否0最终合计价格(单位:分)
payment_priceint11否0已支付金额(单位:分)
total_product_priceint11否0合计产品价格(单位:分)
total_tax_priceint11否0合计税额(单位:分)
discount_percentint11否0优惠率(百分比)
discount_priceint11否0优惠金额(单位:分)
other_priceint11否0其它金额(单位:分)
file_urlvarchar512是NULL附件地址
remarkvarchar512是NULL备注
process_instance_idvarchar64是NULL对应的流程编号
okbit1否b'0'是否已经验证(审核通过之后为1)
batchvarchar64是NULL批次号
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.3.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
uk_no唯一no采购入库单号唯一索引
idx_supplier_id普通supplier_id供应商索引
idx_status普通status状态索引
idx_order_id普通order_id采购订单索引

2.3.3 Java 实体类 ​

java
@TableName(value = "erp_purchase_in")
@KeySequence("erp_purchase_in_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpPurchaseInDO extends BaseDO {

    @TableId
    private Long id;
    private String no;
    private Integer status;
    private Long supplierId;
    private Long accountId;
    private LocalDateTime inTime;
    private Long orderId;
    private String orderNo;
    private Integer totalCount;
    private Integer totalPrice;
    private Integer paymentPrice;
    private Integer totalProductPrice;
    private Integer totalTaxPrice;
    private Integer discountPercent;
    private Integer discountPrice;
    private Integer otherPrice;
    private String fileUrl;
    private String remark;
    private String processInstanceId;
    private Boolean ok;
    private String batch;
}

2.4 采购入库项表 (erp_purchase_in_items) ​

采购入库项表用于管理采购入库单的明细项。

2.4.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-编号(主键)
in_idbigint20否-采购入库编号
order_item_idbigint20是NULL采购订单项编号
warehouse_idbigint20否-仓库编号
product_idbigint20否-产品编号
product_unit_idbigint20否-产品单位单位
product_priceint11否-产品单位单价(单位:分)
countint11否-数量
total_priceint11否-总价(单位:分)
tax_percentint11否-税率(百分比)
tax_priceint11否-税额(单位:分)
remarkvarchar512是NULL备注
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.4.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
idx_in_id普通in_id采购入库索引
idx_product_id普通product_id产品索引

2.4.3 Java 实体类 ​

java
@TableName("erp_purchase_in_items")
@KeySequence("erp_purchase_in_items_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpPurchaseInItemDO extends BaseDO {

    @TableId
    private Long id;
    private Long inId;
    private Long orderItemId;
    private Long warehouseId;
    private Long productId;
    private Long productUnitId;
    private Integer productPrice;
    private Integer count;
    private Integer totalPrice;
    private Integer taxPercent;
    private Integer taxPrice;
    private String remark;
}

2.5 采购退货表 (erp_purchase_return) ​

采购退货表用于管理采购退货单信息。

2.5.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-编号(主键)
novarchar64否-采购退货单号
statustinyint4否-退货状态(0草稿 5待提交 10审核中 20通过 30拒绝)
supplier_idbigint20否-供应商编号
account_idbigint20是NULL结算账户编号
return_timedatetime-否-退货时间
order_idbigint20是NULL采购订单编号
order_novarchar64是NULL采购订单号
total_countint11否0合计数量
total_priceint11否0最终合计价格(单位:分)
refund_priceint11否0已退款金额(单位:分)
total_product_priceint11否0合计产品价格(单位:分)
total_tax_priceint11否0合计税额(单位:分)
discount_percentint11否0优惠率(百分比)
discount_priceint11否0优惠金额(单位:分)
other_priceint11否0其它金额(单位:分)
file_urlvarchar512是NULL附件地址
remarkvarchar512是NULL备注
process_instance_idvarchar64是NULL对应的流程编号
okbit1否b'0'是否已经验证(审核通过之后为1)
batchvarchar64是NULL批次
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.5.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
uk_no唯一no采购退货单号唯一索引
idx_supplier_id普通supplier_id供应商索引
idx_status普通status状态索引
idx_order_id普通order_id采购订单索引

2.5.3 Java 实体类 ​

java
@TableName(value = "erp_purchase_return")
@KeySequence("erp_purchase_return_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpPurchaseReturnDO extends BaseDO {

    @TableId
    private Long id;
    private String no;
    private Integer status;
    private Long supplierId;
    private Long accountId;
    private LocalDateTime returnTime;
    private Long orderId;
    private String orderNo;
    private Integer totalCount;
    private Integer totalPrice;
    private Integer refundPrice;
    private Integer totalProductPrice;
    private Integer totalTaxPrice;
    private Integer discountPercent;
    private Integer discountPrice;
    private Integer otherPrice;
    private String fileUrl;
    private String remark;
    private String processInstanceId;
    private Boolean ok;
    private String batch;
}

2.6 采购退货项表 (erp_purchase_return_items) ​

采购退货项表用于管理采购退货单的明细项。

2.6.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-编号(主键)
return_idbigint20否-采购退货编号
order_item_idbigint20是NULL采购订单项编号
warehouse_idbigint20否-仓库编号
product_idbigint20否-产品编号
product_unit_idbigint20否-产品单位单位
product_priceint11否-产品单位单价(单位:分)
countint11否-数量
total_priceint11否-总价(单位:分)
tax_percentint11否-税率(百分比)
tax_priceint11否-税额(单位:分)
remarkvarchar512是NULL备注
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.6.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
idx_return_id普通return_id采购退货索引
idx_product_id普通product_id产品索引

2.6.3 Java 实体类 ​

java
@TableName("erp_purchase_return_items")
@KeySequence("erp_purchase_return_items_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpPurchaseReturnItemDO extends BaseDO {

    @TableId
    private Long id;
    private Long returnId;
    private Long orderItemId;
    private Long warehouseId;
    private Long productId;
    private Long productUnitId;
    private Integer productPrice;
    private Integer count;
    private Integer totalPrice;
    private Integer taxPercent;
    private Integer taxPrice;
    private String remark;
}

2.7 其它入库表 (erp_stock_in) ​

其它入库表用于管理其它类型的入库单信息。

2.7.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-入库编号(主键)
novarchar64否-入库单号
supplier_idbigint20是NULL供应商编号
in_timedatetime-否-入库时间
operational_agencies_idbigint20是NULL业务机构
store_idbigint20是NULL申请门店
warehouse_idbigint20否-仓库编号
total_priceint11否0合计金额(单位:分)
total_countint11否0合计数量
statustinyint4否-审核状态(0草稿 5待提交 10审核中 20通过 30拒绝)
remarkvarchar512是NULL备注
file_urlvarchar512是NULL附件URL
process_instance_idvarchar64是NULL流程实例的编号
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.7.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
uk_no唯一no入库单号唯一索引
idx_warehouse_id普通warehouse_id仓库索引
idx_status普通status状态索引

2.7.3 Java 实体类 ​

java
@TableName("erp_stock_in")
@KeySequence("erp_stock_in_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockInDO extends BaseDO {

    @TableId
    private Long id;
    private String no;
    private Long supplierId;
    private LocalDateTime inTime;
    private Long operationalAgenciesId;
    private Long storeId;
    private Long warehouseId;
    private Integer totalPrice;
    private Integer totalCount;
    private Integer status;
    private String remark;
    private String fileUrl;
    private String processInstanceId;
}

2.8 其它入库项表 (erp_stock_in_item) ​

其它入库项表用于管理其它入库单的明细项。

2.8.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-入库项编号(主键)
in_idbigint20否-入库编号
warehouse_idbigint20否-仓库编号
product_idbigint20否-产品编号
product_unit_idbigint20否-产品单位编号
makenovarchar64是NULL产品生产批号
product_priceint11否-产品单价(单位:分)
countint11否-产品数量
total_priceint11否-合计金额(单位:分)
supplier_idbigint20是NULL订货供应商
remarkvarchar512是NULL备注
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.8.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
idx_in_id普通in_id入库索引
idx_product_id普通product_id产品索引

2.8.3 Java 实体类 ​

java
@TableName("erp_stock_in_item")
@KeySequence("erp_stock_in_item_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpStockInItemDO extends BaseDO {

    @TableId
    private Long id;
    private Long inId;
    private Long warehouseId;
    private Long productId;
    private Long productUnitId;
    private String makeno;
    private Integer productPrice;
    private Integer count;
    private Integer totalPrice;
    private Long supplierId;
    private String remark;
}

2.9 验收入库通知单表 (erp_accept_storage_notice) ​

验收入库通知单表用于管理验收入库通知单信息。

2.9.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-编号(主键)
remarkvarchar512是NULL备注
statustinyint4否-审核状态(10未审核 20已通过 30未通过)
novarchar64否-验收入库通知单编号(申请单号)
take_over_agencies_idbigint20是NULL收货单位
consign_idbigint20是NULL委托人ID
start_timedatetime-是NULL启运时间
order_novarchar64是NULL订单(订货)编号
supplier_idbigint20是NULL供应商编号
accompany_goods_novarchar64是NULL随货同行单号
start_temperaturevarchar32是NULL启运温度(单位:摄氏度)
delivery_note_novarchar64是NULL收货单ID
transportation_depart_idbigint20是NULL运输单位ID
reach_temperaturevarchar32是NULL到达温度(单位:摄氏度)
payment_method_notetinyint4是NULL付款方式(0现金 1实销实结 2账期付款 3代销现金 4预付款)
settlement_depart_idbigint20是NULL结算部门ID
transport_methodtinyint4是NULL运输方式(0保温箱 1空运 2陆运 3海运 4铁路)
temperature_control_methodtinyint4是NULL温控方式(0保温箱 1冷藏车)
procure_personnel_idbigint20是NULL采购人员ID
take_delivery_timedatetime-是NULL收货时间
temperature_contro_conditiontinyint4是NULL温控状况(0正常 1不正常)
check_accept_idbigint20是NULL验收员ID
goods_arrived_timedatetime-是NULL到货日期(到达时间)
transportation_durationvarchar32是NULL运输时长(单位:天)
is_direct_adjusttinyint4否0是否直调(0否 1是)
file_urlvarchar512是NULL附件地址
okbit1否b'0'是否已经验证(审核通过之后为1)
process_instance_idvarchar64是NULL流程实例的编号
total_countint11否0合计数量
total_priceint11否0合计价格(单位:分)
total_product_priceint11否0合计产品价格(单位:分)
total_tax_priceint11否0合计税额(单位:分)
final_update_timedatetime-是NULL最终修改时间
effective_timedatetime-是NULL生效时间
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.9.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
uk_no唯一no验收入库通知单号唯一索引
idx_status普通status状态索引

2.9.3 Java 实体类 ​

java
@TableName("erp_accept_storage_notice")
@KeySequence("erp_accept_storage_notice_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AcceptStorageNoticeDO extends BaseDO {

    @TableId
    private Long id;
    private String remark;
    private Integer status;
    private String no;
    private Long takeOverAgenciesId;
    private Long consignId;
    private LocalDateTime startTime;
    private String orderNo;
    private Long supplierId;
    private String accompanyGoodsNo;
    private String startTemperature;
    private String deliveryNoteNo;
    private Long transportationDepartId;
    private String reachTemperature;
    private Integer paymentMethodNote;
    private Long settlementDepartId;
    private Integer transportMethod;
    private Integer temperatureControlMethod;
    private Long procurePersonnelId;
    private LocalDateTime takeDeliveryTime;
    private Integer temperatureControCondition;
    private Long checkAcceptId;
    private LocalDateTime goodsArrivedTime;
    private String transportationDuration;
    private Integer isDirectAdjust;
    private String fileUrl;
    private Boolean ok;
    private String processInstanceId;
    private Integer totalCount;
    private Integer totalPrice;
    private Integer totalProductPrice;
    private Integer totalTaxPrice;
    private LocalDateTime finalUpdateTime;
    private LocalDateTime effectiveTime;
}

2.10 验收入库通知单分项表 (erp_accept_storage_notice_item) ​

验收入库通知单分项表用于管理验收入库通知单的明细项。

2.10.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-编号(主键)
remarkvarchar512是NULL备注
accept_storage_notice_idbigint20否-验收入库通知单ID
product_idbigint20否-产品编号
product_unit_idbigint20否-产品单位
product_priceint11否-产品单价(单位:分)
countint11否-数量
total_priceint11否-总价(采购金额,单位:分)
tax_percentint11否-税率(百分比乘以100)
tax_priceint11否-税额(单位:分)
net_receipt_countint11是NULL收货合格数量
acceptance_qualified_countint11是NULL验收合格数量
rejection_countint11是NULL拒收数量
actual_purchase_priceint11是NULL实际进价(单位:分)
quantity_already_countint11是NULL已入库数量
rejection_reasonvarchar512是NULL收货拒收原因
acceptance_statustinyint4是NULL验收情况(0待定 1质量合格 2质量不合格 3可疑)
handle_suggestionsvarchar512是NULL处理意见
sample_quantity_countint11是NULL抽检数量
suspicious_locktinyint4否0可疑锁定(0未锁定 1可疑锁定)
expiry_dayint11是NULL保质期天数
produce_timedatetime-是NULL生产日期
expire_timedatetime-是NULL过期时间
batchvarchar64是NULL批次号
retail_priceint11是NULL零售价
wholesale_priceint11是NULL批发价
delivery_priceint11是NULL配送价
min_supplier_idbigint20是NULL最低报价供应商ID
supplier_idbigint20是NULL供应商ID
min_quotation_priceint11是NULL最低报价
traceability_codevarchar128是NULL追溯码
goods_allocation_idbigint20是NULL货位ID
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.10.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
idx_accept_storage_notice_id普通accept_storage_notice_id验收入库通知单索引
idx_product_id普通product_id产品索引

2.10.3 Java 实体类 ​

java
@TableName("erp_accept_storage_notice_item")
@KeySequence("erp_accept_storage_notice_item_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AcceptStorageNoticeItemDO extends BaseDO {

    @TableId
    private Long id;
    private String remark;
    private Long acceptStorageNoticeId;
    private Long productId;
    private Long productUnitId;
    private Integer productPrice;
    private Integer count;
    private Integer totalPrice;
    private Integer taxPercent;
    private Integer taxPrice;
    private Integer netReceiptCount;
    private Integer acceptanceQualifiedCount;
    private Integer rejectionCount;
    private Integer actualPurchasePrice;
    private Integer quantityAlreadyCount;
    private String rejectionReason;
    private Integer acceptanceStatus;
    private String handleSuggestions;
    private Integer sampleQuantityCount;
    private Integer suspiciousLock;
    private Integer expiryDay;
    private LocalDateTime produceTime;
    private LocalDateTime expireTime;
    private String batch;
    private Integer retailPrice;
    private Integer wholesalePrice;
    private Integer deliveryPrice;
    private Long minSupplierId;
    private Long supplierId;
    private Integer minQuotationPrice;
    private String traceabilityCode;
    private Long goodsAllocationId;
}

2.11 门店药品验收记录表 (erp_store_drug_acceptance_record) ​

门店药品验收记录表用于记录门店药品验收信息。

2.11.1 表结构 ​

字段名类型长度允许空默认值说明
idbigint20否-主键ID
arrival_datedate-是NULL到货日期
product_idbigint20是NULL商品ID(关联产品表)
quantitydecimal10,2是NULL数量
expiry_datedate-是NULL有效期至
quality_status_dict_idbigint20是NULL质量状况字典ID
inspection_report_novarchar128是NULL检验报告编号
acceptance_conclusion_dict_idbigint20是NULL验收结论字典ID
acceptance_person_idbigint20是NULL验收人ID(关联用户表)
acceptance_datedate-是NULL验收日期
remarkvarchar512是NULL备注
chinese_medicine_packer_idbigint20是NULL中药装斗人ID(关联用户表,可选)
chinese_medicine_reviewer_idbigint20是NULL装斗复核人ID(关联用户表,可选)
creatorvarchar64是''创建者
create_timedatetime-否CURRENT_TIMESTAMP创建时间
updatervarchar64是''更新者
update_timedatetime-否CURRENT_TIMESTAMP更新时间
deletedbit1否b'0'是否删除

2.11.2 索引 ​

索引名类型字段说明
PRIMARY主键id主键索引
idx_product_id普通product_id商品索引
idx_acceptance_date普通acceptance_date验收日期索引

2.11.3 Java 实体类 ​

java
@TableName("erp_store_drug_acceptance_record")
@KeySequence("erp_store_drug_acceptance_record_seq")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StoreDrugAcceptanceRecordDO extends BaseDO {

    @TableId
    private Long id;
    private LocalDate arrivalDate;
    private Long productId;
    private BigDecimal quantity;
    private LocalDate expiryDate;
    private Long qualityStatusDictId;
    private String inspectionReportNo;
    private Long acceptanceConclusionDictId;
    private Long acceptancePersonId;
    private LocalDate acceptanceDate;
    private String remark;
    private Long chineseMedicinePackerId;
    private Long chineseMedicineReviewerId;
}

3. 表关系图 ​

erp_purchase_order (采购订单表)
    ├── erp_supplier (供应商表) - 通过 supplier_id 关联
    ├── erp_account (结算账户表) - 通过 account_id 关联
    ├── erp_purchase_order_items (采购订单项表) - 通过 id 关联
    ├── erp_purchase_in (采购入库表) - 通过 id 关联
    └── erp_purchase_return (采购退货表) - 通过 id 关联

erp_purchase_order_items (采购订单项表)
    ├── erp_purchase_order (采购订单表) - 通过 order_id 关联
    ├── erp_product (产品表) - 通过 product_id 关联
    └── erp_purchase_in_items (采购入库项表) - 通过 id 关联

erp_purchase_in (采购入库表)
    ├── erp_supplier (供应商表) - 通过 supplier_id 关联
    ├── erp_account (结算账户表) - 通过 account_id 关联
    ├── erp_purchase_order (采购订单表) - 通过 order_id 关联
    └── erp_purchase_in_items (采购入库项表) - 通过 in_id 关联

erp_purchase_in_items (采购入库项表)
    ├── erp_purchase_in (采购入库表) - 通过 in_id 关联
    ├── erp_purchase_order_items (采购订单项表) - 通过 order_item_id 关联
    ├── erp_warehouse (仓库表) - 通过 warehouse_id 关联
    └── erp_product (产品表) - 通过 product_id 关联

erp_purchase_return (采购退货表)
    ├── erp_supplier (供应商表) - 通过 supplier_id 关联
    ├── erp_account (结算账户表) - 通过 account_id 关联
    ├── erp_purchase_order (采购订单表) - 通过 order_id 关联
    └── erp_purchase_return_items (采购退货项表) - 通过 return_id 关联

erp_purchase_return_items (采购退货项表)
    ├── erp_purchase_return (采购退货表) - 通过 return_id 关联
    ├── erp_purchase_order_items (采购订单项表) - 通过 order_item_id 关联
    ├── erp_warehouse (仓库表) - 通过 warehouse_id 关联
    └── erp_product (产品表) - 通过 product_id 关联

erp_stock_in (其它入库表)
    ├── erp_supplier (供应商表) - 通过 supplier_id 关联
    ├── erp_warehouse (仓库表) - 通过 warehouse_id 关联
    └── erp_stock_in_item (其它入库项表) - 通过 in_id 关联

erp_stock_in_item (其它入库项表)
    ├── erp_stock_in (其它入库表) - 通过 in_id 关联
    ├── erp_warehouse (仓库表) - 通过 warehouse_id 关联
    └── erp_product (产品表) - 通过 product_id 关联

erp_accept_storage_notice (验收入库通知单表)
    ├── erp_supplier (供应商表) - 通过 supplier_id 关联
    └── erp_accept_storage_notice_item (验收入库通知单分项表) - 通过 id 关联

erp_accept_storage_notice_item (验收入库通知单分项表)
    ├── erp_accept_storage_notice (验收入库通知单表) - 通过 accept_storage_notice_id 关联
    └── erp_product (产品表) - 通过 product_id 关联

erp_store_drug_acceptance_record (门店药品验收记录表)
    └── erp_product (产品表) - 通过 product_id 关联

4. 使用示例 ​

4.1 创建采购订单 ​

java
@Service
public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService {

    @Resource
    private ErpPurchaseOrderMapper erpPurchaseOrderMapper;

    @Resource
    private ErpPurchaseOrderItemMapper erpPurchaseOrderItemMapper;

    @Transactional(rollbackFor = Exception.class)
    public Long createOrder(ErpPurchaseOrderSaveReqVO createReqVO) {
        ErpPurchaseOrderDO order = ErpPurchaseOrderDO.builder()
            .no(generateOrderNo())
            .supplierId(createReqVO.getSupplierId())
            .accountId(createReqVO.getAccountId())
            .orderTime(LocalDateTime.now())
            .status(ErpAuditStatusEnum.DRAFT.getStatus())
            .build();
        
        erpPurchaseOrderMapper.insert(order);

        for (ErpPurchaseOrderItemSaveReqVO itemReqVO : createReqVO.getItems()) {
            ErpPurchaseOrderItemDO item = ErpPurchaseOrderItemDO.builder()
                .orderId(order.getId())
                .productId(itemReqVO.getProductId())
                .productUnitId(itemReqVO.getProductUnitId())
                .productPrice(itemReqVO.getProductPrice())
                .count(itemReqVO.getCount())
                .totalPrice(itemReqVO.getProductPrice() * itemReqVO.getCount())
                .taxPercent(itemReqVO.getTaxPercent())
                .taxPrice(itemReqVO.getProductPrice() * itemReqVO.getCount() * itemReqVO.getTaxPercent() / 100)
                .build();
            
            erpPurchaseOrderItemMapper.insert(item);
        }
        
        return order.getId();
    }
}

4.2 创建采购入库 ​

java
@Service
public class ErpPurchaseInServiceImpl implements ErpPurchaseInService {

    @Resource
    private ErpPurchaseInMapper erpPurchaseInMapper;

    @Resource
    private ErpPurchaseInItemMapper erpPurchaseInItemMapper;

    @Transactional(rollbackFor = Exception.class)
    public Long createIn(ErpPurchaseInSaveReqVO createReqVO) {
        ErpPurchaseInDO purchaseIn = ErpPurchaseInDO.builder()
            .no(generateInNo())
            .supplierId(createReqVO.getSupplierId())
            .accountId(createReqVO.getAccountId())
            .inTime(LocalDateTime.now())
            .orderId(createReqVO.getOrderId())
            .orderNo(createReqVO.getOrderNo())
            .status(ErpAuditStatusEnum.DRAFT.getStatus())
            .build();
        
        erpPurchaseInMapper.insert(purchaseIn);

        for (ErpPurchaseInItemSaveReqVO itemReqVO : createReqVO.getItems()) {
            ErpPurchaseInItemDO item = ErpPurchaseInItemDO.builder()
                .inId(purchaseIn.getId())
                .orderItemId(itemReqVO.getOrderItemId())
                .warehouseId(itemReqVO.getWarehouseId())
                .productId(itemReqVO.getProductId())
                .productUnitId(itemReqVO.getProductUnitId())
                .productPrice(itemReqVO.getProductPrice())
                .count(itemReqVO.getCount())
                .totalPrice(itemReqVO.getProductPrice() * itemReqVO.getCount())
                .taxPercent(itemReqVO.getTaxPercent())
                .taxPrice(itemReqVO.getProductPrice() * itemReqVO.getCount() * itemReqVO.getTaxPercent() / 100)
                .build();
            
            erpPurchaseInItemMapper.insert(item);
        }
        
        return purchaseIn.getId();
    }
}

4.3 创建验收入库通知单 ​

java
@Service
public class AcceptStorageNoticeServiceImpl implements AcceptStorageNoticeService {

    @Resource
    private AcceptStorageNoticeMapper acceptStorageNoticeMapper;

    @Resource
    private AcceptStorageNoticeItemMapper acceptStorageNoticeItemMapper;

    @Transactional(rollbackFor = Exception.class)
    public Long createNotice(AcceptStorageNoticeSaveReqVO createReqVO) {
        AcceptStorageNoticeDO notice = AcceptStorageNoticeDO.builder()
            .no(generateNoticeNo())
            .supplierId(createReqVO.getSupplierId())
            .takeOverAgenciesId(createReqVO.getTakeOverAgenciesId())
            .status(10)
            .goodsArrivedTime(LocalDateTime.now())
            .build();
        
        acceptStorageNoticeMapper.insert(notice);

        for (AcceptStorageNoticeItemSaveReqVO itemReqVO : createReqVO.getItems()) {
            AcceptStorageNoticeItemDO item = AcceptStorageNoticeItemDO.builder()
                .acceptStorageNoticeId(notice.getId())
                .productId(itemReqVO.getProductId())
                .productUnitId(itemReqVO.getProductUnitId())
                .productPrice(itemReqVO.getProductPrice())
                .count(itemReqVO.getCount())
                .totalPrice(itemReqVO.getProductPrice() * itemReqVO.getCount())
                .taxPercent(itemReqVO.getTaxPercent())
                .taxPrice(itemReqVO.getProductPrice() * itemReqVO.getCount() * itemReqVO.getTaxPercent() / 100)
                .acceptanceStatus(0)
                .build();
            
            acceptStorageNoticeItemMapper.insert(item);
        }
        
        return notice.getId();
    }
}

5. 业务规则 ​

5.1 采购订单状态流转 ​

  1. 草稿 → 待提交(提交审核)
  2. 待提交 → 审核中(开始审核)
  3. 审核中 → 通过(审核通过)
  4. 审核中 → 拒绝(审核拒绝)

5.2 采购入库状态流转 ​

  1. 草稿 → 待提交(提交审核)
  2. 待提交 → 审核中(开始审核)
  3. 审核中 → 通过(审核通过)
  4. 审核中 → 拒绝(审核拒绝)

5.3 验收规则 ​

  1. 验收情况:0待定 1质量合格 2质量不合格 3可疑
  2. 可疑锁定:0未锁定 1可疑锁定
  3. 验收合格数量 + 拒收数量 = 收货合格数量

5.4 价格计算规则 ​

  1. 总价 = 单价 × 数量
  2. 税额 = 总价 × 税率
  3. 优惠金额 = (产品价格 + 税额) × 优惠率
  4. 最终价格 = 产品价格 + 税额 - 优惠金额 + 其它金额

5.5 库存更新规则 ​

  1. 采购入库审核通过后,增加库存
  2. 采购退货审核通过后,减少库存
  3. 其它入库审核通过后,增加库存

6. 注意事项 ​

  1. 所有金额单位都是分
  2. 采购订单号、采购入库单号、采购退货单号必须唯一
  3. 采购订单审核通过后才能创建采购入库
  4. 采购入库审核通过后才能更新库存
  5. 验收入库通知单审核通过后才能创建采购入库
  6. 采购退货数量不能超过采购入库数量
  7. 所有单据都需要审核流程
  8. 批次号用于追溯管理
  9. 温度记录用于药品质量管理
  10. 追溯码用于药品追溯

注意:本文档持续更新中,如有问题请及时反馈。