Kaynağa Gözat

增加表结构sql

csk 5 yıl önce
ebeveyn
işleme
898b46f074
2 değiştirilmiş dosya ile 227 ekleme ve 16 silme
  1. 202 0
      src/sql/acq_goods.sql
  2. 25 16
      src/sql/oms-shop-data-2.1.sql

+ 202 - 0
src/sql/acq_goods.sql

@@ -0,0 +1,202 @@
+create table acq_car_load
+(
+    id                 bigint auto_increment comment '库存内部序号'
+        primary key,
+    car_no             varchar(20)                         null comment '车牌号',
+    urm_no             varchar(32)                         null comment '核放单号',
+    bill_no            varchar(50)                         null comment '出入仓单号',
+    form_no            varchar(32)                         null comment '报关申请单号',
+    load_type          varchar(2)                          null comment '装卸货类型 I:装货 E:卸货',
+    store_company_name varchar(255)                        null comment '仓库使用企业名称',
+    store_usc_code     varchar(18)                         null comment '仓库使用企业社会信用代码',
+    store_customs_code varchar(10)                         null comment '仓库使用企业海关编码',
+    store_code         varchar(50)                         null comment '仓库编码',
+    load_time          datetime                            null comment '装卸货时间',
+    creater_sn         varchar(22)                         null comment '创建人编号',
+    create_time        datetime                            null comment '创建时间,yyyy-MM-dd HH:mm:ss',
+    moder_sn           varchar(22)                         null comment '修改人编号',
+    mod_time           datetime                            null comment '修改时间,yyyy-MM-dd HH:mm:ss',
+    tstm               timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '时间戳'
+);
+
+create table acq_goods_ie
+(
+    id                 bigint auto_increment comment '库存内部序号'
+        primary key,
+    car_no             varchar(20)                         null comment '车牌号',
+    i_e_type           varchar(2)                          null comment '出入类型 I:入 E:出',
+    urm_no             varchar(32)                         null comment '核放单号',
+    form_no            varchar(32)                         null comment '报关申请单号',
+    bill_no            varchar(50)                         null comment '出入仓单号',
+    store_company_name varchar(255)                        null comment '仓库使用企业名称',
+    store_usc_code     varchar(18)                         null comment '仓库使用企业社会信用代码',
+    store_customs_code varchar(10)                         null comment '仓库使用企业海关编码',
+    store_code         varchar(50)                         null comment '仓库编码',
+    i_e_time           datetime                            null comment '出入仓时间',
+    creater_sn         varchar(22)                         null comment '创建人编号',
+    create_time        datetime                            null comment '创建时间,yyyy-MM-dd HH:mm:ss',
+    moder_sn           varchar(22)                         null comment '修改人编号',
+    mod_time           datetime                            null comment '修改时间,yyyy-MM-dd HH:mm:ss',
+    tstm               timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '时间戳'
+);
+
+create table acq_goods_move
+(
+    id                 bigint auto_increment comment '库存内部序号'
+        primary key,
+    shelf_load_time    datetime                            null comment '货物上架时间',
+    shelf_unload_time  datetime                            null comment '货物下架时间',
+    target_seat_no     varchar(50)                         null comment '目标库位代码',
+    origin_seat_no     varchar(50)                         null comment '原库位代码',
+    goods_name         varchar(255)                        null comment '商品名称',
+    code_ts            varchar(30)                         null comment '商品编码',
+    sku_no             varchar(50)                         null comment '商品SKU',
+    goods_id           varchar(50)                         null comment '商品料件号',
+    g_unit             varchar(10)                         null comment '申报单位',
+    g_qyt              decimal(19, 5)                      null comment '申报数量',
+    legal_unit         varchar(10)                         null comment '法定单位',
+    legal_qyt          decimal(19, 5)                      null comment '法定数量',
+    goods_model        varchar(500)                        null comment '规格型号',
+    local_ems_no       varchar(20)                         null comment '园区账册号',
+    store_company_name varchar(255)                        null comment '仓库使用企业名称',
+    store_usc_code     varchar(18)                         null comment '仓库使用企业社会信用代码',
+    store_customs_code varchar(10)                         null comment '仓库使用企业海关编码',
+    store_code         varchar(50)                         null comment '仓库编码',
+    creater_sn         varchar(22)                         null comment '创建人编号',
+    create_time        datetime                            null comment '创建时间,yyyy-MM-dd HH:mm:ss',
+    moder_sn           varchar(22)                         null comment '修改人编号',
+    mod_time           datetime                            null comment '修改时间,yyyy-MM-dd HH:mm:ss',
+    tstm               timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '时间戳'
+)
+    comment '货物仓库移动信息';
+
+create table acq_goods_on_seat
+(
+    id                 bigint auto_increment comment '内部序号'
+        primary key,
+    seat_no            varchar(32)                         null comment '库位代码',
+    goods_name         varchar(255)                        null comment '商品名称',
+    code_ts            varchar(30)                         null comment '商品编码',
+    form_no_dec        varchar(32)                         null comment '报关单号',
+    form_no            varchar(32)                         null comment '报关申请单号',
+    sku_no             varchar(50)                         null comment '商品SKU',
+    goods_id           varchar(50)                         null comment '商品料件号',
+    g_unit             varchar(10)                         null comment '申报单位',
+    g_qyt              decimal(19, 5)                      null comment '申报数量',
+    legal_unit         varchar(10)                         null comment '法定单位',
+    legal_qyt          decimal(19, 5)                      null comment '法定数量',
+    goods_model        varchar(500)                        null comment '规格型号',
+    local_ems_no       varchar(20)                         null comment '园区账册号',
+    owner_code         varchar(10)                         null comment '货主企业海关编码',
+    owner_name         varchar(255)                        null comment '货主企业名称',
+    store_company_name varchar(255)                        null comment '仓库使用企业名称',
+    store_usc_code     varchar(18)                         null comment '仓库使用企业社会信用代码',
+    store_customs_code varchar(10)                         null comment '仓库使用企业海关编码',
+    store_code         varchar(50)                         null comment '仓库编码',
+    creater_sn         varchar(22)                         null comment '创建人编号',
+    create_time        datetime                            null comment '创建时间,yyyy-MM-dd HH:mm:ss',
+    moder_sn           varchar(22)                         null comment '修改人编号',
+    mod_time           datetime                            null comment '修改时间,yyyy-MM-dd HH:mm:ss',
+    tstm               timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '时间戳'
+)
+    comment '库位货物信息';
+
+create table acq_inventory_info
+(
+    id                 bigint auto_increment comment '库存内部序号'
+        primary key,
+    goods_name         varchar(255)                        null comment '商品名称',
+    code_ts            varchar(30)                         null comment '商品编码',
+    sku_no             varchar(50)                         null comment '商品SKU',
+    goods_id           varchar(50)                         null comment '商品料件号',
+    g_unit             varchar(10)                         null comment '申报单位',
+    g_qyt              decimal(19, 5)                      null comment '申报数量',
+    legal_unit         varchar(10)                         null comment '法定单位',
+    legal_qyt          decimal(19, 5)                      null comment '法定数量',
+    goods_model        varchar(500)                        null comment '规格型号',
+    local_ems_no       varchar(20)                         null comment '园区账册号',
+    owner_code         varchar(10)                         null comment '货主企业海关编码',
+    owner_name         varchar(255)                        null comment '货主企业名称',
+    store_company_name varchar(255)                        null comment '仓库使用企业名称',
+    store_usc_code     varchar(18)                         null comment '仓库使用企业社会信用代码',
+    store_customs_code varchar(10)                         null comment '仓库使用企业海关编码',
+    store_code         varchar(50)                         null comment '仓库编码',
+    creater_sn         varchar(22)                         null comment '创建人编号',
+    create_time        datetime                            null comment '创建时间,yyyy-MM-dd HH:mm:ss',
+    moder_sn           varchar(22)                         null comment '修改人编号',
+    mod_time           datetime                            null comment '修改时间,yyyy-MM-dd HH:mm:ss',
+    tstm               timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '时间戳'
+);
+
+create table acq_shelf_load
+(
+    id                 varchar(20)                         not null comment '库存内部序号'
+        primary key,
+    goods_name         varchar(255)                        null comment '商品名称',
+    code_ts            varchar(30)                         null comment '商品编码',
+    form_no_dec        varchar(32)                         null comment '报关单号',
+    form_no            varchar(32)                         null comment '报关申请单号',
+    sku_no             varchar(50)                         null comment '商品SKU',
+    goods_id           varchar(50)                         null comment '商品料件号',
+    g_unit             varchar(10)                         null comment '申报单位',
+    g_qyt              decimal(19, 5)                      null comment '申报数量',
+    legal_unit         varchar(10)                         null comment '法定单位',
+    legal_qyt          decimal(19, 5)                      null comment '法定数量',
+    goods_model        varchar(500)                        null comment '规格型号',
+    local_ems_no       varchar(20)                         null comment '园区账册号',
+    seat_no            varchar(32)                         null comment '库位代码',
+    shelf_load_time    datetime                            null comment '上下架时间',
+    shelf_load_type    varchar(2)                          null comment '上下架类型,I:上架 E:下架',
+    store_company_name varchar(255)                        null comment '仓库使用企业名称',
+    store_usc_code     varchar(18)                         null comment '仓库使用企业社会信用代码',
+    store_customs_code varchar(10)                         null comment '仓库使用企业海关编码',
+    store_code         varchar(50)                         null comment '仓库编码',
+    creater_sn         varchar(22)                         null comment '创建人编号',
+    create_time        datetime                            null comment '创建时间,yyyy-MM-dd HH:mm:ss',
+    moder_sn           varchar(22)                         null comment '修改人编号',
+    mod_time           datetime                            null comment '修改时间,yyyy-MM-dd HH:mm:ss',
+    tstm               timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '时间戳'
+)
+    comment '货物上下架信息';
+
+create table acq_sku_part_ref
+(
+    id                 bigint auto_increment comment '库存内部序号'
+        primary key,
+    sku_no             varchar(50)                         null comment '商品SKU',
+    goods_id           varchar(50)                         null comment '商品料件号',
+    code_ts            varchar(30)                         null comment '商品编码',
+    goods_name         varchar(255)                        null comment '商品名称',
+    goods_model        varchar(500)                        null comment '规格型号',
+    goods_id_unit      varchar(10)                         null comment '商品料件号对应计量单位',
+    goods_id_unit_name varchar(255)                        null comment '商品料件号对应计量单位中文名称',
+    sku_unit           varchar(10)                         null comment '商品SKU对应计量单位',
+    sku_unit_name      varchar(255)                        null comment '商品SKU对应计量单位代码名称',
+    ratio              varchar(10)                         null comment '商品SKU对应商品料件号数量换算比例 如"2:1" "3:1"',
+    store_company_name varchar(255)                        null comment '仓库使用企业名称',
+    store_usc_code     varchar(18)                         null comment '仓库使用企业社会信用代码',
+    store_customs_code varchar(10)                         null comment '仓库使用企业海关编码',
+    creater_sn         varchar(22)                         null comment '创建人编号',
+    create_time        datetime                            null comment '创建时间,yyyy-MM-dd HH:mm:ss',
+    moder_sn           varchar(22)                         null comment '修改人编号',
+    mod_time           datetime                            null comment '修改时间,yyyy-MM-dd HH:mm:ss',
+    unit_1             varchar(10)                         null,
+    unit_2             varchar(10)                         null,
+    store_code         varchar(50)                         null,
+    tstm               timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '时间戳'
+);
+
+create table emt_record_time
+(
+    data_type   varchar(64) default ''                not null comment '数据类型,00:货物库存,01_01:货物上下架_上架,01_02:货物上下架_退港,01_03:货物上下架_正常拣货,02:货物库位移动,03:库位货物'
+        primary key,
+    last_time   varchar(36)                           null comment '上次时间',
+    this_time   varchar(36)                           null comment '本次时间',
+    creater_sn  varchar(22)                           null comment '创建人编号',
+    create_time datetime                              null comment '创建时间,yyyy-MM-dd HH:mm:ss',
+    moder_sn    varchar(22)                           null comment '修改人编号',
+    mod_time    datetime                              null comment '修改时间,yyyy-MM-dd HH:mm:ss',
+    tstm        timestamp   default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '时间戳'
+)
+    comment '扫描时间';
+

