图6.3-购销合同下的货物表设计
alter table CONTRACT_PRODUCT_C
drop constraint FK_CONTRACT_REFERENCE_CONTRACT;
alter table CONTRACT_PRODUCT_C
drop constraint FK_CONTRACT_REFERENCE_FACTORY_;
alter table EXT_CPRODUCT_C
drop constraint FK_EXT_CPRO_REFERENCE_FACTORY_;
alter table EXT_CPRODUCT_C
drop constraint FK_EXT_CPRO_REFERENCE_CONTRACT;
drop table CONTRACT_C cascade constraints;
drop table CONTRACT_PRODUCT_C cascade constraints;
drop table EXT_CPRODUCT_C cascade constraints;
drop table SYS_CODE_B cascade constraints;
/*==============================================================*/
/* Table: CONTRACT_C */
/*==============================================================*/
create table CONTRACT_C (
CONTRACT_ID VARCHAR2(40) not null,
OFFEROR VARCHAR2(200),
CONTRACT_NO VARCHAR2(50),
SIGNING_DATE TIMESTAMP,
INPUT_BY VARCHAR2(30),
CHECK_BY VARCHAR2(30),
INSPECTOR VARCHAR2(30),
TOTAL_AMOUNT NUMBER(10,2),
IMPORT_NUM INT,
CREQUEST VARCHAR2(2000),
CUSTOM_NAME VARCHAR2(200),
DELIVERY_PERIOD TIMESTAMP,
SHIP_TIME TIMESTAMP,
TRADE_TERMS VARCHAR2(30),
REMARK VARCHAR2(600),
PRINT_STYLE CHAR(1),
OLD_STATE INT,
STATE INT,
OUT_STATE INT,
CREATE_BY VARCHAR2(40),
CREATE_DEPT VARCHAR2(40),
CREATE_TIME TIMESTAMP,
constraint PK_CONTRACT_C primary key (CONTRACT_ID)
);
comment on table CONTRACT_C is
'界面参考用户提供的《供销合同》
八个字段从《购销合同》中获取,加一个“总金额”冗余字段
四个字段从《出货表》中获取
六个控制字段
三个权限字段';
comment on column CONTRACT_C.CONTRACT_NO is
'自动产生';
comment on column CONTRACT_C.TOTAL_AMOUNT is
'冗余,自动计算,数量*单价';
comment on column CONTRACT_C.IMPORT_NUM is
'打印时标识几个星,对应说明中的内容
直接存放星星可以吗?可以CHAR(6)。但jsp页面jstl判断星星特殊字符失败。';
comment on column CONTRACT_C.CUSTOM_NAME is
'出处:出货表';
comment on column CONTRACT_C.DELIVERY_PERIOD is
'出处:出货表';
comment on column CONTRACT_C.SHIP_TIME is
'出处:出货表';
comment on column CONTRACT_C.TRADE_TERMS is
'出处:出货表';
comment on column CONTRACT_C.PRINT_STYLE is
'宽2:一页两个货物 窄1:一页一个货物';
comment on column CONTRACT_C.OLD_STATE is
'归档前状态, 方便回退';
comment on column CONTRACT_C.STATE is
'0草稿 1已上报待报运
归档后, 其他选择合同的地方均去除.
表示合同已完成, 不论是否合同的货物是否全部真的走完, 因为有赔付等其他情况';
comment on column CONTRACT_C.OUT_STATE is
'0未走货 1部分 2全部
归档后, 其他选择合同的地方均去除.
表示合同已完成, 不论是否合同的货物是否全部真的走完, 因为有赔付等其他情况';
/*==============================================================*/
/* Table: CONTRACT_PRODUCT_C */
/*==============================================================*/
create table CONTRACT_PRODUCT_C (
CONTRACT_PRODUCT_ID VARCHAR2(40) not null,
CONTRACT_ID VARCHAR2(40),
FACTORY_ID VARCHAR2(40),
FACTORY_NAME VARCHAR2(50),
PRODUCT_NO VARCHAR2(50),
PRODUCT_IMAGE VARCHAR2(200),
PRODUCT_DESC VARCHAR2(600),
CNUMBER INT,
OUT_NUMBER INT,
LOADING_RATE VARCHAR2(10),
BOX_NUM INT,
PACKING_UNIT VARCHAR2(10),
PRICE NUMBER(10,2),
AMOUNT NUMBER(10,2),
FINISHED INT,
EXTS VARCHAR2(50),
ORDER_NO INT,
constraint PK_CONTRACT_PRODUCT_C primary key (CONTRACT_PRODUCT_ID)
);
comment on table CONTRACT_PRODUCT_C is
'装率和箱数报运业务使用,合同业务不使用。';
comment on column CONTRACT_PRODUCT_C.FACTORY_NAME is
'冗余';
comment on column CONTRACT_PRODUCT_C.OUT_NUMBER is
'分次走货';
comment on column CONTRACT_PRODUCT_C.LOADING_RATE is
'报运业务使用X/Y';
comment on column CONTRACT_PRODUCT_C.BOX_NUM is
'报运业务使用=数量除以装率的分母,不够进位为整数
先将玻璃杯装小纸箱子,然后在装集装箱';
comment on column CONTRACT_PRODUCT_C.PACKING_UNIT is
'PCS/SETS';
comment on column CONTRACT_PRODUCT_C.AMOUNT is
'冗余 自动计算: 数量x单价';
comment on column CONTRACT_PRODUCT_C.FINISHED is
'0未完成1完成';
comment on column CONTRACT_PRODUCT_C.EXTS is
'冗余,出处:出货表
附件对应SYS_CODE中的附件分类名称,多个用换行符隔开,没有附件是写无。附件分类相同时合并。';
/*==============================================================*/
/* Table: EXT_CPRODUCT_C */
/*==============================================================*/
create table EXT_CPRODUCT_C (
EXT_CPRODUCT_ID VARCHAR2(40) not null,
CONTRACT_PRODUCT_ID VARCHAR2(40),
FACTORY_ID VARCHAR2(40),
FACTORY_NAME VARCHAR2(50),
CTYPE INT,
PRODUCT_NO VARCHAR2(50),
PRODUCT_IMAGE VARCHAR2(200),
PRODUCT_DESC VARCHAR2(600),
CNUMBER INT,
PACKING_UNIT VARCHAR2(10),
PRICE NUMBER(10,2),
AMOUNT NUMBER(10,2),
PRODUCT_REQUEST VARCHAR2(2000),
ORDER_NO INT,
constraint PK_EXT_CPRODUCT_C primary key (EXT_CPRODUCT_ID)
);
comment on table EXT_CPRODUCT_C is
'附件和货物的不同:多了附件类型和要求;同时货物从属合同,附件从属货物。';
comment on column EXT_CPRODUCT_C.FACTORY_NAME is
'冗余';
comment on column EXT_CPRODUCT_C.CTYPE is
'SYS_CODE_B 0104';
comment on column EXT_CPRODUCT_C.AMOUNT is
'自动计算: 数量x单价';
/*==============================================================*/
/* Table: SYS_CODE_B */
/*==============================================================*/
create table SYS_CODE_B (
SYS_CODE_ID VARCHAR2(40) not null,
NAME VARCHAR2(100),
PARENT_ID VARCHAR2(40),
PARENT_NAME VARCHAR2(100),
LAYER_NUM INT,
IS_LEAF INT,
QUOTE_NUM INT,
CNOTE VARCHAR2(100),
ICO VARCHAR2(20),
ORDER_NO INT,
STATE CHAR(1),
CREATED_BY VARCHAR2(40),
CREATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR2(40),
UPDATED_TIME TIMESTAMP,
constraint PK_SYS_CODE_B primary key (SYS_CODE_ID)
);
comment on table SYS_CODE_B is
'数据字典';
comment on column SYS_CODE_B.STATE is
'0停用1启用';
alter table CONTRACT_PRODUCT_C
add constraint FK_CONTRACT_REFERENCE_CONTRACT foreign key (CONTRACT_ID)
references CONTRACT_C (CONTRACT_ID);
alter table EXT_CPRODUCT_C
add constraint FK_EXT_CPRO_REFERENCE_CONTRACT foreign key (CONTRACT_PRODUCT_ID)
references CONTRACT_PRODUCT_C (CONTRACT_PRODUCT_ID);
如果sql在导入时出现二进制乱码时,不直接用工具,直接拷贝sql语句,进行执行
转载请注明出处:http://blog.csdn.net/acmman/article/details/48393163