create table G_SN_STATUS
(
WORK_ORDER VARCHAR(25) NOT NULL,
SERIAL_NUMBER VARCHAR(150) NOT NULL,
PART_ID VARCHAR(40) NOT NULL,
VERSION VARCHAR(25),
ROUTE_ID VARCHAR(40),
PDLINE_ID VARCHAR(40),
STAGE_ID VARCHAR(40),
PROCESS_ID VARCHAR(40),
TERMINAL_ID VARCHAR(40),
NEXT_PROCESS VARCHAR(40),
CURRENT_STATUS VARCHAR(1) default 0,
WORK_FLAG VARCHAR(1) default 0,
IN_PROCESS_TIME datetime,
OUT_PROCESS_TIME datetime,
IN_PDLINE_TIME datetime,
OUT_PDLINE_TIME datetime,
ENC_CNT VARCHAR(40),
PALLET_NO VARCHAR(30) default 'N/A',
CARTON_NO VARCHAR(30) default 'N/A',
CONTAINER VARCHAR(25) default 'N/A',
QC_NO VARCHAR(25) default 'N/A',
QC_RESULT VARCHAR(5) default 'N/A',
CUSTOMER_ID VARCHAR(40) default 0,
WARRANTY datetime,
REWORK_NO VARCHAR(25) default 'N/A',
EMP_ID VARCHAR(40) default 0,
SHIPPING_ID VARCHAR(40) default 0,
CUSTOMER_SN VARCHAR(50) default 'N/A',
WIP_PROCESS VARCHAR(40) default 0,
WIP_QTY VARCHAR(40) default 1,
BOX_NO VARCHAR(25) default 'N/A',
PANEL_NO VARCHAR(25) default 'N/A',
RP_ROUTE VARCHAR(1) default 'N',
BGA_FLAG VARCHAR(1) default 'N',
TRAY_NO VARCHAR(50) default 'N/A',
HOLD_FLAG VARCHAR(1) default 'N',
PASS_CNT VARCHAR(40)
);
alter TABLE [dbo].[G_SN_STATUS] ADD CONSTRAINT [pk_G_SN_STATUS] PRIMARY KEY
(
[SERIAL_NUMBER] ASC
);
create table G_SN_TRAVEL
(
WORK_ORDER VARCHAR(25),
SERIAL_NUMBER VARCHAR(150),
PART_ID VARCHAR(40),
VERSION VARCHAR(25),
ROUTE_ID VARCHAR(40),
PDLINE_ID VARCHAR(40),
STAGE_ID VARCHAR(40),
PROCESS_ID VARCHAR(40),
TERMINAL_ID VARCHAR(40),
NEXT_PROCESS VARCHAR(40),
CURRENT_STATUS VARCHAR(1) default 0,
WORK_FLAG VARCHAR(1) default 0,
IN_PROCESS_TIME datetime,
OUT_PROCESS_TIME datetime,
IN_PDLINE_TIME datetime,
OUT_PDLINE_TIME datetime,
ENC_CNT VARCHAR(40),
PALLET_NO VARCHAR(30) default 'N/A',
CARTON_NO VARCHAR(30) default 'N/A',
CONTAINER VARCHAR(25) default 'N/A',
QC_NO VARCHAR(25) default 'N/A',
QC_RESULT VARCHAR(5) default 'N/A',
CUSTOMER_ID VARCHAR(40) default 0,
WARRANTY datetime,
REWORK_NO VARCHAR(25) default 'N/A',
EMP_ID VARCHAR(40) default 0,
SHIPPING_ID VARCHAR(40) default 0,
CUSTOMER_SN VARCHAR(50) default 'N/A',
WIP_PROCESS VARCHAR(40) default 0,
WIP_QTY VARCHAR(40) default 1,
BOX_NO VARCHAR(25) default 'N/A',
PANEL_NO VARCHAR(25) default 'N/A',
RP_ROUTE VARCHAR(1) default 'N',
BGA_FLAG VARCHAR(1) default 'N',
TRAY_NO VARCHAR(50) default 'N/A',
HOLD_FLAG VARCHAR(1) default 'N',
PASS_CNT VARCHAR(40)
);
create table G_PACK_TRAY_H
(
TRAY_NO VARCHAR(25) NOT NULL,
WORK_ORDER VARCHAR(25),
PART_ID VARCHAR(25),
CLOSE_FLAG VARCHAR(8),
TERMINAL_ID VARCHAR(25),
CREATE_EMP_ID VARCHAR(25),
CREATE_TIME DATETIME default getdate(),
QTY VARCHAR(25),
CLOSE_TIME DATETIME,
CLOSE_EMP_ID VARCHAR(25)
);
alter TABLE [dbo].[G_PACK_TRAY_H] ADD CONSTRAINT [pk_G_PACK_TRAY_H] PRIMARY KEY
(
[TRAY_NO] ASC
);
create table G_PACK_TRAY_D
(
TRAY_NO VARCHAR(25) NOT NULL,
SERIAL_NUMBER VARCHAR(25) NOT NULL,
PART_ID VARCHAR(25),
QTY VARCHAR(25),
CREATE_TIME DATETIME default getdate()
);
alter TABLE [dbo].[G_PACK_TRAY_D] ADD CONSTRAINT [pk_G_PACK_TRAY_D] PRIMARY KEY
(
[TRAY_NO] ASC,
[SERIAL_NUMBER] ASC
);
CREATE TABLE [dbo].[G_PACK_CHECK_H](
[OF_CARTON_NO] [varchar](50) NOT NULL,
[CUST_PART_NO] [varchar](25) NULL,
[ASN_CARTON_NO] [varchar](50) NULL,
[TERMINAL_ID] [varchar](25) NULL,
[CREATE_EMP_ID] [varchar](25) NULL,
[CREATE_TIME] [datetime] NULL
)
create table G_PACK_BOX_H
(
BOX_NO VARCHAR(25) NOT NULL,
WORK_ORDER VARCHAR(25),
PART_ID VARCHAR(25),
CLOSE_FLAG VARCHAR(8),
TERMINAL_ID VARCHAR(25),
CREATE_EMP_ID VARCHAR(25),
CREATE_TIME DATETIME default getdate(),
QTY VARCHAR(25),
CLOSE_TIME DATETIME,
CLOSE_EMP_ID VARCHAR(25)
);
alter TABLE [dbo].[G_PACK_BOX_H] ADD CONSTRAINT [pk_G_PACK_BOX_H] PRIMARY KEY
(
[BOX_NO] ASC
)
create table G_PACK_BOX_D
(
BOX_NO VARCHAR(25) NOT NULL,
TRAY_NO VARCHAR(25) NOT NULL,
PART_ID VARCHAR(25),
QTY VARCHAR(25),
CREATE_TIME DATETIME default getdate()
);
alter TABLE [dbo].[G_PACK_BOX_D] ADD CONSTRAINT [pk_G_PACK_BOX_D] PRIMARY KEY
(
[BOX_NO] ASC,
[TRAY_NO] ASC
);
create table G_PACK_CARTON_H
(
CARTON_NO VARCHAR(25) NOT NULL,
WORK_ORDER VARCHAR(25),
PART_ID VARCHAR(25),
LOT_NO VARCHAR(25),
CLOSE_FLAG VARCHAR(8),
TERMINAL_ID VARCHAR(25),
CREATE_EMP_ID VARCHAR(25),
CREATE_TIME DATETIME default getdate(),
QTY VARCHAR(25),
CLOSE_TIME DATETIME,
CLOSE_EMP_ID VARCHAR(25)
);
alter TABLE [dbo].[G_PACK_CARTON_H] ADD CONSTRAINT [pk_G_PACK_CARTON_H] PRIMARY KEY
(
[CARTON_NO] ASC
);
create table G_PACK_CARTON_D
(
CARTON_NO VARCHAR(25) NOT NULL,
BOX_NO VARCHAR(25) NOT NULL,
PART_ID VARCHAR(25),
QTY VARCHAR(25),
CREATE_TIME DATETIME default getdate()
);
alter TABLE [dbo].[G_PACK_CARTON_D] ADD CONSTRAINT [pk_G_PACK_CARTON_D] PRIMARY KEY
(
[CARTON_NO] ASC,
[BOX_NO] ASC
);
create table G_PACK_CUST_DATA
(
CARTON_NO VARCHAR(50) NOT NULL,
PO_NUMBER VARCHAR(50) NOT NULL,
CARTON_QTY VARCHAR(50) NOT NULL,
ITEM_CODE VARCHAR(50) NOT NULL,
ITEM_REVISION VARCHAR(50) NOT NULL,
MPN VARCHAR(50) NOT NULL,
ITEM_DESC VARCHAR(150) NULL,
CODE09 VARCHAR(50) NULL,
BARCODE09 VARCHAR(50) NULL,
VENDOR_CODE VARCHAR(50) NULL,
COMPANY_CODE VARCHAR(50) NULL,
INSPECT_FLAG VARCHAR(50) NULL,
RESTRICT_FLAG VARCHAR(50) NULL,
ROHS VARCHAR(50) NULL,
SUPP_CODE VARCHAR(50) NULL,
VENDOR_LOT_NUMBER VARCHAR(50) NULL,
COUNTRY_OF_ORIGIN VARCHAR(50) NULL,
PRODUCTION_DATE VARCHAR(50) NULL,
REMARKS VARCHAR(50) NULL,
UOM VARCHAR(50) NULL,
PO_LINE_NUM VARCHAR(50) NULL,
SHIPMENT_NUM VARCHAR(50) NULL,
ITEM_DESC_EN VARCHAR(150) NULL,
IAW_INSPECTION_FLAG VARCHAR(50) NULL,
HW_M VARCHAR(50) NULL,
SN_TN VARCHAR(50) NULL)
;
alter table G_PACK_CUST_DATA add FLAG varchar(1);
alter TABLE [dbo].[G_PACK_CUST_DATA] ADD CONSTRAINT [pk_G_PACK_CUST_DATA] PRIMARY KEY
(
[CARTON_NO] ASC
);
create table G_PACK_CUST_DATA_HT
(
CARTON_NO VARCHAR(50) NOT NULL,
PO_NUMBER VARCHAR(50) NOT NULL,
CARTON_QTY VARCHAR(50) NOT NULL,
ITEM_CODE VARCHAR(50) NOT NULL,
ITEM_REVISION VARCHAR(50) NOT NULL,
MPN VARCHAR(50) NOT NULL,
ITEM_DESC VARCHAR(150) NULL,
CODE09 VARCHAR(50) NULL,
BARCODE09 VARCHAR(50) NULL,
VENDOR_CODE VARCHAR(50) NULL,
COMPANY_CODE VARCHAR(50) NULL,
INSPECT_FLAG VARCHAR(50) NULL,
RESTRICT_FLAG VARCHAR(50) NULL,
ROHS VARCHAR(50) NULL,
SUPP_CODE VARCHAR(50) NULL,
VENDOR_LOT_NUMBER VARCHAR(50) NULL,
COUNTRY_OF_ORIGIN VARCHAR(50) NULL,
PRODUCTION_DATE VARCHAR(50) NULL,
REMARKS VARCHAR(50) NULL,
UOM VARCHAR(50) NULL,
PO_LINE_NUM VARCHAR(50) NULL,
SHIPMENT_NUM VARCHAR(50) NULL,
ITEM_DESC_EN VARCHAR(150) NULL,
IAW_INSPECTION_FLAG VARCHAR(50) NULL,
HW_M VARCHAR(50) NULL,
SN_TN VARCHAR(50) NULL,
FLAG VARCHAR(1) NUL