+ 25 - 16
src/sql/oms-shop-data-2.1.sql

@@ -1,12 +1,13 @@
 
--- ���� ���ϼ� ����
+
+-- 进场 即上架 出区
 select t3.shop_name as shopName,
        t1.prod_name AS goodsName,
        t1.cus_goods_code as codeTs,
        t1.sku as skuNo,
        t1.sku as goodsId,
        t1.unit_code AS gUnit,
-       t.in_out_num as gQty,
+       t0.goods_num as gQty,
        t1.legal_unit1_qty as legalQty,
        t5.legal_unit1_code as legalUnit,
        t1.cus_decl_ele AS goodsModel,
@@ -16,22 +17,25 @@ select t3.shop_name as shopName,
        'I' AS shelfLoadType,
        t.ware_sn AS storeCode,
        t.create_time as createTime
-from wb_merch_shop_in t
-         left outer join pd_product_record t1 on t.sku=t1.sku
+from wb_merch_shop_bddcb_ingoods_doc t
+         left outer join wb_merch_shop_bddcb_ingoods_item t0 on t.bddcb_ingoods_doc_sn=t0.bddcb_ingoods_doc_sn
+         left outer join pd_product_record t1 on t0.sku=t1.sku
          left outer join ems_class_config t2 on t1.ems_class_code=t2.ems_class_code
          left outer join wb_shop_base t3 on t.shop_sn=t3.shop_sn
          left outer join sys_cus_goods_code t5 on t1.cus_goods_code = t5.cus_goods_code
