采入库表
1. 概述
采入库表是梵医云ERP系统中用于管理采购入库流程的核心模块,包括采购订单、采购入库、采购退货、验收入库通知、其它入库等功能。该模块提供了完整的采购管理流程,从采购下单、验收入库到退货处理的全生命周期管理。
2. 表结构
2.1 采购订单表 (erp_purchase_order)
采购订单表用于管理采购订单信息,记录采购计划、价格、数量等关键信息。
2.1.1 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 编号(主键) |
| no | varchar | 64 | 否 | - | 采购订单号 |
| status | tinyint | 4 | 否 | - | 采购状态(0草稿 5待提交 10审核中 20通过 30拒绝) |
| supplier_id | bigint | 20 | 否 | - | 供应商编号 |
| account_id | bigint | 20 | 是 | NULL | 结算账户编号 |
| order_time | datetime | - | 否 | - | 下单时间 |
| total_count | int | 11 | 否 | 0 | 合计数量 |
| total_price | int | 11 | 否 | 0 | 最终合计价格(单位:分) |
| total_product_price | int | 11 | 否 | 0 | 合计产品价格(单位:分) |
| total_tax_price | int | 11 | 否 | 0 | 合计税额(单位:分) |
| discount_percent | int | 11 | 否 | 0 | 优惠率(百分比) |
| discount_price | int | 11 | 否 | 0 | 优惠金额(单位:分) |
| deposit_price | int | 11 | 是 | NULL | 定金金额(单位:分) |
| total_delivery_price | int | 11 | 是 | NULL | 总配送价(单位:分) |
| file_url | varchar | 512 | 是 | NULL | 附件地址 |
| remark | varchar | 512 | 是 | NULL | 备注 |
| in_count | int | 11 | 否 | 0 | 采购入库数量 |
| return_count | int | 11 | 否 | 0 | 采购退货数量 |
| procure_personnel_id | bigint | 20 | 是 | NULL | 采购人员ID |
| operational_agencies_id | bigint | 20 | 是 | NULL | 业务机构ID |
| store_id | bigint | 20 | 是 | NULL | 申请门店ID |
| reviewer | bigint | 20 | 是 | NULL | 审核人ID |
| contract_type | tinyint | 4 | 是 | NULL | 合同类型(0书面合同 1口头协议 2电话要货) |
| transportation_method | tinyint | 4 | 是 | NULL | 承运方式(0配送 1自提 2托运) |
| failure_time | datetime | - | 是 | NULL | 失效时间 |
| departure_time | datetime | - | 是 | NULL | 启运时间 |
| transportation_depart_id | bigint | 20 | 是 | NULL | 承运单位ID |
| transport_method | tinyint | 4 | 是 | NULL | 运输方式(0保温箱 1空运 2陆运 3海运) |
| consign_id | bigint | 20 | 是 | NULL | 委托人ID |
| take_over_agencies_id | bigint | 20 | 是 | NULL | 收货机构ID |
| take_over_store_id | bigint | 20 | 是 | NULL | 收货门店ID |
| process_instance_id | varchar | 64 | 是 | NULL | 对应的流程编号 |
| ok | bit | 1 | 否 | b'0' | 是否已经验证(审核通过之后为1) |
| payment_method | tinyint | 4 | 是 | NULL | 结算方式(0现金结算 1代销现金 2帐期结算 3预付款 4实销实结) |
| procure_status | tinyint | 4 | 否 | - | 采购状态(10采购中 20采购结束) |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 编号(主键) |
| order_id | bigint | 20 | 否 | - | 采购订单编号 |
| product_id | bigint | 20 | 否 | - | 产品编号 |
| product_unit_id | bigint | 20 | 否 | - | 产品单位单位 |
| product_price | int | 11 | 否 | - | 产品单位单价(单位:分) |
| count | int | 11 | 否 | - | 数量 |
| total_price | int | 11 | 否 | - | 总价(单位:分) |
| tax_percent | int | 11 | 否 | - | 税率(百分比) |
| tax_price | int | 11 | 否 | - | 税额(单位:分) |
| remark | varchar | 512 | 是 | NULL | 备注 |
| in_count | int | 11 | 否 | 0 | 采购入库数量 |
| return_count | int | 11 | 否 | 0 | 采购退货数量 |
| delivery_price | int | 11 | 是 | NULL | 配送价 |
| min_supplier_id | bigint | 20 | 是 | NULL | 最低报价供应商ID |
| supplier_id | bigint | 20 | 是 | NULL | 供应商ID |
| min_quotation_price | int | 11 | 是 | NULL | 最低报价 |
| blend_no | varchar | 64 | 是 | NULL | 混合编号(商品合并) |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 编号(主键) |
| no | varchar | 64 | 否 | - | 采购入库单号 |
| status | tinyint | 4 | 否 | - | 入库状态(0草稿 5待提交 10审核中 20通过 30拒绝) |
| supplier_id | bigint | 20 | 否 | - | 供应商编号 |
| account_id | bigint | 20 | 是 | NULL | 结算账户编号 |
| in_time | datetime | - | 否 | - | 入库时间 |
| order_id | bigint | 20 | 是 | NULL | 采购订单编号 |
| order_no | varchar | 64 | 是 | NULL | 采购订单号 |
| total_count | int | 11 | 否 | 0 | 合计数量 |
| total_price | int | 11 | 否 | 0 | 最终合计价格(单位:分) |
| payment_price | int | 11 | 否 | 0 | 已支付金额(单位:分) |
| total_product_price | int | 11 | 否 | 0 | 合计产品价格(单位:分) |
| total_tax_price | int | 11 | 否 | 0 | 合计税额(单位:分) |
| discount_percent | int | 11 | 否 | 0 | 优惠率(百分比) |
| discount_price | int | 11 | 否 | 0 | 优惠金额(单位:分) |
| other_price | int | 11 | 否 | 0 | 其它金额(单位:分) |
| file_url | varchar | 512 | 是 | NULL | 附件地址 |
| remark | varchar | 512 | 是 | NULL | 备注 |
| process_instance_id | varchar | 64 | 是 | NULL | 对应的流程编号 |
| ok | bit | 1 | 否 | b'0' | 是否已经验证(审核通过之后为1) |
| batch | varchar | 64 | 是 | NULL | 批次号 |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 编号(主键) |
| in_id | bigint | 20 | 否 | - | 采购入库编号 |
| order_item_id | bigint | 20 | 是 | NULL | 采购订单项编号 |
| warehouse_id | bigint | 20 | 否 | - | 仓库编号 |
| product_id | bigint | 20 | 否 | - | 产品编号 |
| product_unit_id | bigint | 20 | 否 | - | 产品单位单位 |
| product_price | int | 11 | 否 | - | 产品单位单价(单位:分) |
| count | int | 11 | 否 | - | 数量 |
| total_price | int | 11 | 否 | - | 总价(单位:分) |
| tax_percent | int | 11 | 否 | - | 税率(百分比) |
| tax_price | int | 11 | 否 | - | 税额(单位:分) |
| remark | varchar | 512 | 是 | NULL | 备注 |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 编号(主键) |
| no | varchar | 64 | 否 | - | 采购退货单号 |
| status | tinyint | 4 | 否 | - | 退货状态(0草稿 5待提交 10审核中 20通过 30拒绝) |
| supplier_id | bigint | 20 | 否 | - | 供应商编号 |
| account_id | bigint | 20 | 是 | NULL | 结算账户编号 |
| return_time | datetime | - | 否 | - | 退货时间 |
| order_id | bigint | 20 | 是 | NULL | 采购订单编号 |
| order_no | varchar | 64 | 是 | NULL | 采购订单号 |
| total_count | int | 11 | 否 | 0 | 合计数量 |
| total_price | int | 11 | 否 | 0 | 最终合计价格(单位:分) |
| refund_price | int | 11 | 否 | 0 | 已退款金额(单位:分) |
| total_product_price | int | 11 | 否 | 0 | 合计产品价格(单位:分) |
| total_tax_price | int | 11 | 否 | 0 | 合计税额(单位:分) |
| discount_percent | int | 11 | 否 | 0 | 优惠率(百分比) |
| discount_price | int | 11 | 否 | 0 | 优惠金额(单位:分) |
| other_price | int | 11 | 否 | 0 | 其它金额(单位:分) |
| file_url | varchar | 512 | 是 | NULL | 附件地址 |
| remark | varchar | 512 | 是 | NULL | 备注 |
| process_instance_id | varchar | 64 | 是 | NULL | 对应的流程编号 |
| ok | bit | 1 | 否 | b'0' | 是否已经验证(审核通过之后为1) |
| batch | varchar | 64 | 是 | NULL | 批次 |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 编号(主键) |
| return_id | bigint | 20 | 否 | - | 采购退货编号 |
| order_item_id | bigint | 20 | 是 | NULL | 采购订单项编号 |
| warehouse_id | bigint | 20 | 否 | - | 仓库编号 |
| product_id | bigint | 20 | 否 | - | 产品编号 |
| product_unit_id | bigint | 20 | 否 | - | 产品单位单位 |
| product_price | int | 11 | 否 | - | 产品单位单价(单位:分) |
| count | int | 11 | 否 | - | 数量 |
| total_price | int | 11 | 否 | - | 总价(单位:分) |
| tax_percent | int | 11 | 否 | - | 税率(百分比) |
| tax_price | int | 11 | 否 | - | 税额(单位:分) |
| remark | varchar | 512 | 是 | NULL | 备注 |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 入库编号(主键) |
| no | varchar | 64 | 否 | - | 入库单号 |
| supplier_id | bigint | 20 | 是 | NULL | 供应商编号 |
| in_time | datetime | - | 否 | - | 入库时间 |
| operational_agencies_id | bigint | 20 | 是 | NULL | 业务机构 |
| store_id | bigint | 20 | 是 | NULL | 申请门店 |
| warehouse_id | bigint | 20 | 否 | - | 仓库编号 |
| total_price | int | 11 | 否 | 0 | 合计金额(单位:分) |
| total_count | int | 11 | 否 | 0 | 合计数量 |
| status | tinyint | 4 | 否 | - | 审核状态(0草稿 5待提交 10审核中 20通过 30拒绝) |
| remark | varchar | 512 | 是 | NULL | 备注 |
| file_url | varchar | 512 | 是 | NULL | 附件URL |
| process_instance_id | varchar | 64 | 是 | NULL | 流程实例的编号 |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 入库项编号(主键) |
| in_id | bigint | 20 | 否 | - | 入库编号 |
| warehouse_id | bigint | 20 | 否 | - | 仓库编号 |
| product_id | bigint | 20 | 否 | - | 产品编号 |
| product_unit_id | bigint | 20 | 否 | - | 产品单位编号 |
| makeno | varchar | 64 | 是 | NULL | 产品生产批号 |
| product_price | int | 11 | 否 | - | 产品单价(单位:分) |
| count | int | 11 | 否 | - | 产品数量 |
| total_price | int | 11 | 否 | - | 合计金额(单位:分) |
| supplier_id | bigint | 20 | 是 | NULL | 订货供应商 |
| remark | varchar | 512 | 是 | NULL | 备注 |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 编号(主键) |
| remark | varchar | 512 | 是 | NULL | 备注 |
| status | tinyint | 4 | 否 | - | 审核状态(10未审核 20已通过 30未通过) |
| no | varchar | 64 | 否 | - | 验收入库通知单编号(申请单号) |
| take_over_agencies_id | bigint | 20 | 是 | NULL | 收货单位 |
| consign_id | bigint | 20 | 是 | NULL | 委托人ID |
| start_time | datetime | - | 是 | NULL | 启运时间 |
| order_no | varchar | 64 | 是 | NULL | 订单(订货)编号 |
| supplier_id | bigint | 20 | 是 | NULL | 供应商编号 |
| accompany_goods_no | varchar | 64 | 是 | NULL | 随货同行单号 |
| start_temperature | varchar | 32 | 是 | NULL | 启运温度(单位:摄氏度) |
| delivery_note_no | varchar | 64 | 是 | NULL | 收货单ID |
| transportation_depart_id | bigint | 20 | 是 | NULL | 运输单位ID |
| reach_temperature | varchar | 32 | 是 | NULL | 到达温度(单位:摄氏度) |
| payment_method_note | tinyint | 4 | 是 | NULL | 付款方式(0现金 1实销实结 2账期付款 3代销现金 4预付款) |
| settlement_depart_id | bigint | 20 | 是 | NULL | 结算部门ID |
| transport_method | tinyint | 4 | 是 | NULL | 运输方式(0保温箱 1空运 2陆运 3海运 4铁路) |
| temperature_control_method | tinyint | 4 | 是 | NULL | 温控方式(0保温箱 1冷藏车) |
| procure_personnel_id | bigint | 20 | 是 | NULL | 采购人员ID |
| take_delivery_time | datetime | - | 是 | NULL | 收货时间 |
| temperature_contro_condition | tinyint | 4 | 是 | NULL | 温控状况(0正常 1不正常) |
| check_accept_id | bigint | 20 | 是 | NULL | 验收员ID |
| goods_arrived_time | datetime | - | 是 | NULL | 到货日期(到达时间) |
| transportation_duration | varchar | 32 | 是 | NULL | 运输时长(单位:天) |
| is_direct_adjust | tinyint | 4 | 否 | 0 | 是否直调(0否 1是) |
| file_url | varchar | 512 | 是 | NULL | 附件地址 |
| ok | bit | 1 | 否 | b'0' | 是否已经验证(审核通过之后为1) |
| process_instance_id | varchar | 64 | 是 | NULL | 流程实例的编号 |
| total_count | int | 11 | 否 | 0 | 合计数量 |
| total_price | int | 11 | 否 | 0 | 合计价格(单位:分) |
| total_product_price | int | 11 | 否 | 0 | 合计产品价格(单位:分) |
| total_tax_price | int | 11 | 否 | 0 | 合计税额(单位:分) |
| final_update_time | datetime | - | 是 | NULL | 最终修改时间 |
| effective_time | datetime | - | 是 | NULL | 生效时间 |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 编号(主键) |
| remark | varchar | 512 | 是 | NULL | 备注 |
| accept_storage_notice_id | bigint | 20 | 否 | - | 验收入库通知单ID |
| product_id | bigint | 20 | 否 | - | 产品编号 |
| product_unit_id | bigint | 20 | 否 | - | 产品单位 |
| product_price | int | 11 | 否 | - | 产品单价(单位:分) |
| count | int | 11 | 否 | - | 数量 |
| total_price | int | 11 | 否 | - | 总价(采购金额,单位:分) |
| tax_percent | int | 11 | 否 | - | 税率(百分比乘以100) |
| tax_price | int | 11 | 否 | - | 税额(单位:分) |
| net_receipt_count | int | 11 | 是 | NULL | 收货合格数量 |
| acceptance_qualified_count | int | 11 | 是 | NULL | 验收合格数量 |
| rejection_count | int | 11 | 是 | NULL | 拒收数量 |
| actual_purchase_price | int | 11 | 是 | NULL | 实际进价(单位:分) |
| quantity_already_count | int | 11 | 是 | NULL | 已入库数量 |
| rejection_reason | varchar | 512 | 是 | NULL | 收货拒收原因 |
| acceptance_status | tinyint | 4 | 是 | NULL | 验收情况(0待定 1质量合格 2质量不合格 3可疑) |
| handle_suggestions | varchar | 512 | 是 | NULL | 处理意见 |
| sample_quantity_count | int | 11 | 是 | NULL | 抽检数量 |
| suspicious_lock | tinyint | 4 | 否 | 0 | 可疑锁定(0未锁定 1可疑锁定) |
| expiry_day | int | 11 | 是 | NULL | 保质期天数 |
| produce_time | datetime | - | 是 | NULL | 生产日期 |
| expire_time | datetime | - | 是 | NULL | 过期时间 |
| batch | varchar | 64 | 是 | NULL | 批次号 |
| retail_price | int | 11 | 是 | NULL | 零售价 |
| wholesale_price | int | 11 | 是 | NULL | 批发价 |
| delivery_price | int | 11 | 是 | NULL | 配送价 |
| min_supplier_id | bigint | 20 | 是 | NULL | 最低报价供应商ID |
| supplier_id | bigint | 20 | 是 | NULL | 供应商ID |
| min_quotation_price | int | 11 | 是 | NULL | 最低报价 |
| traceability_code | varchar | 128 | 是 | NULL | 追溯码 |
| goods_allocation_id | bigint | 20 | 是 | NULL | 货位ID |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 表结构
| 字段名 | 类型 | 长度 | 允许空 | 默认值 | 说明 |
|---|---|---|---|---|---|
| id | bigint | 20 | 否 | - | 主键ID |
| arrival_date | date | - | 是 | NULL | 到货日期 |
| product_id | bigint | 20 | 是 | NULL | 商品ID(关联产品表) |
| quantity | decimal | 10,2 | 是 | NULL | 数量 |
| expiry_date | date | - | 是 | NULL | 有效期至 |
| quality_status_dict_id | bigint | 20 | 是 | NULL | 质量状况字典ID |
| inspection_report_no | varchar | 128 | 是 | NULL | 检验报告编号 |
| acceptance_conclusion_dict_id | bigint | 20 | 是 | NULL | 验收结论字典ID |
| acceptance_person_id | bigint | 20 | 是 | NULL | 验收人ID(关联用户表) |
| acceptance_date | date | - | 是 | NULL | 验收日期 |
| remark | varchar | 512 | 是 | NULL | 备注 |
| chinese_medicine_packer_id | bigint | 20 | 是 | NULL | 中药装斗人ID(关联用户表,可选) |
| chinese_medicine_reviewer_id | bigint | 20 | 是 | NULL | 装斗复核人ID(关联用户表,可选) |
| creator | varchar | 64 | 是 | '' | 创建者 |
| create_time | datetime | - | 否 | CURRENT_TIMESTAMP | 创建时间 |
| updater | varchar | 64 | 是 | '' | 更新者 |
| update_time | datetime | - | 否 | CURRENT_TIMESTAMP | 更新时间 |
| deleted | bit | 1 | 否 | 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 采购订单状态流转
- 草稿 → 待提交(提交审核)
- 待提交 → 审核中(开始审核)
- 审核中 → 通过(审核通过)
- 审核中 → 拒绝(审核拒绝)
5.2 采购入库状态流转
- 草稿 → 待提交(提交审核)
- 待提交 → 审核中(开始审核)
- 审核中 → 通过(审核通过)
- 审核中 → 拒绝(审核拒绝)
5.3 验收规则
- 验收情况:0待定 1质量合格 2质量不合格 3可疑
- 可疑锁定:0未锁定 1可疑锁定
- 验收合格数量 + 拒收数量 = 收货合格数量
5.4 价格计算规则
- 总价 = 单价 × 数量
- 税额 = 总价 × 税率
- 优惠金额 = (产品价格 + 税额) × 优惠率
- 最终价格 = 产品价格 + 税额 - 优惠金额 + 其它金额
5.5 库存更新规则
- 采购入库审核通过后,增加库存
- 采购退货审核通过后,减少库存
- 其它入库审核通过后,增加库存
6. 注意事项
- 所有金额单位都是分
- 采购订单号、采购入库单号、采购退货单号必须唯一
- 采购订单审核通过后才能创建采购入库
- 采购入库审核通过后才能更新库存
- 验收入库通知单审核通过后才能创建采购入库
- 采购退货数量不能超过采购入库数量
- 所有单据都需要审核流程
- 批次号用于追溯管理
- 温度记录用于药品质量管理
- 追溯码用于药品追溯
注意:本文档持续更新中,如有问题请及时反馈。
