/*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 2021/1/11 11:11:46 */ /*==============================================================*/ drop index Index_bonded_sku on mall_inve_mng; drop table if exists mall_inve_mng; drop table if exists mall_mng_change; drop table if exists mall_shop_inve_mng; drop table if exists mall_store_mng_change; /*==============================================================*/ /* Table: mall_inve_mng */ /*==============================================================*/ create table mall_inve_mng ( inve_sn varchar(22) not null comment '库存编号', merch_sn varchar(22) default '00' comment '商户编号', merch_name varchar(256) comment '商户名称', sku varchar(30) comment 'SKU', PLU varchar(64) comment 'PLU', english_name varchar(120) comment '商品英文名称', brand varchar(255) comment '品牌', add_time datetime default NULL comment '商品创建时间', is_delete tinyint(1) unsigned default 0 comment '是否删除 0否,1是', inve_status char(1) comment '库存状态,0:正常,1:残次,2:冻结', cus_code varchar(2) comment '海关代码(深圳海关:06),req_20190710_001', inve_num int comment '库存数', valid_num int comment '可用数', freeze_num int comment '下单冻结数', im_ware_num int comment '进货数', return_num int comment '退货数', expire_num int comment '过期数', check_add_num int comment '盘增数', check_cut_num int comment '盘减数', damage_num int comment '破损数', spot_check_num int comment '国检抽查数', other_num int comment '其他冻结数', is_valid char(1) comment '是否有效,0:有效,1:无效', creater_sn varchar(22) comment '创建人编号', create_time datetime comment '创建时间,yyyy-MM-dd HH:mm:ss', moder_sn varchar(22) comment '修改人编号', mod_time datetime comment '修改时间,yyyy-MM-dd HH:mm:ss', tstm timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '时间戳', primary key (inve_sn) ); alter table mall_inve_mng comment '库存管理,wms入库回传时,增加库存数'; /*==============================================================*/ /* Index: Index_bonded_sku */ /*==============================================================*/ create index Index_bonded_sku on mall_inve_mng ( sku ); /*==============================================================*/ /* Table: mall_mng_change */ /*==============================================================*/ create table mall_mng_change ( id int(11) comment '编号', change_num int(11) comment '库存变化数', original_num int(11) comment '原库存数', valid_num int(11) comment '库存可用数', third_party_merch_code varchar(32) comment '第三方商户代码', merch_sn varchar(32) comment '商户编号', is_valid char(1) comment '是否有效,0:有效,1:无效', creater_sn varchar(22) comment '创建人编号', create_time datetime comment '创建时间,yyyy-MM-dd HH:mm:ss', moder_sn varchar(22) comment '修改人编号', mod_time datetime comment '修改时间,yyyy-MM-dd HH:mm:ss', tstm datetime default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '时间戳', goods_id int(11) comment '商品id', change_type char(2) comment '变动类型 0:还原 1:扣减 2:新增调整 3:更新调整增加 4:更新调整减少', change_reason varchar(255) comment '变动原因' ); /*==============================================================*/ /* Table: mall_shop_inve_mng */ /*==============================================================*/ create table mall_shop_inve_mng ( shop_inve_sn varchar(22) not null comment '门店库存编号', shop_sn varchar(22) comment '门店序号', merch_sn varchar(22) comment '商户编号', merch_name varchar(256) comment '商户名称', third_party_merch_code varchar(32) comment '第三方商户代码', third_party_merch_name varchar(128) comment '第三方商户名称', sku varchar(30) comment 'SKU', cus_code varchar(2) comment '海关代码(深圳海关:06),req_20190710_001', goods_biz_type varchar(2) comment '货品业务类型, 01:保税社区新零售,02:一般贸易,10:保税展示补货', shop_inve int comment '门店库存', shop_valid int comment '门店可用数', shop_freeze_num int comment '门店冻结数', shop_damage_num int comment '门店破损数', shop_destroy_lost_num int comment '门店灭失数', shop_expire_num int comment '门店过期数', shop_sample_freeze_num int comment '样品展示冻结数', shop_minus int comment '门店减扣数,保税展示,易货前,订单减扣数', shop_supp int comment '门店增补数,保税展示,易货后,订单补货数', in_qty numeric(19,5) comment '进场数量', out_qty numeric(19,5) comment '出场数量', return_qty numeric(19,5) comment '退货数量,保税直营,销售后,客户退货的数量', sale_qty numeric(19,5) comment '销售数量,保税直营,销售数', loc_in_qty numeric(19,5) comment '移仓转入数量,其它门店转入数', loc_out_qty numeric(19,5) comment '移仓转出数量,转出到其它门店数', is_valid char(1) comment '是否有效,0:有效,1:无效', creater_sn varchar(22) comment '创建人编号', create_time datetime comment '创建时间,yyyy-MM-dd HH:mm:ss', moder_sn varchar(22) comment '修改人编号', mod_time datetime comment '修改时间,yyyy-MM-dd HH:mm:ss', tstm timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '时间戳', primary key (shop_inve_sn) ); alter table mall_shop_inve_mng comment '商户店面库存,包括跨境,一般贸易'; /*==============================================================*/ /* Table: mall_store_mng_change */ /*==============================================================*/ create table mall_store_mng_change ( id int(11) not null comment '编号', store_change_num int(11) comment '门店库存变化数', store_original_num int(11) comment '门店原库存数', store_valid_num int(11) comment '门店库存可用数', merch_sn varchar(32) comment '商户编号', store_id mediumint(8) comment '门店编号', sku varchar(60) comment 'sku', is_valid char(1) comment '是否有效,0:有效,1:无效', creater_sn varchar(22) comment '创建人编号', create_time datetime comment '创建时间,yyyy-MM-dd HH:mm:ss', moder_sn varchar(22) comment '修改人编号', mod_time datetime comment '修改时间,yyyy-MM-dd HH:mm:ss', tstm datetime default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '时间戳', change_type char(2) comment '变动类型 0:还原 1:扣减 2:新增调整 3:更新调整增加 4:更新调整减少', change_reason varchar(255) comment '变动原因', primary key (id) );