-where t.in_demand_type='21' and t.shop_type='10' and t.goods_biz_type='01' and t2.ems_class_type='zszc';
+where
+        1 = 1
+  and t.in_goods_doc_status='1' and t.ship_type='0' and t.in_goods_ship_status='2' and t.goods_biz_type='01' and t2.ems_class_type='zszc';
 
 
--- ����  ���¼� ���������ر�˰��չʾ�˲��λ
+-- 出场  即下架 返区,返回保税区展示账册库位
 select t3.shop_name as shopName,
        t1.prod_name AS goodsName,
        t1.cus_goods_code as codeTs,
        t1.sku as skuNo,
        t1.sku as goodsId,
        t1.unit_code AS gUnit,
-       t.in_out_num as gQty,
+       t0.goods_num as gQty,
        t1.legal_unit1_qty as legalQty,
        t5.legal_unit1_code as legalUnit,
        t1.cus_decl_ele AS goodsModel,
@@ -41,14 +45,17 @@ select t3.shop_name as shopName,
        'E' AS shelfLoadType,
        t.ware_sn AS storeCode,
        t.create_time as createTime
-from wb_merch_shop_out t
-         left outer join pd_product_record t1 on t.sku=t1.sku
+from wb_merch_shop_bddcb_returngoods_doc t
+         left outer join wb_merch_shop_bddcb_returngoods_item t0 on t.bddcb_returngoods_doc_sn=t0.bddcb_returngoods_doc_sn
+         left outer join pd_product_record t1 on t0.sku=t1.sku
          left outer join ems_class_config t2 on t1.ems_class_code=t2.ems_class_code
          left outer join wb_shop_base t3 on t.shop_sn=t3.shop_sn
          left outer join sys_cus_goods_code t5 on t1.cus_goods_code = t5.cus_goods_code
