-- ----------------------------
-- Table structure for erp_goods
-- ----------------------------
DROP TABLE IF EXISTS `erp_goods`;
CREATE TABLE `erp_goods` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`code` varchar(20) NOT NULL COMMENT '编号',
`name` varchar(100) NOT NULL COMMENT '名称',
`spu_id` varchar(32) NOT NULL COMMENT '商品SPU ID',
`sku_code` varchar(100) NOT NULL COMMENT 'SKU',
`external_code` varchar(100) DEFAULT NULL COMMENT '外部编号',
`spec` varchar(20) DEFAULT NULL COMMENT '规格',
`unit` varchar(20) DEFAULT NULL COMMENT '单位',
`status` tinyint(1) NOT NULL COMMENT '状态 1-在用 0停用',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(32) NOT NULL COMMENT '修改人',
`update_time` datetime NOT NULL COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`) USING BTREE,
UNIQUE KEY `sku_code` (`sku_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品';
-- ----------------------------
-- Table structure for erp_goods_spu
-- ----------------------------
DROP TABLE IF EXISTS `erp_goods_spu`;
CREATE TABLE `erp_goods_spu` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`code` varchar(20) NOT NULL COMMENT '编号',
`name` varchar(100) NOT NULL COMMENT '名称',
`short_name` varchar(100) DEFAULT NULL COMMENT '简称',
`category_id` varchar(32) DEFAULT NULL COMMENT '类目ID',
`brand_id` varchar(32) DEFAULT NULL COMMENT '品牌ID',
`tax_rate` decimal(16,2) NOT NULL COMMENT '进项税率(%)',
`sale_tax_rate` decimal(16,2) NOT NULL COMMENT '销项税率',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(32) NOT NULL COMMENT '修改人',
`update_time` datetime NOT NULL COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`),
KEY `category_id` (`category_id`),
KEY `brand_id` (`brand_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品SPU';
-- ----------------------------
-- Table structure for erp_goods_spu_property
-- ----------------------------
DROP TABLE IF EXISTS `erp_goods_spu_property`;
CREATE TABLE `erp_goods_spu_property` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`spu_id` varchar(32) NOT NULL COMMENT '商品SPU ID',
`property_id` varchar(32) NOT NULL COMMENT '商品属性ID',
`property_item_id` varchar(32) DEFAULT NULL COMMENT '属性值ID',
`property_text` varchar(100) DEFAULT NULL COMMENT '商品属性值',
PRIMARY KEY (`id`),
KEY `spu_id` (`spu_id`,`property_id`,`property_item_id`) USING BTREE,
KEY `property_id` (`property_id`,`property_item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品SPU和商品属性关系表';
-- ----------------------------
-- Table structure for erp_goods_saleprop
-- ----------------------------
DROP TABLE IF EXISTS `erp_goods_saleprop`;
CREATE TABLE `erp_goods_saleprop` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`code` varchar(20) NOT NULL COMMENT '编号',
`name` varchar(20) NOT NULL COMMENT '名称',
`status` tinyint(1) NOT NULL COMMENT '状态 1-在用 0停用',
`remark` varchar(200) NOT NULL DEFAULT '' COMMENT '备注',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(32) NOT NULL COMMENT '修改人',
`update_time` datetime NOT NULL COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`) USING BTREE,
UNIQUE KEY `name` (`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品销售属性';
-- ----------------------------
-- Table structure for erp_goods_saleprop_item
-- ----------------------------
DROP TABLE IF EXISTS `erp_goods_saleprop_item`;
CREATE TABLE `erp_goods_saleprop_item` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`saleprop_id` varchar(32) NOT NULL COMMENT '商品销售属性ID',
`code` varchar(20) NOT NULL COMMENT '编号',
`name` varchar(20) NOT NULL COMMENT '名称',
`status` tinyint(1) NOT NULL COMMENT '状态 1-在用 0停用',
`remark` varchar(200) NOT NULL DEFAULT '' COMMENT '备注',
PRIMARY KEY (`id`),
UNIQUE KEY `group_id, code` (`group_id`,`code`) USING BTREE,
UNIQUE KEY `group_id, name` (`group_id`,`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品销售属性值';
-- ----------------------------
-- Table structure for erp_goods_price
-- ----------------------------
DROP TABLE IF EXISTS `erp_goods_price`;
CREATE TABLE `erp_goods_price` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`purchase` decimal(24,2) NOT NULL COMMENT '采购价',
`sale` decimal(24,2) NOT NULL COMMENT '销售价',
`retail` decimal(24,2) NOT NULL COMMENT '零售价',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品价格';
-- ----------------------------
-- Table structure for erp_purchase_order
-- ----------------------------
DROP TABLE IF EXISTS `erp_purchase_order`;
CREATE TABLE `erp_purchase_order` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`code` varchar(32) NOT NULL COMMENT '单号',
`sc_id` varchar(32) NOT NULL COMMENT '仓库ID',
`supplier_id` varchar(32) NOT NULL COMMENT '供应商ID',
`purchaser_id` varchar(32) DEFAULT NULL COMMENT '采购员ID',
`expect_arrive_date` date DEFAULT NULL COMMENT '预计到货日期',
`total_num` int(11) NOT NULL DEFAULT '0' COMMENT '采购数量',
`total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量',
`total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '采购金额',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(32) NOT NULL COMMENT '修改人',
`update_time` datetime NOT NULL COMMENT '修改时间',
`approve_by` varchar(32) DEFAULT NULL COMMENT '审核人',
`approve_time` datetime DEFAULT NULL COMMENT '审核时间',
`status` tinyint(3) NOT NULL COMMENT '状态',
`refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`),
KEY `sc_id` (`sc_id`),
KEY `supplier_id` (`supplier_id`),
KEY `create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购订单';
-- ----------------------------
-- Table structure for erp_purchase_order_detail
-- ----------------------------
DROP TABLE IF EXISTS `erp_purchase_order_detail`;
CREATE TABLE `erp_purchase_order_detail` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`order_id` varchar(32) NOT NULL COMMENT '订单ID',
`goods_id` varchar(32) NOT NULL COMMENT '商品ID',
`order_num` int(11) NOT NULL COMMENT '采购数量',
`tax_price` decimal(16,2) NOT NULL COMMENT '采购价',
`is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品',
`tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`order_no` int(11) NOT NULL COMMENT '排序编号',
`receive_num` int(11) NOT NULL DEFAULT '0' COMMENT '已入库数量',
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`),
KEY `goods_id` (`goods_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购订单明细';
-- ----------------------------
-- Table structure for erp_purchase_return
-- ----------------------------
DROP TABLE IF EXISTS `erp_purchase_return`;
CREATE TABLE `erp_purchase_return` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`code` varchar(32) NOT NULL COMMENT '单号',
`sc_id` varchar(32) NOT NULL COMMENT '仓库ID',
`supplier_id` varchar(32) NOT NULL COMMENT '供应商ID',
`purchaser_id` varchar(32) DEFAULT NULL COMMENT '采购员ID',
`payment_date` date DEFAULT NULL COMMENT '付款日期',
`in_sheet_id` varchar(32) DEFAULT NULL COMMENT '入库单ID',
`total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量',
`total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量',
`total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '退货金额',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(32) NOT NULL COMMENT '修改人',
`update_time` datetime NOT NULL COMMENT '修改时间',
`approve_by` varchar(32) DEFAULT NULL COMMENT '审核人',
`approve_time` datetime DEFAULT NULL COMMENT '审核时间',
`status` tinyint(3) NOT NULL COMMENT '状态',
`refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因',
`settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`) USING BTREE,
KEY `sc_id` (`sc_id`) USING BTREE,
KEY `supplier_id` (`supplier_id`) USING BTREE,
KEY `in_sheet_id` (`in_sheet_id`),
KEY `create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购退单';
-- ----------------------------
-- Table structure for erp_purchase_return_detail
-- ----------------------------
DROP TABLE IF EXISTS `erp_purchase_return_detail`;
CREATE TABLE `erp_purchase_return_detail` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`return_id` varchar(32) NOT NULL COMMENT '入库单ID',
`goods_id` varchar(32) NOT NULL COMMENT '商品ID',
`return_num` int(11) NOT NULL COMMENT '退货数量',
`tax_price` decimal(16,2) NOT NULL COMMENT '采购价',
`is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品',
`tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`order_no` int(11) NOT NULL COMMENT '排序编号',
`in_sheet_detail_id` varchar(32) DEFAULT NULL COMMENT '入库单明细ID',
PRIMARY KEY (`id`),
KEY `return_id` (`return_id`) USING BTREE,
KEY `in_sheet_detail_id` (`in_sheet_detail_id`),
KEY `goods_id` (`goods_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购退单明细';
-- ----------------------------
-- Table structure for erp_in_sheet
-- ----------------------------
DROP TABLE IF EXISTS `erp_in_sheet`;
CREATE TABLE `erp_in_sheet` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`code` varchar(32) NOT NULL COMMENT '单号',
`sc_id` varchar(32) NOT NULL COMMENT '仓库ID',
`supplier_id` varchar(32) NOT NULL COMMENT '供应商ID',
`purchaser_id` varchar(32) DEFAULT NULL COMMENT '采购员ID',
`payment_date` date DEFAULT NULL COMMENT '付款日期',
`receive_date` date DEFAULT NULL COMMENT '到货日期',
`purchase_order_id` varchar(32) DEFAULT NULL COMMENT '采购单ID',
`total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量',
`total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量',
`total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '入库金额',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(32) NOT NULL COMMENT '修改人',
`update_time` datetime NOT NULL COMMENT '修改时间',
`approve_by` varchar(32) DEFAULT NULL COMMENT '审核人',
`approve_time` datetime DEFAULT NULL COMMENT '审核时间',
`status` tinyint(3) NOT NULL COMMENT '状态',
`refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因',
`settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`) USING BTREE,
KEY `sc_id` (`sc_id`) USING BTREE,
KEY `supplier_id` (`supplier_id`) USING BTREE,
KEY `purchase_order_id` (`purchase_order_id`),
KEY `create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购入库单';
-- ----------------------------
-- Table structure for erp_in_sheet_detail
-- ----------------------------
DROP TABLE IF EXISTS `erp_in_sheet_detail`;
CREATE TABLE `erp_in_sheet_detail` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`sheet_id` varchar(32) NOT NULL COMMENT '入库单ID',
`goods_id` varchar(32) NOT NULL COMMENT '商品ID',
`order_num` int(11) NOT NULL COMMENT '采购数量',
`tax_price` decimal(16,2) NOT NULL COMMENT '采购价',
`is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品',
`tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`order_no` int(11) NOT NULL COMMENT '排序编号',
`purchase_order_detail_id` varchar(32) DEFAULT NULL COMMENT '采购订单明细ID',
`return_num` int(11) NOT NULL DEFAULT '0' COMMENT '已退货数量',
PRIMARY KEY (`id`),
KEY `sheet_id` (`sheet_id`) USING BTREE,
KEY `purchase_order_detail_id` (`purchase_order_detail_id`),
KEY `goods_id` (`goods_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采购入库单明细';
-- ----------------------------
-- Table structure for erp_sale_order
-- ----------------------------
DROP TABLE IF EXISTS `erp_sale_order`;
CREATE TABLE `erp_sale_order` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`code` varchar(32) NOT NULL COMMENT '单号',
`sc_id` varchar(32) NOT NULL COMMENT '仓库ID',
`customer_id` varchar(32) NOT NULL COMMENT '客户ID',
`saler_id` varchar(32) DEFAULT NULL COMMENT '销售员ID',
`total_num` int(11) NOT NULL DEFAULT '0' COMMENT '销售数量',
`total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量',
`total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '销售金额',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(32) NOT NULL COMMENT '修改人',
`update_time` datetime NOT NULL COMMENT '修改时间',
`approve_by` varchar(32) DEFAULT NULL COMMENT '审核人',
`approve_time` datetime DEFAULT NULL COMMENT '审核时间',
`status` tinyint(3) NOT NULL COMMENT '状态',
`refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`),
KEY `sc_id` (`sc_id`),
KEY `create_time` (`create_time`),
KEY `customer_id` (`customer_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='销售订单';
-- ----------------------------
-- Table structure for erp_sale_order_detail
-- ----------------------------
DROP TABLE IF EXISTS `erp_sale_order_detail`;
CREATE TABLE `erp_sale_order_detail` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`order_id` varchar(32) NOT NULL COMMENT '订单ID',
`goods_id` varchar(32) NOT NULL COMMENT '商品ID',
`order_num` int(11) NOT NULL COMMENT '销售数量',
`ori_price` decimal(16,2) NOT NULL COMMENT '原价',
`tax_price` decimal(16,2) NOT NULL COMMENT '现价',
`discount_rate` decimal(16,2) NOT NULL COMMENT '折扣率(%)',
`is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品',
`tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`order_no` int(11) NOT NULL COMMENT '排序编号',
`out_num` int(11) NOT NULL DEFAULT '0' COMMENT '已出库数量',
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`),
KEY `goods_id` (`goods_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='销售订单明细';
-- ----------------------------
-- Table structure for erp_sale_out
-- ----------------------------
DROP TABLE IF EXISTS `erp_sale_out`;
CREATE TABLE `erp_sale_out` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`code` varchar(32) NOT NULL COMMENT '单号',
`sc_id` varchar(32) NOT NULL COMMENT '仓库ID',
`customer_id` varchar(32) NOT NULL COMMENT '客户ID',
`saler_id` varchar(32) DEFAULT NULL COMMENT '销售员ID',
`payment_date` date DEFAULT NULL COMMENT '付款日期',
`sale_order_id` varchar(32) DEFAULT NULL COMMENT '销售单ID',
`total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量',
`total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量',
`total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '出库金额',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(32) NOT NULL COMMENT '修改人',
`update_time` datetime NOT NULL COMMENT '修改时间',
`approve_by` varchar(32) DEFAULT NULL COMMENT '审核人',
`approve_time` datetime DEFAULT NULL COMMENT '审核时间',
`status` tinyint(3) NOT NULL COMMENT '状态',
`refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因',
`settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`) USING BTREE,
KEY `sc_id` (`sc_id`) USING BTREE,
KEY `create_time` (`create_time`),
KEY `customer_id` (`customer_id`) USING BTREE,
KEY `sale_order_id` (`sale_order_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='销售出库单';
-- ----------------------------
-- Table structure for erp_sale_out_detail
-- ----------------------------
DROP TABLE IF EXISTS `erp_sale_out_detail`;
CREATE TABLE `erp_sale_out_detail` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`sheet_id` varchar(32) NOT NULL COMMENT '出库单ID',
`goods_id` varchar(32) NOT NULL COMMENT '商品ID',
`order_num` int(11) NOT NULL COMMENT '出库数量',
`ori_price` decimal(16,2) NOT NULL COMMENT '原价',
`tax_price` decimal(16,2) NOT NULL COMMENT '现价',
`discount_rate` decimal(16,2) NOT NULL COMMENT '折扣率(%)',
`is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品',
`tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`order_no` int(11) NOT NULL COMMENT '排序编号',
`settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态',
`sale_order_detail_id` varchar(32) DEFAULT NULL COMMENT '销售订单明细ID',
`return_num` int(11) NOT NULL DEFAULT '0' COMMENT '已退货数量',
PRIMARY KEY (`id`),
KEY `sheet_id` (`sheet_id`) USING BTREE,
KEY `purchase_order_detail_id` (`sale_order_detail_id`),
KEY `goods_id` (`goods_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='销售出库单明细';
-- ----------------------------
-- Table structure for erp_sale_return
-- ----------------------------
DROP TABLE IF EXISTS `erp_sale_return`;
CREATE TABLE `erp_sale_return` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`code` varchar(32) NOT NULL COMMENT '单号',
`sc_id` varchar(32) NOT NULL COMMENT '仓库ID',
`customer_id` varchar(32) NOT NULL COMMENT '客户ID',
`saler_id` varchar(32) DEFAULT NULL COMMENT '销售员ID',
`payment_date` date DEFAULT NULL COMMENT '付款日期',
`out_sheet_id` varchar(32) DEFAULT NULL COMMENT '出库单ID',
`total_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品数量',
`total_gift_num` int(11) NOT NULL DEFAULT '0' COMMENT '赠品数量',
`total_amount` decimal(24,2) NOT NULL DEFAULT '0.00' COMMENT '退货金额',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(32) NOT NULL COMMENT '修改人',
`update_time` datetime NOT NULL COMMENT '修改时间',
`approve_by` varchar(32) DEFAULT NULL COMMENT '审核人',
`approve_time` datetime DEFAULT NULL COMMENT '审核时间',
`status` tinyint(3) NOT NULL COMMENT '状态',
`refuse_reason` varchar(200) DEFAULT NULL COMMENT '拒绝原因',
`settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态',
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`) USING BTREE,
KEY `sc_id` (`sc_id`) USING BTREE,
KEY `create_time` (`create_time`),
KEY `customer_id` (`customer_id`) USING BTREE,
KEY `out_sheet_id` (`out_sheet_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='销售退单';
-- ----------------------------
-- Table structure for erp_sale_return_detail
-- ----------------------------
DROP TABLE IF EXISTS `erp_sale_return_detail`;
CREATE TABLE `erp_sale_return_detail` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`return_id` varchar(32) NOT NULL COMMENT '退货单ID',
`goods_id` varchar(32) NOT NULL COMMENT '商品ID',
`supplier_id` varchar(32) NOT NULL COMMENT '供应商ID',
`return_num` int(11) NOT NULL COMMENT '退货数量',
`ori_price` decimal(16,2) NOT NULL COMMENT '原价',
`tax_price` decimal(16,2) NOT NULL COMMENT '现价',
`discount_rate` decimal(16,2) NOT NULL COMMENT '折扣率(%)',
`is_gift` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠品',
`tax_rate` decimal(16,2) NOT NULL COMMENT '税率(%)',
`description` varchar(200) DEFAULT NULL COMMENT '备注',
`order_no` int(11) NOT NULL COMMENT '排序编号',
`settle_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '结算状态',
`out_sheet_detail_id` varchar(32) DEFAULT NULL COMMENT '出库单明细ID',
PRIMARY KEY (`id`),
KEY `return_id` (`return_id`) USING BTREE,
KEY `out_sheet_detail_id` (`out_sheet_detail_id`) USING BTREE,
KEY `goods_id` (`goods_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='销售退单明细';
-- ----------------------------
-- Table structure for erp_goods_stock
-- ----------------------------
DROP TABLE IF EXISTS `erp_goods_stock`;
CREATE TABLE `erp_goods_stock` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`sc_id` varchar(32) NOT NULL COMMENT '仓库ID',
`goods_id` varchar(32) NOT NULL COMMENT '商品ID',
`stock_num` int(11) NOT NULL DEFAULT '0' COMMENT '库存数量',
`tax_price` decimal(24,6) NOT NULL COMMENT '含税价格',
`tax_amount` decimal(24,2) NOT NULL COMMENT '含税金额',
`un_tax_price` decimal(24,6) NOT NULL COMMENT '无税价格',
`un_tax_amount` decimal(24,6) NOT NULL COMMENT '无税金额',
PRIMARY KEY (`id`),
UNIQUE KEY `goods_id` (`goods_id`,`sc_id`) USING BTREE,
KEY `sc_id` (`sc_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品库存';
-- ----------------------------
-- Table structure for erp_goods_stock_log
-- ----------------------------
DROP TABLE IF EXISTS `erp_goods_stock_log`;
CREATE TABLE `erp_goods_stock_log` (
`id` varchar(32) NOT NULL COMMENT 'ID',
`sc_id` varchar(32) NOT NULL COMMENT '仓库ID',
`goods_id` varchar(32) NOT NULL COMMENT '商品ID',
`lot_id` varchar(32) NOT NULL COMMENT '批次ID',
`ori_tax_price` decimal(24,6) NOT NULL COMMENT '原含税成本价',
`cur_tax_price` decimal(24,6) NOT NULL COMMENT '现含税成本价',
`ori_un_tax_price` decimal(24,6) NOT NULL COMMENT '原无税成本价',
`cur_un_tax_price` decimal(24,6) NOT NULL COMMENT '现无税成本价',
`ori_stock_num` int(11) NOT NULL,
`cur_stock_num` int(11) NOT NULL,
`stock_num` int(11) NOT NULL DEFAULT '0' COMMENT '库存数量',
`tax_amount` decimal(24,2) NOT NULL COMMENT '含税金额',
`un_tax_amount` decimal(24,6) NOT NULL COMMENT '无税金额',
`create_by` varchar(32) NOT NULL COMMENT '创建人',
`create_time` datetime NOT NULL COMMENT '创建时间',
`biz_id` varchar(32) DEFAULT NULL COMMENT '业务单据ID',
`biz_code` varchar(32) DEFAULT NULL COMMENT '业务单据号',
`biz_detail_id` varchar(32) DEFAULT NULL COMMENT '业务单据明细ID',
`biz_type` tinyint(3) NOT NULL COMMENT '业务类型',
PRIMARY KEY (`id`),
KEY `sc_id` (`sc_id`),
KEY `lot_id` (`lot_id`),
KEY `create_time` (`create_time`),
KEY `goods_id` (`goods_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品库存变动日志';