-where t.shop_type='10' and t.goods_biz_type='01' and t2.ems_class_type='zszc';
+where
+        1 = 1
+  and t.return_goods_receipt_status='2' and t2.ems_class_type='zszc';
 
--- ���� ���¼�
+-- 销售 即下架
 select t3.shop_name as shopName,
        t1.prod_name AS goodsName,
        t1.cus_goods_code as codeTs,
@@ -74,7 +81,7 @@ where t.goods_biz_type='01' and t2.ems_class_type='zszc';
 
 
 
--- ת�� ��һ���ŵ��Ƶ���һ���ŵ꣬��Ӧ��һ����λ�Ƶ���һ����λ
+-- 转移 从一个门店移到另一个门店,对应从一个库位移到另一个库位
 select t3.shop_name as shopName,
        t.create_time as shelfLoadTime,
        t.create_time as shelfUnLoadTime,
@@ -101,8 +108,9 @@ from wb_merch_shop_move_record t
 where t.shop_type='10' and t.goods_biz_type='01' and t2.ems_class_type='zszc';
 
 
--- �ŵ��� ����λ
+-- 门店库位 即oms门店库存
 select t3.shop_name as shopName,
+       t3.shop_code as seatNo,
        t1.prod_name AS goodsName,
        t1.cus_goods_code as codeTs,
        t1.sku as skuNo,
@@ -123,12 +131,12 @@ from wb_merch_shop_inve t
          left outer join wb_shop_base t3 on t.shop_sn=t3.shop_sn
          left outer join merchant_base t4 on t.merch_sn=t4.merch_sn
          left outer join sys_cus_goods_code t5 on t1.cus_goods_code = t5.cus_goods_code
-where t.goods_biz_type='01' and t.is_valid='0' and t2.ems_class_type='zszc';
+where t.goods_biz_type='01' and t.is_valid='0' and t2.ems_class_type='zszc' and t.sku='ISGDKK468310'
+
 
 
--- �ڿ��� ���ŵ���
+-- 不导入!!在库库存 即门店库存
 select t3.shop_name as shopName,
-       t3.shop_code as seatNo,
        t1.prod_name AS goodsName,
        t1.cus_goods_code as codeTs,
        t1.sku as skuNo,
@@ -150,3 +158,4 @@ from wb_merch_shop_inve t
          left outer join merchant_base t4 on t.merch_sn=t4.merch_sn
          left outer join sys_cus_goods_code t5 on t1.cus_goods_code = t5.cus_goods_code
 where t.goods_biz_type='01' and t.is_valid='0' and t2.ems_class_type='zszc';
+