<repo_name>Natt7/JINSHANG<file_sep>/complete/JINSHANG-110/schema.sql
create database db;
use db;

create schema T_GG_SJ_GOODS_schema
source type CSV
fields(
 "goodsid"              		type string,
 "deptid"               		type string,
 "packnum"              		type string,
 "barcode"              		type string,
 "goodslocid"           		type string,
 "stocktype"            		type string,
 "ownerid"              		type string,
 "ownername"            		type string,
 "goodsownermanageno"   		type string,
 "inbillid"             		type string,
 "goodsownerpackno"     		type string,
 "manageno"             		type string,
 "feebegindate"         		type DATETIME,
 "contractid"           		type string,
 "goodsstateno"         		type string,
 "goodsstatename"       		type string,
 "changeownertimes"     		type double default value '0',
 "goodstype"            		type string,
 "goodstypename"        		type string,
 "kindno"               		type string,
 "kindname"             		type string,
 "shopsignid"           		type string,
 "shopsignname"         		type string,
 "prodareaid"           		type string,
 "prodareaname"         		type string,
 "goodsbatchno"         		type string,
 "prodstoveno"          		type string,
 "gradenum"             		type string,
 "gradenumthick"        		type double,
 "gradenumwidth"        		type double,
 "gradenumlength"       		type double,
 "grossweight"          		type double,
 "netweight"            		type double,
 "poundweight"          		type double,
 "checkweight"          		type double,
 "sheetnum"             		type double default value '1',
 "unit"                 		type string,
 "packtype"             		type string,
 "stockareaid"          		type string,
 "qualitymemo"          		type string,
 "firstinownerid"       		type string,
 "firstindate"          		type DATETIME,
 "outbillid"            		type string,
 "ldglistid"            		type string,
 "materialgoodsid"      		type string,
 "intype"               		type string,
 "outtype"              		type string,
 "billstate"            		type double,
 "outbilltime"          		type DATETIME,
 "memo"                 		type string,
 "extsysplanobjectid"   		type string,
 "extsyskindid"         		type string,
 "extsysshopsignid"     		type string,
 "extsysprodareaid"     		type string,
 "foreignlistno"        		type string,
 "sendflag"             		type double,
 "r_record_create_date" 		type DATETIME,
 "r_record_create_user" 		type string,
 "r_record_update_date" 		type DATETIME,
 "r_record_update_user" 		type string,
 "r_record_is_deleted"  		type double,
 "incusttime"           		type DATETIME,
 "sidemark"             		type string,
 "temp"                 		type string,
 "length_product_max"   		type double,
 "heat_num"             		type string,
 "test_lot_num"         		type string,
 "r_record_change_flag" 		type double,
 "sdprice"              		type string,
 "extsysgradenum"       		type string,
 "collectionmanname"    		type string,
 "lockflag"             		type string,
 "check_type"           		type string,
 "outdate"              		type DATETIME,
 "yfweight"             		type double,
 "yfsheet"              		type double,
 "pregoodsid"           		type string,
 "issplit"              		type double,
 "gradenumxh"           		type double,
 "gradenumwhdw"         		type string,
 "splittime"            		type double,
 "isclear"              		type double,
 "singlesheetnum"       		type double,
 "gradenumhz"           		type string,
 "gradenumthickhz"      		type double,
 "singlesheet"          		type double,
 "loclv1"               		type string,
 "singlesheetunit"      		type string,
 "dcemp"                		type string,
 "qzemp"                		type string,
 "dcemp2"               		type string,
 "shipno"               		type string,
 "shipname"             		type string,
 "shipcd"               		type string,
 "shiplevel"            		type string,
 "cmmemo"               		type string,
 "cmmemock"             		type string,
 "shopsigncd"           		type string,
 "processtypename"      		type string,
 "packtypename"         		type string,
 "sort_emp"             		type string,
 "customerid"           		type string,
 "lvgoodsid"            		type string,
 "dispersesheet"        		type double,
 "dbdeptid"             		type string,
 "dbcustomer"           		type string,
 "dbgulender"           		type string,
 "locked_object"        		type string,
 "locked_date"          		type DATETIME,
 "unlocked_date"        		type DATETIME,
 "preownername"         		type string,
 "ply"                  		type double default value '0',
 "tdstate"              		type string default value '1',
 "opselected"           		type string,
 "oplock"               		type string,
 "opinupload"           		type string,
 "opchangeupload"       		type string,
 "opinbatchid"          		type string,
 "opchangebatchid"      		type string,
 "opinupload_date"      		type DATETIME,
 "out_package_status"   		type string,
 "out_package_desc"     		type string,
 "gmpacktype"           		type string,
 "handno"               		type string,
 "saveno"               		type string,
 "drawno"               		type string,
 "dangerouslevel"       		type string,
 "acceptancecriteria"   		type string,
 "shippingmark"         		type string,
 "loclv2"               		type string,
 "payedflag"            		type string,
 "ordergoodsownerid"    		type string,
 "ordergoodsownername"  		type string
)
RECORD DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_GG_SJ_GOODS_parser
TYPE rcd
SCHEMA T_GG_SJ_GOODS_schema;

CREATE TABLE T_GG_SJ_GOODS using T_GG_SJ_GOODS_parser; 

create schema T_ZY_RK_INBILL_schema
SOURCE TYPE CSV
FIELDS(
"inbillid" 						type string,
"deptid" 						type string,
"foreignlistno" 				type string,
"goodsbatchno" 					type string,
"intype" 						type string,
"feebegindate" 					type DATETIME,
"incusttime" 					type DATETIME,
"inbillownername" 				type string,
"inbillownerno" 				type string,
"inbillempno" 					type string,
"inbillempname" 				type string,
"inbilltime" 					type DATETIME,
"inbillmemo" 					type string,
"kindno" 						type string,
"kindname" 						type string,
"shopsignname" 					type string,
"prodareaname" 					type string,
"prodareaid" 					type string,
"remanageno" 					type string,
"shopsignid" 					type string,
"truckgroupname" 				type string,
"truckgroupno" 					type string,
"planno" 						type string,
"manageno" 						type string,
"sheetnumsum" 					type double,
"grossweightsum" 				type double,
"netweightsum" 					type double,
"goodsownermanageno" 			type string,
"firstindate" 					type DATETIME,
"gradenum" 						type string,
"r_record_create_date" 			type DATETIME,
"r_record_create_user" 			type string,
"r_record_update_date" 			type DATETIME,
"r_record_update_user" 			type string,
"r_record_is_deleted" 			type double,
"stocktype" 					type string,
"r_record_change_flag" 			type double,
"rktype" 						type string,
"trans_type" 					type string,
"finish_date" 					type DATETIME,
"check_date" 					type DATETIME,
"check_type" 					type string,
"sort_emp" 						type string,
"check_emp" 					type string,
"loclv1" 						type string,
"loclv2" 						type string,
"dcemp" 						type string,
"qzemp" 						type string,
"dcemp2" 						type string,
"sendmessage" 					type string,
"dtlcount" 						type double,
"sidemark" 						type string,
"ischecked" 					type double,
"sheetsumsum" 					type double,
"issettled" 					type double,
"handno" 						type string,
"saveno" 						type string,
"deptfrom" 						type string,
"jfsendflag" 					type double,
"checkdtlcount" 				type double
)
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_RK_INBILL_parser
TYPE rcd
SCHEMA T_ZY_RK_INBILL_schema;

CREATE TABLE T_ZY_RK_INBILL using T_ZY_RK_INBILL_parser; 

CREATE SCHEMA T_ZY_CK_OUTBILL_schema
SOURCE TYPE CSV
FIELDS(                                                          
"outbillid"                     type string,
"deptid"                        type string,
"foreignlistno"                 type string,
"outbillownername"              type string,
"outbillownerno"                type string,
"outbillpickownername"          type string,
"outbillpickownerno"            type string,
"outtype"                       type string,
"outcusttime"                   type datetime,
"outbillempno"                  type string,
"outbillempname"                type string,
"outbilltime"                   type datetime,
"newmanagenum"                  type string,
"truckgroupno"                  type string,
"outcarno"                      type string,
"outbillmemo"                   type string,
"planno"                        type string,
"netweightsum"                  type double,
"sheetnumsum"                   type double,
"r_record_create_date"          type datetime,
"r_record_create_user"          type string,
"r_record_update_date"          type datetime,
"r_record_update_user"          type string,
"r_record_is_deleted"           type double,
"outstate"                      type string,
"invoicekindid"                 type string,
"invoicekindname"               type string,
"r_record_change_flag"          type double,
"printcount"                    type double,
"maxprintcount"                 type double,
"issplit"                       type double,
"outtypename"                   type string,
"check_type"                    type string,
"operator"                      type string,
"outcardrivername"              type string,
"idcode"                        type string,
"settlenum"                     type string,
"outpassword"                   type string,
"sendmessage"                   type string,
"dtlcount"                      type double,
"confirm_flag"                  type string default value '0',
"confirm_date"                  type datetime,
"confirm_emp"                   type string,
"issettled"                     type double,
"deptto"                        type string,
"trans_type"                    type string,
"jfsendflag"                    type double,
"jyzxflag"                      type double,
"username"                      type string,
"billlock"                      type string
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_CK_OUTBILL_parser
TYPE rcd
SCHEMA T_ZY_CK_OUTBILL_schema;

CREATE TABLE T_ZY_CK_OUTBILL using T_ZY_CK_OUTBILL_parser;

create schema T_ZY_JG_PROCESS_schema
SOURCE TYPE CSV
FIELDS(
"processid" 					type string,
"deptid" 						type string,
"customerid" 					type string,
"processdept" 					type string,
"processdeptname" 				type string,
"processtype" 					type string,
"processtypename" 				type string,
"processmold" 					type string,
"processmoldname" 				type string,
"processstate" 					type double,
"planenddate" 					type datetime,
"kindno" 						type string,
"kindname" 						type string,
"packtype" 						type string,
"packtypename" 					type string,
"woodtype" 						type string,
"woodtypename" 					type string,
"straptype" 					type string,
"straptypename" 				type string,
"processprecision" 				type string,
"orderinfo" 					type string,
"fee" 							type double,
"length" 						type double,
"weigtht" 						type double,
"sheet" 						type double,
"piecenum" 						type double,
"outcarbilltime" 				type datetime,
"outcarbillempno" 				type string,
"outcarbillempname" 			type string,
"planno" 						type string,
"preweightsum" 					type double,
"meno" 							type string,
"gradenumrange" 				type string,
"gradenumrangename" 			type string,
"thickrange" 					type string,
"thickrangename" 				type string,
"r_record_create_date" 			type datetime,
"r_record_create_user" 			type string,
"r_record_update_date" 			type datetime,
"r_record_update_user" 			type string,
"r_record_is_deleted" 			type double,
"r_record_change_flag" 			type double,
"density" 						type double,
"processcustomno" 				type string,
"processcustomname" 			type string,
"settledeptno" 					type string,
"settledeptname" 				type string,
"settle_staus" 					type string,
"settle_staus_name" 			type string,
"settle_no" 					type string,
"settle_date" 					type datetime,
"acceptancer" 					type string,
"acceptance_time" 				type datetime,
"chanxian" 						type string,
"mddeptname" 					type string,
"articleys" 					type string,
"materialgradenum" 				type string,
"materialshopsign" 				type string,
"cbxjgtype" 					type string,
"jgmessage" 					type string,
"jgstatus" 						type string,
"articlefee" 					type string,
"issettled" 					type double,
"specialdown" 					type string,
"articlesheet" 					type double, 
"articleweight" 				type double,
"username" 						type string,
"jfsendflag" 					type double,
"isreceived" 					type string,
"specialmemo" 					type string,
"toprocessid" 					type string,
"jxlocked" 						type string
)
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_JG_PROCESS_parser
TYPE rcd
SCHEMA T_ZY_JG_PROCESS_schema;

CREATE TABLE T_ZY_JG_PROCESS using T_ZY_JG_PROCESS_parser; 

create schema union_all_schema
source type csv
fields(
  "store_amount"       		type double,
  "store_in_amount"     	type double,
  "store_out_amount"      	type double, 
  "store_process_amount"    type double
  )
schema delimiter "LF"
field delimiter ","
text qualifier "DQM";

create parser union_all_parser
type rcd
schema union_all_schema;

create table union_all using union_all_parser;

create index union_all_index on table union_all(store_amount);

create statistics model union_all_model on table union_all
measures (sum(store_amount),sum(store_in_amount),sum(store_out_amount),sum(store_process_amount));
<file_sep>/schema/T_SS_SMS_SEND_LOG.sql
create schema T_SS_SMS_SEND_LOG_schema
SOURCE TYPE CSV
FIELDS(
"seg_no" type str,
"send_index" type str,
"send_id" type str,
"important_flag" type str,
"priority" type str,
"customer_id" type str,
"reciever_name" type str,
"destination_mobile" type str,
"sms_message" type str,
"sender_sign" type str,
"remark" type str,
"operator" type str,
"plan_send_date" type DATETIME,
"operate_date" type DATETIME,
"send_date" type DATETIME,
"business_no" type str,
"module_code" type str,
"deptid" type str
)
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_SS_SMS_SEND_LOG_parser
TYPE rcd
SCHEMA T_SS_SMS_SEND_LOG_schema;

CREATE TABLE T_SS_SMS_SEND_LOG using T_SS_SMS_SEND_LOG_parser; 

create index T_SS_SMS_SEND_LOG_index on table T_SS_SMS_SEND_LOG(seg_no);<file_sep>/complete/JINSHANG-110/del_4.sql
create job del_4_job(2)
begin

dataset file T_ZY_JG_PROCESS_dataset_22
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_process/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select union_select
(   
	inputs: "T_ZY_JG_PROCESS_dataset_22",
	fields: 
	 (
       (fname:"0",alias:"store_amount",type:"double"),
       (fname:"0",alias:"store_in_amount",type:"double"),
       (fname:"0",alias:"store_out_amount",type:"double"),
       (fname:"preweightsum",alias:"store_process_amount",type:"double")
	 ),
	distinct: true,
	data_opr:delete,
    cache:true,
	conditions:" deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
); 

  dataproc statistics T_ZY_JG_PROCESS_del_statistics
(
	inputs:union_select,
	table:union_all,
	data_opr:delete
);

end;

run job del_4_job (threads:8);<file_sep>/uncomplete/JINSHANG-94/jinshang-94.sql
INSERT INTO SHOW.PDGM_SHOWKC --库存量的数据来源

SELECT PROVIDER_NAME,
       sum(NETWEIGHTSUM),
       sum(KCTDNET),
       0
FROM
  ( SELECT PROVIDER_NAME,
           NETWEIGHTSUM,
           0 KCTDNET
   FROM
     ( SELECT '广东韶钢松山股份有限公司' PROVIDER_NAME,
                             0 NETWEIGHTSUM
      FROM dual
      UNION ALL --梅钢
SELECT '上海梅山钢铁股份有限公司' PROVIDER_NAME,
                      sum(netweight) NETWEIGHTSUM
      FROM wmsdba.t_gg_sj_goods t
      WHERE goodsstateno=20
        AND EXISTS
          (SELECT 1
           FROM WL.T_OWNER W
           WHERE SEG_NO='00103'
             AND T.DEPTID=W.DEPTID
             AND t.ownerid=w.owner_id
             AND (w.deptid!='0301'
                  AND w.deptid!='4501'))
        AND EXISTS
          (SELECT 1
           FROM wl.t_his_t_stacking_m m,wl.t_his_t_stacking_d d
           WHERE m.manu_id=d.manu_id
             AND m.stacking_rec_num=d.stacking_rec_num
             AND m.seg_no='00103'
             AND m.manu_id='BGTM'
             AND t.packnum=d.pack_num)
      UNION ALL --股份
SELECT '宝山钢铁股份有限公司' PROVIDER_NAME,
                    sum(netweight) NETWEIGHTSUM
      FROM wmsdba.t_gg_sj_goods t
      WHERE goodsstateno=20
        AND EXISTS
          (SELECT 1
           FROM WL.T_OWNER W
           WHERE SEG_NO='00103'
             AND T.DEPTID=W.DEPTID
             AND t.ownerid=w.owner_id
             AND (w.deptid!='0301'
                  AND w.deptid!='4501'))
        AND EXISTS
          (SELECT 1
           FROM wl.t_his_t_stacking_m m,wl.t_his_t_stacking_d d
           WHERE m.manu_id=d.manu_id
             AND m.stacking_rec_num=d.stacking_rec_num
             AND m.seg_no='00103'
             AND m.manu_id='BGSA'
             AND t.packnum=d.pack_num)
      UNION ALL --特殊钢
SELECT '宝钢特钢有限公司' PROVIDER_NAME,
                  sum(netweight) NETWEIGHTSUM
      FROM wmsdba.t_gg_sj_goods t
      WHERE goodsstateno=20
        AND EXISTS
          (SELECT 1
           FROM WL.T_OWNER W
           WHERE SEG_NO='00103'
             AND T.DEPTID=W.DEPTID
             AND t.ownerid=w.owner_id
             AND (w.deptid!='0301'
                  AND w.deptid!='4501'))
        AND EXISTS
          (SELECT 1
           FROM wl.t_his_t_stacking_m m,wl.t_his_t_stacking_d d
           WHERE m.manu_id=d.manu_id
             AND m.stacking_rec_num=d.stacking_rec_num
             AND m.seg_no='00103'
             AND m.manu_id='BGSW'
             AND t.packnum=d.pack_num))
   UNION ALL --已开单
SELECT PROVIDER_NAME,
       0,
       NETWEIGHTSUM
   FROM
     ( SELECT '广东韶钢松山股份有限公司' PROVIDER_NAME,
                             0 NETWEIGHTSUM
      FROM dual
      UNION ALL --梅钢
SELECT '上海梅山钢铁股份有限公司' PROVIDER_NAME,
                      sum(netweight) NETWEIGHTSUM
      FROM wmsdba.t_gg_sj_goods t
      WHERE goodsstateno=20
        AND EXISTS
          (SELECT 1
           FROM WL.T_OWNER W
           WHERE SEG_NO='00103'
             AND T.DEPTID=W.DEPTID
             AND t.ownerid=w.owner_id
             AND (w.deptid!='0301'
                  AND w.deptid!='4501'))
        AND EXISTS
          (SELECT 1
           FROM wl.t_his_t_stacking_m m,wl.t_his_t_stacking_d d
           WHERE m.manu_id=d.manu_id
             AND m.stacking_rec_num=d.stacking_rec_num
             AND m.seg_no='00103'
             AND m.manu_id='BGTM'
             AND t.packnum=d.pack_num)
        AND exists
          (SELECT 1
           FROM wl.t_s_bill_d d
           WHERE t.packnum=d.pack_id
             AND d.seg_no='00103')
      UNION ALL --股份
SELECT '宝山钢铁股份有限公司' PROVIDER_NAME,
                    sum(netweight) NETWEIGHTSUM
      FROM wmsdba.t_gg_sj_goods t
      WHERE goodsstateno=20
        AND EXISTS
          (SELECT 1
           FROM WL.T_OWNER W
           WHERE SEG_NO='00103'
             AND T.DEPTID=W.DEPTID
             AND t.ownerid=w.owner_id
             AND (w.deptid!='0301'
                  AND w.deptid!='4501'))
        AND EXISTS
          (SELECT 1
           FROM wl.t_his_t_stacking_m m,wl.t_his_t_stacking_d d
           WHERE m.manu_id=d.manu_id
             AND m.stacking_rec_num=d.stacking_rec_num
             AND m.seg_no='00103'
             AND m.manu_id='BGSA'
             AND t.packnum=d.pack_num)
        AND exists
          (SELECT 1
           FROM wl.t_s_bill_d d
           WHERE t.packnum=d.pack_id
             AND d.seg_no='00103')
      UNION ALL --特殊钢
SELECT '宝钢特钢有限公司' PROVIDER_NAME,
                  sum(netweight) NETWEIGHTSUM
      FROM wmsdba.t_gg_sj_goods t
      WHERE goodsstateno=20
        AND EXISTS
          (SELECT 1
           FROM WL.T_OWNER W
           WHERE SEG_NO='00103'
             AND T.DEPTID=W.DEPTID
             AND t.ownerid=w.owner_id
             AND (w.deptid!='0301'
                  AND w.deptid!='4501'))
        AND EXISTS
          (SELECT 1
           FROM wl.t_his_t_stacking_m m,wl.t_his_t_stacking_d d
           WHERE m.manu_id=d.manu_id
             AND m.stacking_rec_num=d.stacking_rec_num
             AND m.seg_no='00103'
             AND m.manu_id='BGSW'
             AND t.packnum=d.pack_num)
        AND exists
          (SELECT 1
           FROM wl.t_s_bill_d d
           WHERE t.packnum=d.pack_id
             AND d.seg_no='00103')) )
GROUP BY PROVIDER_NAME;

<file_sep>/complete/JINSHANG-110/init.sql
create job 1_job(2)
begin
dataset file T_GG_SJ_GOODS_dataset
(
	schema: T_GG_SJ_GOODS_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_GG_SJ_GOODS.csv",
	serverid: 0,
	charset:utf-8,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_RK_INBILL_dataset
(
	schema: T_ZY_RK_INBILL_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_RK_INBILL.csv",
	serverid: 0,
	charset:utf-8,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_CK_OUTBILL_dataset
(
	schema: T_ZY_CK_OUTBILL_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_CK_OUTBILL.csv",
	serverid: 0,
	charset:utf-8,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_JG_PROCESS_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_JG_PROCESS.csv",
	serverid: 0,
	charset:utf-8,
	splitter: (block_size: 10000000)
);

dataproc select 1_select
(
	 fields: 
	 (
       (fname:"netweight",alias:"store_amount",type:"double"),
       (fname:"0",alias:"store_in_amount",type:"double"),
       (fname:"0",alias:"store_out_amount",type:"double"),
       (fname:"0",alias:"store_process_amount",type:"double")
	 ),
	 inputs: "T_GG_SJ_GOODS_dataset",
	 order_by:("store_process_amount"),
	 conditions:" goodsstateno = '110'
		AND deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
);

dataproc select 2_select
(
	 fields: 
	 (
       (fname:"0",alias:"store_amount",type:"double"),
       (fname:"netweightsum",alias:"store_in_amount",type:"double"),
       (fname:"0",alias:"store_out_amount",type:"double"),
       (fname:"0",alias:"store_process_amount",type:"double")
	 ),
	 inputs: "T_ZY_RK_INBILL_dataset",
	 order_by:("store_process_amount"),
	 conditions:" deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
);
 
 dataproc select 3_select
(
	 fields: 
	 (
       (fname:"0",alias:"store_amount",type:"double"),
       (fname:"0",alias:"store_in_amount",type:"double"),
       (fname:"netweightsum",alias:"store_out_amount",type:"double"),
       (fname:"0",alias:"store_process_amount",type:"double")
	 ),
	 inputs: "T_ZY_CK_OUTBILL_dataset",
	 order_by:("store_process_amount"),
	 conditions:" deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
);

dataproc select 4_select
(
	 fields: 
	 (
       (fname:"0",alias:"store_amount",type:"double"),
       (fname:"0",alias:"store_in_amount",type:"double"),
       (fname:"0",alias:"store_out_amount",type:"double"),
       (fname:"preweightsum",alias:"store_process_amount",type:"double")
	 ),
	 inputs: "T_ZY_JG_PROCESS_dataset",
	 order_by:("store_process_amount"),
	 conditions:" deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
);
 
dataproc union 1_union
(
    inputs:("1_select","2_select","3_select","4_select")
);

dataproc select union_select
(
	fields: 
	 (
       (fname:"store_amount",type:"double"),
       (fname:"store_in_amount",type:"double"),
       (fname:"store_out_amount",type:"double"),
       (fname:"store_process_amount",type:"double")
	 ),
	inputs:"1_union",
	cache:true
);
 
  dataproc statistics union_all_statistics
(
  inputs:union_select,
  table:union_all
);

end;

run job 1_job (threads:8);
<file_sep>/uncomplete/JINSHANG-74/jinshang-74.sql
SELECT *
FROM
  (SELECT rownum AS rownum_,
          aa.*
   FROM
     (SELECT nvl(a.manageno,'null') AS MANAGENO,
             nvl(a.kindname,'null') AS KINDNAME,
             nvl(a.shopsignname,'null') AS SHOPSIGNNAME,
             nvl(a.prodareaname,'null') AS PRODAREANAME,
             sum(decode(a.goodtype, '10', a.netweight, 0)) AS INSTOCK,
             sum(decode(a.goodtype, '20', a.netweight, 0)) AS OUTSTOCK,
             sum(decode(a.goodtype, '11', a.netweight, 0)) AS CHANGINSTOCK ,
             sum(decode(a.goodtype, '21', a.netweight, 0)) AS CHANGOUTSTOCK,
             sum(decode(a.goodtype, '12', a.netweight, 0)) AS PROCESSINSTOCK,
             sum(decode(a.goodtype, '22', a.netweight, 0)) AS PROCESSOUTSTOCK,
             sum(decode(a.goodtype, '30', a.netweight, 0)) AS ENDSTOCK,
             sum(decode(a.goodtype, '30', a.netweight, 0)) - sum(decode(a.goodtype, '10', a.netweight, 0)) + sum(decode(a.goodtype, '20', a.netweight, 0)) AS BEGINSTOCK
      FROM
        (SELECT t1.manageno,
                t1.kindname,
                t1.shopsignname,
                t1.gradenum,
                t1.prodareaname,
                t1.deptid,
                '10' goodtype,
                     t1.netweight
         FROM wmsdba.t_zy_rk_inbilldetail t1 ,
              ST.T_XTSZ_BIND b
         WHERE to_char(t1.firstindate, 'yyyy-mm-dd') >= '2015-07-16'
           AND to_char(t1.firstindate, 'yyyy-mm-dd') <= '2015-07-16'
           AND t1.deptid=b.dept_id
           AND t1.ownerid=b.owner_id
           AND b.alive_flag='1'
           AND b.seg_no='080001'
         UNION ALL SELECT t2.managenum,
                          t2.kindname,
                          t2.shopsignname,
                          t2.gradenum,
                          t2.prodareaname,
                          t2.deptid,
                          '20',
                          t2.netweight
         FROM wmsdba.t_zy_ck_outpack t2,
              wmsdba.t_zy_ck_outbill t3 ,
              ST.T_XTSZ_BIND b
         WHERE t2.deptid = t3.deptid
           AND t2.outbillno = t3.outbillid
           AND to_char(t2.OutCustTime, 'yyyy-mm-dd') >= '2015-07-16'
           AND to_char(t2.OutCustTime, 'yyyy-mm-dd') <= '2015-07-16'
           AND t2.deptid=b.dept_id
           AND t2.ownerno=b.owner_id
           AND b.alive_flag='1'
           AND b.seg_no='080001'
         UNION ALL SELECT t4.managenum,
                          t4.kindname,
                          t4.shopsignname,
                          t4.gradenum,
                          t4.prodareaname,
                          t4.deptid,
                          '11',
                          t4.netweight
         FROM wmsdba.t_zy_gh_changeownerdetail t4,
              wmsdba.t_zy_gh_changeownerlist t5 ,
              ST.T_XTSZ_BIND b
         WHERE t4.deptid = t5.deptid
           AND t4.changeownerno = t5.changeownerid
           AND to_char(t5.changedate, 'yyyy-mm-dd') >= '2015-07-16'
           AND to_char(t5.changedate, 'yyyy-mm-dd') <= '2015-07-16'
           AND t4.deptid=b.dept_id
           AND t5.newownerno=b.owner_id
           AND b.alive_flag='1'
           AND b.seg_no='080001'
         UNION ALL SELECT t4.managenum,
                          t4.kindname,
                          t4.shopsignname,
                          t4.gradenum,
                          t4.prodareaname,
                          t4.deptid,
                          '21',
                          t4.netweight
         FROM wmsdba.t_zy_gh_changeownerdetail t4,
              wmsdba.t_zy_gh_changeownerlist t5 ,
              ST.T_XTSZ_BIND b
         WHERE t4.deptid = t5.deptid
           AND t4.changeownerno = t5.changeownerid
           AND to_char(t5.changedate, 'yyyy-mm-dd') >= '2015-07-16'
           AND to_char(t5.changedate, 'yyyy-mm-dd') <= '2015-07-16'
           AND t4.deptid=b.dept_id
           AND t5.preownerno=b.owner_id
           AND b.alive_flag='1'
           AND b.seg_no='080001'
         UNION ALL SELECT t6.manageno,
                          t6.kindname,
                          t6.shopsignname,
                          t6.gradenum,
                          t6.prodareaname,
                          t6.deptid,
                          '12',
                          t6.netweight
         FROM wmsdba.t_zy_jg_procarticledtl t6 ,
              ST.T_XTSZ_BIND b
         WHERE t6.deptid LIKE '080001'||'%'
           AND to_char(t6.ACCEPTANCE_TIME, 'yyyy-mm-dd') >= '2015-07-16'
           AND to_char(t6.acceptance_time, 'yyyy-mm-dd') <= '2015-07-16'
           AND t6.deptid=b.dept_id
           AND t6.ownerid=b.owner_id
           AND b.alive_flag='1'
           AND b.seg_no='080001'
         UNION ALL SELECT t7.manageno,
                          t7.kindname,
                          t7.shopsignname,
                          t7.gradenum,
                          t7.prodareaname,
                          t7.deptid,
                          '22',
                          t7.netweight
         FROM wmsdba.t_zy_jg_procmaterialdtl t7,
              wmsdba.t_zy_jg_process t8 ,
              ST.T_XTSZ_BIND b
         WHERE t7.deptid LIKE '080001'||'%'
           AND t7.deptid = t8.deptid
           AND t7.processid = t8.processid
           AND to_char(t8.outcarbilltime, 'yyyy-mm-dd') >= '2015-07-16'
           AND to_char(t8.outcarbilltime, 'yyyy-mm-dd') <= '2015-07-16'
           AND t7.deptid=b.dept_id
           AND t7.ownerid=b.owner_id
           AND b.alive_flag='1'
           AND b.seg_no='080001'
         UNION ALL SELECT b.manageno,
                          b.kindname,
                          b.shopsignname,
                          b.gradenum,
                          b.prodareaname,
                          b.deptid,
                          '30',
                          b.netweight
         FROM
           (SELECT /*+ index(t,T_GG_SJ_GOODS_INDX02) */ t.manageno,
                                                        t.kindname,
                                                        t.shopsignname,
                                                        t.gradenum,
                                                        t.prodareaname,
                                                        t.deptid,
                                                        t.netweight
            FROM wmsdba.t_gg_sj_goods t ,
                 ST.T_XTSZ_BIND b
            WHERE 1=1
              AND t.goodsstateno = '20'
              AND t.deptid=b.dept_id
              AND t.ownerid=b.owner_id
              AND b.alive_flag='1'
              AND b.seg_no='080001'
            UNION ALL SELECT t1.manageno,
                             t1.kindname,
                             t1.shopsignname,
                             t1.gradenum,
                             t1.prodareaname,
                             t1.deptid,
                             0 - t1.netweight
            FROM wmsdba.t_zy_rk_inbilldetail t1 ,
                 ST.T_XTSZ_BIND b
            WHERE to_char(t1.firstindate, 'yyyy-mm-dd') > '2015-07-16'
              AND t1.deptid=b.dept_id
              AND t1.ownerid=b.owner_id
              AND b.alive_flag='1'
              AND b.seg_no='080001'
            UNION ALL SELECT t4.managenum,
                             t4.kindname,
                             t4.shopsignname,
                             t4.gradenum,
                             t4.prodareaname,
                             t4.deptid,
                             0 - t4.netweight
            FROM wmsdba.t_zy_gh_changeownerdetail t4,
                 wmsdba.t_zy_gh_changeownerlist t5 ,
                 ST.T_XTSZ_BIND b
            WHERE t4.deptid = t5.deptid
              AND t4.changeownerno = t5.changeownerid
              AND to_char(t5.changedate, 'yyyy-mm-dd') > '2015-07-16'
              AND t4.deptid=b.dept_id
              AND t5.newownerno=b.owner_id
              AND b.alive_flag='1'
              AND b.seg_no='080001'
            UNION ALL SELECT t6.manageno,
                             t6.kindname,
                             t6.shopsignname,
                             t6.gradenum,
                             t6.prodareaname,
                             t6.deptid,
                             0 - t6.netweight
            FROM wmsdba.t_zy_jg_procarticledtl t6 ,
                 ST.T_XTSZ_BIND b
            WHERE t6.deptid LIKE '080001'||'%'
              AND to_char(t6.ACCEPTANCE_TIME, 'yyyy-mm-dd') > '2015-07-16'
              AND t6.deptid=b.dept_id
              AND t6.ownerid=b.owner_id
              AND b.alive_flag='1'
              AND b.seg_no='080001'
            UNION ALL SELECT t2.managenum,
                             t2.kindname,
                             t2.shopsignname,
                             t2.gradenum,
                             t2.prodareaname,
                             t2.deptid,
                             t2.netweight
            FROM wmsdba.t_zy_ck_outpack t2,
                 wmsdba.t_zy_ck_outbill t3 ,
                 ST.T_XTSZ_BIND b
            WHERE t2.deptid = t3.deptid
              AND t2.outbillno = t3.outbillid
              AND to_char(t3.outbilltime, 'yyyy-mm-dd') > '2015-07-16'
              AND t2.deptid=b.dept_id
              AND t2.ownerno=b.owner_id
              AND b.alive_flag='1'
              AND b.seg_no='080001'
            UNION ALL SELECT t4.managenum,
                             t4.kindname,
                             t4.shopsignname,
                             t4.gradenum,
                             t4.prodareaname,
                             t4.deptid,
                             t4.netweight
            FROM wmsdba.t_zy_gh_changeownerdetail t4,
                 wmsdba.t_zy_gh_changeownerlist t5 ,
                 ST.T_XTSZ_BIND b
            WHERE t4.deptid = t5.deptid
              AND t4.changeownerno = t5.changeownerid
              AND to_char(t5.changedate, 'yyyy-mm-dd') > '2015-07-16'
              AND t4.deptid=b.dept_id
              AND t5.preownerno=b.owner_id
              AND b.alive_flag='1'
              AND b.seg_no='080001'
            UNION ALL SELECT t7.manageno,
                             t7.kindname,
                             t7.shopsignname,
                             t7.gradenum,
                             t7.prodareaname,
                             t7.deptid,
                             t7.netweight
            FROM wmsdba.t_zy_jg_procmaterialdtl t7,
                 wmsdba.t_zy_jg_process t8 ,
                 ST.T_XTSZ_BIND b
            WHERE t7.deptid LIKE '080001'||'%'
              AND t7.deptid = t8.deptid
              AND t7.processid = t8.processid
              AND to_char(t8.outcarbilltime, 'yyyy-mm-dd') > '2015-07-16'
              AND t7.deptid=b.dept_id
              AND t7.ownerid=b.owner_id
              AND b.alive_flag='1'
              AND b.seg_no='080001') b) a
      GROUP BY a.manageno,
               a.kindname,
               a.shopsignname,
               a.prodareaname)aa)
WHERE rownum_ > 1
  AND rownum_ <= 10<file_sep>/uncomplete/JINSHANG-100/jinshang-100.sql
SELECT *
FROM
  (SELECT gg.ownerid,
          '' ownername,
             gg.gradenumxh,
             gg.singlesheetnum,
             gg.SideMark,
             gg.ShipName,
             gg.netweight,
             gg.grossweight,
             gg.sheetnum,
             gl.PACKNUM,
             gl.MANAGENO,
             gl.GRADENUM,
             gl.GOODSLOCID,
             gl.KINDNAME,
             gl.SHOPSIGNNAME,
             gl.PRODAREANAME,
             gl.FIRSTINDATE
   FROM
     ( SELECT pregoodsid,
              tbx.ownerid,
              sum(tbx.gradenumxh) gradenumxh,
              sum(tbx.singlesheetnum) singlesheetnum,
              max(SideMark) SideMark,
              max(ShipName) ShipName ,
              sum(tbx.netweight) netweight,
              sum(tbx.grossweight) grossweight,
              sum(tbx.sheetnum) sheetnum
      FROM
        ( SELECT GOODSID,
                 OWNERID,
                 OWNERNAME,
                 gradenumxh,
                 singlesheetnum,
                 netweight,
                 grossweight,
                 sheetnum
         FROM T_GG_SJ_Goods
         WHERE goodsstateno='20'
           AND r_record_is_deleted=0
           AND deptid='0301'
         UNION ALL SELECT GOODSID,OWNERID,OWNERNAME,-gradenumxh,-singlesheetnum,-netweight,-grossweight,-sheetnum
         FROM T_ZY_RK_InBillDetail
         WHERE deptid='0301'
           AND goodsstateno='20'
           AND firstindate>=to_date('2015/7/2','yyyy-mm-dd')
         UNION ALL SELECT PROCARTICLEDTLID,
                          OWNERID,
                          OWNERNAME,
                          0 gradenumxh,
                            0 singlesheetnum,-netweight,-grossweight,-sheetnum
         FROM T_ZY_JG_ProcArticleDtl
         WHERE deptid='0301'
           AND firstindate>=to_date('2015/7/2','yyyy-mm-dd')
           AND goodsstateno='130'
         UNION ALL SELECT GOODSID,
                          newownerno OWNERID,
                          newownername OWNERNAME,
                          0 gradenumxh,
                            0 singlesheetnum,-netweight,-grossweight,-sheetnum
         FROM
           (SELECT b.goodsid,
                   a.newownerno,
                   a.newownername,
                   b.netweight,
                   b.grossweight,
                   b.sheetnum
            FROM
              (SELECT deptid,
                      ChangeOwnerID,
                      newownerno,
                      newownername
               FROM T_ZY_GH_ChangeOwnerList
               WHERE DeptID='0301'
                 AND changedate>=to_date('2015/7/2','yyyy-mm-dd')) a ,
                                                                   T_ZY_GH_ChangeOwnerDetail b
            WHERE a.changeownerid=b.changeownerno
              AND a.deptid=b.deptid) tb1
         UNION ALL SELECT GOODSID,
                          OWNERNO,
                          OWNERNAME,
                          gradenumxh,
                          singlesheetnum,
                          netweight,
                          grossweight,
                          sheetnum
         FROM T_ZY_CK_OutPack
         WHERE deptid='0301'
           AND OutCustTime>=to_date('2015/7/2','yyyy-mm-dd')
         UNION ALL SELECT a.GOODSID,
                          OWNERID,
                          OWNERNAME,
                          gradenumxh,
                          singlesheetnum,
                          netweight,
                          grossweight,
                          sheetnum
         FROM T_GG_SJ_Goods a,
              T_ZY_CK_CLEAR b
         WHERE a.goodsid=b.goodsid
           AND a.deptid='0301'
           AND CREATDATE>=to_date('2015/7/2','yyyy-mm-dd')
         UNION ALL SELECT GOODSID,
                          OWNERID,
                          OWNERNAME,
                          0 gradenumxh,
                            0 singlesheetnum,
                              netweight,
                              grossweight,
                              sheetnum
         FROM T_ZY_JG_ProcMaterialDtl
         WHERE deptid='0301'
           AND EXISTS
             (SELECT 1
              FROM T_ZY_JG_PROCESS
              WHERE ProcessID=T_ZY_JG_ProcMaterialDtl.ProcessID
                AND deptid=T_ZY_JG_ProcMaterialDtl.deptid
                AND OutCarBillTime>=to_date('2015/7/2','yyyy-mm-dd'))
         UNION ALL SELECT GOODSID,
                          preownerno OWNERID,
                          proownername OWNERNAME,
                          0 gradenumxh,
                            0 singlesheetnum,
                              netweight,
                              grossweight,
                              sheetnum
         FROM
           (SELECT b.goodsid,
                   a.preownerno,
                   a.proownername,
                   b.netweight,
                   b.grossweight,
                   b.sheetnum
            FROM
              (SELECT deptid,
                      ChangeOwnerID,
                      preownerno,
                      proownername
               FROM T_ZY_GH_ChangeOwnerList
               WHERE DeptID='0301'
                 AND changedate>=to_date('2015/7/2','yyyy-mm-dd')) a ,
                                                                   T_ZY_GH_ChangeOwnerDetail b
            WHERE a.changeownerid=b.changeownerno
              AND a.deptid=b.deptid) tb1)tbx
      LEFT JOIN
        (SELECT *
         FROM t_gg_sj_goods
         WHERE deptid='0301'
           AND r_record_is_deleted=0) pre ON tbx.goodsid=pre.goodsid
      GROUP BY pregoodsid,
               tbx.ownerid )gg
   LEFT JOIN
     (SELECT *
      FROM t_gg_sj_goods
      WHERE deptid='0301'
        AND r_record_is_deleted=0) gl ON gg.pregoodsid=gl.goodsid
   WHERE gg.ownerid = 'KH00001'
     AND gg.netweight <> 0)
WHERE netweight <> 0
  AND MANAGENO IS NOT NULL;

<file_sep>/uncomplete/JINSHANG-97/schema/T_ZY_GH_CHANGEOWNERDETAIL.sql
use db;
create schema t_zy_gh_changeownerdetail_schema
source type CSV
fields(
 "manageno" type str,
 "deptid" type str,
 "changeownerno" type str,
 "packnum" type str,
 "goodsid" type str,
 "inbegintime" type datetime format '%Y/%m/%d %H:%M:%S',
 "barcode" type str,
 "goodslocid" type str,
 "ownername" type str,
 "ownerno" type str,
 "pregoodsownermanagenum" type str,
 "goodsownermanagenum" type str,
 "goodsownerpacknum" type str,
 "premanagenum" type str,
 "managenum" type str,
 "contractno" type str,
 "goodsstatename" type str,
 "goodsstateno" type str,
 "goodstypename" type str,
 "goodstype" type str,
 "kindname" type str,
 "kindno" type str,
 "shopsignname" type str,
 "shopsignid" type str,
 "prodareaname" type str,
 "prodareaid" type str,
 "goodsbatchnum" type str,
 "gradenum" type str,
 "gradenumthick" type double,
 "gradenumwidth" type double,
 "gradenumlength" type double,
 "grossweight" type double,
 "netweight" type double,
 "poundweight" type double,
 "checkweight" type double,
 "sheetnum" type double,
 "qualitymemo" type str,
 "firstinownerid" type str,
 "firstindate" type datetime format '%Y/%m/%d %H:%M:%S',
 "inbillid" type str,
 "intype" type str,
 "prememo" type str,
 "memo" type str,
 "foreignlistno" type str,
 "preforeignlistno" type str,
 "orderlistno" type str,
 "preorderlistno" type str,
 "r_record_create_date" type datetime format '%Y/%m/%d %H:%M:%S',
 "r_record_create_user" type str,
 "r_record_update_date" type datetime format '%Y/%m/%d %H:%M:%S',
 "r_record_update_user" type str,
 "r_record_is_deleted" type double,
 "preincusttime" type datetime format '%Y/%m/%d %H:%M:%S',
 "incusttime" type datetime format '%Y/%m/%d %H:%M:%S',
 "sendflag" type double,
 "outchangesendflag" type double,
 "changetimes" type double,
 "originownername" type str,
 "originownerno" type str,
 "r_record_change_flag" type double,
 "custday" type double,
 "sdprice" type str,
 "newdate" type datetime format '%Y/%m/%d %H:%M:%S',
 "pregoodsid" type str,
 "check_type" type str,
 "singlesheetnum" type double,
 "gradenumxh" type double,
 "sidemark" type str,
 "sort_emp" type str,
 "dispersesheet" type double,
 "ply" type double default value "0",
 "originsheetnum" type double,
 "originnetweight" type double,
 "issplit" type double,
 "gmpacktype" type str,
 "preforeignlistcode" type str,
 "confirmflag" type str default value "0",
 "jyzxflag" type double,
 "loclv1" type str,
 "loclv2" type str,
 "outnetweight" type double
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";
CREATE PARSER t_zy_gh_changeownerdetail_parser
TYPE rcd
SCHEMA t_zy_gh_changeownerdetail_schema;
<file_sep>/uncomplete/JINSHANG-86/jinshang-86.sql
SELECT sum(netweight),COUNT *
FROM
  ( SELECT
     (SELECT sum(t.net_weight)
      FROM t_tm_stock_notice t
      WHERE t.print_batch_id=im.bill_id) netweight,
                                         bill_id
   FROM t_im_blvalidatehistory im
   WHERE R_RECORD_CREATE_DATE>to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
     AND seg_no='STM06'
     AND validatestate=11);

<file_sep>/processing/JINSHANG-76/add_3.sql
create job add_1_job(2)
begin
dataset file t_gg_sj_goods_dataset_11
(
	schema: t_gg_sj_goods_schema,
    filename: "/home/zhaoshun/Data/jingshang_data/T_GG_SJ_GOODS_add.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select t_gg_sj_goods_select11
(   
	fields:
	(
		(fname:"GOODSID",type:"string"),
		(fname:"DEPTID",type:"string"),
		(fname:"GRADENUM",type:"string"),
		(fname:"SHOPSIGNID",type:"string"),
		(fname:"SHOPSIGNNAME",type:"string"),
		(fname:"PRODAREAID",type:"string"),
		(fname:"PRODAREANAME",type:"string"),
		(fname:"KINDNO",type:"string"),
		(fname:"KINDNAME",type:"string"),
		(fname:"OWNERNAME",type:"string"),
		(fname:"GOODSOWNERPACKNO",type:"string"),
		(fname:"NETWEIGHT",type:"double"),
		(fname:"GROSSWEIGHT",type:"double"),
		(fname:"SHEETNUM",type:"double")
	),
	inputs: "t_gg_sj_goods_dataset_11",
	distinct: true
); 

dataproc distinct t_gg_sj_goods_dis 
(
	inputs:
	(   
		left_input:"t_gg_sj_goods_select11",
		right_input:"t_gg_sj_goods_select.output.cache"
	),
	left_fields:("GOODSID","DEPTID","GRADENUM","SHOPSIGNID"),
	right_fields:("GOODSID","DEPTID","GRADENUM","SHOPSIGNID"),
	leftadd:true,
	rightadd:false
);

dataproc select t_gg_sj_goods_select
(   
	fields:
	(
		(fname:"GOODSID",type:"string"),
		(fname:"DEPTID",type:"string"),
		(fname:"GRADENUM",type:"string"),
		(fname:"SHOPSIGNID",type:"string"),
		(fname:"SHOPSIGNNAME",type:"string"),
		(fname:"PRODAREAID",type:"string"),
		(fname:"PRODAREANAME",type:"string"),
		(fname:"KINDNO",type:"string"),
		(fname:"KINDNAME",type:"string"),
		(fname:"OWNERNAME",type:"string"),
		(fname:"GOODSOWNERPACKNO",type:"string"),
		(fname:"NETWEIGHT",type:"double"),
		(fname:"GROSSWEIGHT",type:"double"),
		(fname:"SHEETNUM",type:"double")
	),
	inputs: "t_gg_sj_goods_dis",
	cache:true
); 

dataproc statistics T_GG_SJ_GOOS_statistics
(
	inputs:"t_gg_sj_goods_select",
	table:t_gg_sj_goods
);

end;

run job add_1_job (threads:8);
<file_sep>/complete/JINSHANG-75/delete.sql
create job t_common_dept_delete_q1(zykie)
begin
dataset file t_common_dept2_dataset
(
	schema:t_common_dept_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_common_dept/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher t_common_dept_syncher 
( 
inputs:t_common_dept2_dataset, 
database:db, 
operator:delete, 
table:t_common_dept
); 
end;
run job t_common_dept_delete_q1(threads:8);

create job t_gg_sj_goods_delete_q1(zykie)
begin
dataset file t_gg_sj_goods2_dataset
(
	schema:t_gg_sj_goods_schema,
	filename:"/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/delete/delete.csv",
	serverid: 0,
	splitter:(block_size: 10000000)		  
);
dataproc syncher t_gg_sj_goods_syncher 
( 
inputs:t_gg_sj_goods2_dataset, 
database:db, 
operator:delete, 
table:t_gg_sj_goods
); 
end;
run job t_gg_sj_goods_delete_q1(threads:8);<file_sep>/complete/JINSHANG-75/add.sql
create job t_common_dept_insert_q1(zykie)
begin
dataset file t_common_dept1_dataset
(
	schema:t_common_dept_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_common_dept/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher t_common_dept_syncher 
( 
inputs:t_common_dept1_dataset, 
database:db, 
operator:add, 
table:t_common_dept
); 
end;
run job t_common_dept_insert_q1(threads:8);

create job t_gg_sj_goods_insert_q1(zykie)
begin
dataset file t_gg_sj_goods1_dataset
(
	schema:t_gg_sj_goods_schema,
	filename:"/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/insert/insert.csv",
	serverid: 0,
	splitter:(block_size: 10000000)		  
);
dataproc syncher t_gg_sj_goods_syncher 
( 
inputs:t_gg_sj_goods1_dataset, 
database:db, 
operator:add, 
table:t_gg_sj_goods
); 
end;
run job t_gg_sj_goods_insert_q1(threads:8);<file_sep>/complete/JINSHANG-89&90/jinshang-89.sql
SELECT kindname,
       sum(netweight)
FROM t_gg_sj_goods
WHERE goodsstateno=20
  AND (deptid NOT LIKE '03%'
       AND deptid NOT LIKE 'ZZ%'
       AND deptid NOT LIKE 'MG%')
GROUP BY kindname;
<file_sep>/uncomplete/JINSHANG-72/2_init.sql

create job T_COMMON_DEPT_job(2)
begin
dataset file T_COMMON_DEPT_dataset
(
	schema: "T_COMMON_DEPT_schema",
	filename: "/home/zhaoshun/Data/jinshang_New/T_COMMON_DEPT.txt",
	serverid: "0",
	splitter: (block_size: 10000000)		  		  
);

dataproc index T_COMMON_DEPT_index1
(
		inputs: T_COMMON_DEPT_dataset,
		table: T_COMMON_DEPT
);	
  dataproc doc T_COMMON_DEPT_doc
(  
   inputs:T_COMMON_DEPT_dataset,
   table:T_COMMON_DEPT
);

dataproc map T_COMMON_DEPT_map
(  
   inputs:T_COMMON_DEPT_dataset,
   table:T_COMMON_DEPT
);

end;
run job T_COMMON_DEPT_job(threads:8);

create job T_XTSZ_BIND_job(2)
begin
dataset file T_XTSZ_BIND_dataset
(
	schema: "T_XTSZ_BIND_schema",
	filename: "/home/zhaoshun/Data/jinshang_New/T_XTSZ_BIND.txt",
	serverid: "0",
	splitter: (block_size: 10000000)			  		  
);

dataproc index T_XTSZ_BIND_index
(
		inputs:T_XTSZ_BIND_dataset,
		table: T_XTSZ_BIND
);	
  dataproc doc T_BM_UI_CONFIGURE_doc
(  
   inputs:T_XTSZ_BIND_dataset,
   table:T_XTSZ_BIND
);

dataproc map T_XTSZ_BIND_map
(  
   inputs:T_XTSZ_BIND_dataset,
   table:T_XTSZ_BIND
);

end;
run job T_XTSZ_BIND_job(threads:8);

create job T_GG_SJ_GOODS_job(2)
begin
dataset file T_GG_SJ_GOODS_dataset
(
	schema:T_GG_SJ_GOODS_schema,
	filename:"/home/zhaoshun/Data/jinshang_New/T_GG_SJ_GOODS.txt",
	serverid:0,
	splitter:(block_size: 10000000)		  
);
dataproc select T_GG_SJ_GOODS_select
(
	fields: 
	(
     (fname:"nvl (DEPTID,'NULL')",alias:"DEPTID",type:"string"),
	 (fname:"nvl (OWNERNAME, 'NULL')",alias:"OWNERNAME",type:"string"),
	 (fname:"nvl (GOODSOWNERPACKNO, 'NULL')",alias:"GOODSOWNERPACKNO",type:"string"),
	 (fname:"GOODSSTATENO",type:"string"),
	 (fname:"nvl (KINDNO, 'NULL')",alias:"KINDNO",type:"string"),
	 (fname:"nvl (KINDNAME, 'NULL')",alias:"KINDNAME",type:"string"),
	 (fname:"nvl (SHOPSIGNID, 'NULL')",alias:"SHOPSIGNID",type:"string"),
	 (fname:"nvl (SHOPSIGNNAME, 'NULL')",alias:"SHOPSIGNNAME",type:"string"),
	 (fname:"nvl (PRODAREAID, 'NULL')",alias:"PRODAREAID",type:"string"),
	 (fname:"nvl (PRODAREANAME, 'NULL')",alias:"PRODAREANAME",type:"string"),
     (fname:"nvl (GRADENUM, 'NULL')",alias:"GRADENUM",type:"string"),
	 (fname:"nvl (GROSSWEIGHT, 0)",alias:"GROSSWEIGHT",type:"double"),
	 (fname:"nvl (NETWEIGHT, 0)",alias:"NETWEIGHT",type:"double"),
	 (fname:"nvl (SHEETNUM,  0)",alias:"SHEETNUM",type:"double"),
	 (fname:"FIRSTINDATE",type:"datetime"),
	 (fname:"iilmap('T_COMMON_DEPT_map',nvl (DEPTID,'NULL'))",alias:"DEPTNAME_1",type:"string"),
	 (fname:"iilmap('T_XTSZ_BIND_map_1',DEPTID)",alias:"vf_DEPTID",type:"string"),
	 (fname:"iilmap('T_XTSZ_BIND_map_2',OWNERID)",alias:"vf_OWNERID",type:"string")
	),
	 inputs: "T_GG_SJ_GOODS_dataset"
);

dataproc select T_GG_SJ_GOODS1_select
(
	fields: 
	(
     (fname:"DEPTID",type:"string"), 
     (fname:"DEPTNAME_1",type:"string"),
     (fname:"GRADENUM",type:"string"),
	 (fname:"SHOPSIGNID",type:"string"),
	 (fname:"SHOPSIGNNAME",type:"string"),
     (fname:"PRODAREAID",type:"string"),
	 (fname:"GOODSSTATENO",type:"string"),
     (fname:"PRODAREANAME",type:"string"),
	 (fname:"FIRSTINDATE",type:"datetime"),
	 (fname:"KINDNO",type:"string"),
	 (fname:"KINDNAME",type:"string"),
	 (fname:"OWNERNAME",type:"string"),
	 (fname:"GOODSOWNERPACKNO",type:"string"),
	 (fname:"sum(NETWEIGHT)",alias:"SUMNETWEIGHT",type:"double"),
	 (fname:"sum(GROSSWEIGHT)",alias:"SUMGROSSWEIGHT",type:"double"),
	 (fname:"sum(SHEETNUM)",alias:"SUMSHEETNUM",type:"double"),
	 (fname:"vf_DEPTID",type:"string"),
	 (fname:"vf_OWNERID",type:"string")
	),
	 inputs: "T_GG_SJ_GOODS_select",
	 conditions:"vf_DEPTID = '1'
	            AND vf_OWNERID = '1'
                AND GOODSSTATENO = '10'
				AND KINDNAME like '%热轧卷%'
				AND SHOPSIGNNAME like '%SS330%'
				AND GRADENUM like '%1037%'
				AND PRODAREANAME like '%宝钢%'
				AND GOODSOWNERPACKNO like '%15377%'
				AND FIRSTINDATE >= TO_DATE ('2012-07-16', '%Y-&m-%d')
				AND FIRSTINDATE < TO_DATE ('2016-07-16', '%Y-&m-%d') + 1",
	group_by:(DEPTID,GRADENUM,SHOPSIGNID,SHOPSIGNNAME,PRODAREAID,PRODAREANAME,KINDNO,KINDNAME,OWNERNAME,GOODSOWNERPACKNO)
);

 dataproc index T_GG_SJ_GOODS1_index
(
	inputs: T_GG_SJ_GOODS1_select,
	table: T_GG_SJ_GOODS1
);	

  dataproc doc T_GG_SJ_GOODS1_doc   
(  
   inputs:T_GG_SJ_GOODS1_select,
   table:T_GG_SJ_GOODS1,
   format:T_GG_SJ_GOODS1_parser,   
   fields:("DEPTID","DEPTNAME_1","GRADENUM","SHOPSIGNID","SHOPSIGNNAME","PRODAREAID","PRODAREANAME","KINDNO","KINDNAME","OWNERNAME","GOODSOWNERPACKNO","SUMNETWEIGHT","SUMGROSSWEIGHT","SUMSHEETNUM","vf_DEPTID","vf_OWNERID")
);

end;
run job T_GG_SJ_GOODS_job (threads:8);
<file_sep>/complete/JINSHANG-110/del_3.sql
create job del_3_job(2)
begin

dataset file T_ZY_CK_OUTBILL_dataset_22
(
	schema: T_ZY_CK_OUTBILL_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_ck_outbill/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select union_select
(   
	inputs: "T_ZY_CK_OUTBILL_dataset_22",
	fields: 
	 (
       (fname:"0",alias:"store_amount",type:"double"),
       (fname:"0",alias:"store_in_amount",type:"double"),
       (fname:"netweightsum",alias:"store_out_amount",type:"double"),
       (fname:"0",alias:"store_process_amount",type:"double")
	 ),
	distinct: true,
	data_opr:delete,
    cache:true,
	conditions:" deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
); 

  dataproc statistics T_ZY_CK_OUTBILL_del_statistics
(
	inputs:union_select,
	table:union_all,
	data_opr:delete
);

end;

run job del_3_job (threads:8);<file_sep>/uncomplete/JINSHANG-93/jinshang-93.sql
SELECT m.PROVIDER_NAME,
       sum(td.weight_active/1000) WEIGHT_STRC,
       min(t.time_receive),
       CASE
           WHEN min(t.time_receive)+7<sysdate THEN 1
           ELSE 0
       END flag
FROM wl.t_his_t_stacking_m t,
     wl.t_his_t_stacking_d td,
     wmsdba.t_si_logistics_ready_m m,
     wmsdba.t_si_logistics_ready_d md
WHERE t.stacking_rec_num=td.stacking_rec_num
  AND m.seg_no=md.seg_no
  AND m.ready_num=md.ready_num
  AND t.seg_no='00103'
  AND m.seg_no='00103'
  AND t.time_receive>=sysdate-30
  AND m.time_receive>sysdate-30
  AND t.optflag=0
  AND t.order_num=m.order_num
  AND t.seg_no=m.seg_no
  AND td.pack_num=md.pack_num
GROUP BY m.PROVIDER_NAME;

<file_sep>/complete/JINSHANG-76/add.sql
create job t_common_dept_insert_q1(zykie)
begin
dataset file t_common_dept1_dataset
(
	schema:T_COMMON_DEPT_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_common_dept/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher t_common_dept_syncher 
( 
inputs:t_common_dept1_dataset, 
database:db, 
operator:add, 
table:T_COMMON_DEPT
); 
end;
run job t_common_dept_insert_q1(threads:8);


create job t_bm_ui_configure_insert_q1(zykie)
begin
dataset file T_BM_UI_CONFIGURE1_dataset
(
	schema:T_BM_UI_CONFIGURE_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_bm_ui_configure/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher t_common_dept_syncher 
( 
inputs:T_BM_UI_CONFIGURE1_dataset, 
database:db, 
operator:add, 
table:T_BM_UI_CONFIGURE
); 
end;
run job t_bm_ui_configure_insert_q1(threads:8);

create job t_gg_sj_goods_insert_q1(zykie)
begin
dataset file T_GG_SJ_GOODS1_dataset
(
	schema:T_GG_SJ_GOODS_schema,
	filename:"/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/insert/insert.csv",
	serverid:0,
	splitter:(block_size: 10000000)		  
);
dataproc select T_GG_SJ_GOODS1_select
(
	fields: 
	(
     (fname:"nvl (deptid,'NULL')",alias:"deptid",type:"str"),	  
     (fname:"iilmap('T_COMMON_DEPT_map')",alias:"vf_deptname",type:"str"),
     (fname:"nvl (gradenum, 'NULL')",alias:"gradenum",type:"str"),
	 (fname:"nvl (shopsignid, 'NULL')",alias:"shopsignid",type:"str"),
	 (fname:"nvl (shopsignname, 'NULL')",alias:"shopsignname",type:"str"),
     (fname:"nvl (prodareaid, 'NULL')",alias:"prodareaid",type:"str"),
     (fname:"nvl (prodareaname, 'NULL')",alias:"prodareaname",type:"str"),
	 (fname:"nvl (kindno, 'NULL')",alias:"kindno",type:"str"),
	 (fname:"nvl (kindname, 'NULL')",alias:"kindname",type:"str"),
	 (fname:"nvl (ownername, 'NULL')",alias:"ownername",type:"str"),
	 (fname:"nvl (goodsownerpackno, 'NULL')",alias:"goodsownerpackno",type:"str"),
	 (fname:"nvl (netweight, 0)",alias:"netweight",type:"str"),
	 (fname:"nvl (grossweight, 0)",alias:"grossweight",type:"str"),
	 (fname:"nvl (sheetnum,  0)",alias:"sheetnum",type:"str"),
	 (fname:"iilmap('T_BM_UI_CONFIGURE_map',1)",alias:"vf_count",type:"str")
	),
	 inputs: "T_GG_SJ_GOODS1_dataset"
);

dataproc select T_GG_SJ_GOODS12_select
(
	fields: 
	(
     (fname:"deptid",type:"str"), 
     (fname:"vf_deptname",type:"str"),
     (fname:"gradenum",type:"str"),
	 (fname:"shopsignid",type:"str"),
	 (fname:"shopsignname",type:"str"),
     (fname:"prodareaid",type:"str"),
     (fname:"prodareaname",type:"str"),
	 (fname:"kindno",type:"str"),
	 (fname:"kindname",type:"str"),
	 (fname:"ownername",type:"str"),
	 (fname:"goodsownerpackno",type:"str"),
	 (fname:"sum(netweight)",alias:"sumnetweight",type:"str"),
	 (fname:"sum(grossweight)",alias:"sumgrossweight",type:"str"),
	 (fname:"sum(sheetnum)",alias:"sumsheetnum",type:"str"),
	 (fname:"vf_count",type:"str"),
	 (fname:"case vf_count when '0' then '101%'  else '101' end",alias:"vf_countcase",type:"str") 
	),
	 inputs: "T_GG_SJ_GOODS1_select",
	 group_by:(deptid,vf_deptname,gradenum,shopsignid,shopsignname,prodareaid,prodareaname,kindno,kindname,ownername,goodsownerpackno,vf_count,vf_countcase)
);
dataproc syncher T_GG_SJ_GOODS1_syncher
(
    inputs: T_GG_SJ_GOODS12_select,
    database:db,
    operator:add, 
    table:T_GG_SJ_GOODS1
);
end;
run job t_gg_sj_goods_insert_q1(threads:8);<file_sep>/schema/T_COMMON_DEPT.sql
create schema T_COMMON_DEPT_schema
source type CSV
fields(
 "deptid"                type str,
 "deptcd"                type str,
 "deptname"              type str,
 "deptlevel"             type double,
 "deptdesc"              type str,
 "deptorder"             type double,
 "parentdeptid"          type str,
 "level1deptid"          type str,
 "level1deptcd"          type str,
 "level1deptname"        type str,
 "level2deptid"          type str,
 "level2deptcd"          type str,
 "level2deptname"        type str,
 "level3deptid"          type str,
 "level3deptcd"          type str,
 "level3deptname"        type str,
 "level4deptid"          type str,
 "level4deptcd"          type str,
 "level4deptname"        type str,
 "r_record_create_date"  type DATETIME,
 "r_record_create_user"  type str,
 "r_record_update_date"  type DATETIME,
 "r_record_update_user"  type str,
 "r_record_is_deleted"   type double,
 "r_record_change_flag"  type double,
 "deptaddress"           type str,
 "depttype"              type str default value  '22',
 "districtid"            type str,
 "districtname"          type str,
 "belongarea"            type str,
 "firstdis"              type str,
 "opselected"            type str default value '0',
 "opupload"              type str,
 "limittime"             type DATETIME,
 "contractno"            type str,
 "baosaas_customer_name" type str
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "NULL";

CREATE PARSER T_COMMON_DEPT_parser
TYPE rcd
SCHEMA T_COMMON_DEPT_schema;

CREATE TABLE T_COMMON_DEPT using T_COMMON_DEPT_parser; 

CREATE INDEX T_COMMON_DEPT_index ON TABLE T_COMMON_DEPT (deptid);<file_sep>/uncomplete/JINSHANG-109/jinshang-109.sql
INSERT INTO SHOW.PDGM_KCAGE
SELECT deptid,
       sum(a),
       sum(b),
       sum(c),
       sum(d)
FROM
  ( SELECT deptid,
           sum(netweight) a,
           0 b,
             0 c,
               0 d
   FROM wmsdba.t_gg_sj_goods t
   WHERE goodsstateno=20
     AND firstindate>=sysdate-30
     AND exists
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.ownerid=w.owner_id
          AND deptid NOT LIKE 'A%'
          AND deptid!='0301'
          AND deptid!='4501')
   GROUP BY deptid
   UNION ALL SELECT deptid,
                    0 a,
                      sum(netweight) b,
                      0 c,
                        0 d
   FROM wmsdba.t_gg_sj_goods t
   WHERE goodsstateno=20
     AND firstindate>=sysdate-60
     AND firstindate<sysdate-30
     AND exists
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.ownerid=w.owner_id
          AND deptid NOT LIKE 'A%'
          AND deptid!='0301'
          AND deptid!='4501')
   GROUP BY deptid
   UNION ALL SELECT deptid,
                    0 a,
                      0 b,
                        sum(netweight) c,
                        0 d
   FROM wmsdba.t_gg_sj_goods t
   WHERE goodsstateno=20
     AND firstindate>=sysdate-180
     AND firstindate<sysdate-60
     AND exists
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.ownerid=w.owner_id
          AND deptid NOT LIKE 'A%'
          AND deptid!='0301'
          AND deptid!='4501')
   GROUP BY deptid
   UNION ALL SELECT deptid,
                    0 a,
                      0 b,
                        0 c,
                          sum(netweight) d
   FROM wmsdba.t_gg_sj_goods t
   WHERE goodsstateno=20
     AND firstindate<sysdate-180
     AND exists
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.ownerid=w.owner_id
          AND deptid NOT LIKE 'A%'
          AND deptid!='0301'
          AND deptid!='4501')
   GROUP BY deptid)
GROUP BY deptid;

<file_sep>/uncomplete/JINSHANG-83/jinshang-83.sql
SELECT sum(a)
FROM
  (SELECT sum(netweightsum) a
   FROM t_zy_rk_inbill
   WHERE r_record_create_date>=to_date(to_char(sysdate,'yyyy')||'-1-1','yyyy-mm-dd')
   UNION SELECT sum(netweightsum) a
   FROM t_zy_ck_outbill
   WHERE r_record_create_date>=to_date(to_char(sysdate,'yyyy')||'-1-1','yyyy-mm-dd'));

<file_sep>/uncomplete/JINSHANG-80/jinshang-80.sql
UPDATE SHOW.SEGWEIGHT
SET stackweight=0,
    tidanweight=0,
    readyweight=0
WHERE 1=1;


UPDATE SHOW.SEGWEIGHT s
SET STACKWEIGHT=
  (SELECT STACKWEIGHT
   FROM
     ( SELECT extsysstackid seg_no,
              SUM(STACKING_WEIGHT) STACKWEIGHT
      FROM t_gg_tx_dl_in_sm a
      WHERE a.insert_time>=to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
        AND exists
          (SELECT 1
           FROM SHOW.SEGWEIGHT b
           WHERE a.extsysstackid=b.seg_no)
      GROUP BY extsysstackid) t
   WHERE s.seg_no=t.seg_no);


UPDATE SHOW.SEGWEIGHT s
SET TIDANWEIGHT=
  (SELECT STACKWEIGHT
   FROM
     ( SELECT seg_no,
              SUM(UNIT_WEIGHT) STACKWEIGHT
      FROM t_gg_tx_dl_bil_d a
      WHERE a.insert_time>=to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
        AND exists
          (SELECT 1
           FROM SHOW.SEGWEIGHT b
           WHERE a.seg_no=b.seg_no)
      GROUP BY seg_no) t
   WHERE s.seg_no=t.seg_no);


UPDATE SHOW.SEGWEIGHT s
SET READYWEIGHT=
  (SELECT STACKWEIGHT
   FROM
     ( SELECT seg_no,
              SUM(WEIGHT_READY_TOT) STACKWEIGHT
      FROM t_si_logistics_ready_m a
      WHERE a.TIME_RECEIVE>=to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
        AND exists
          (SELECT 1
           FROM SHOW.SEGWEIGHT b
           WHERE a.seg_no=b.seg_no)
      GROUP BY seg_no) t
   WHERE s.seg_no=t.seg_no);

<file_sep>/schema/T_CHART_DETAILSTORAGE.sql
create schema T_CHART_DETAILSTORAGE_schema
source type CSV
fields(
  "owner_num" type str,
  "deptid"    type str,
  "deptname"  type str,
  "sumdate"   type str,
  "sumcount"  type double,
  "sumweight" type double
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "NULL";

CREATE PARSER T_CHART_DETAILSTORAGE_parser
TYPE rcd
SCHEMA T_CHART_DETAILSTORAGE_schema;

CREATE TABLE T_CHART_DETAILSTORAGE using T_CHART_DETAILSTORAGE_parser; 

CREATE INDEX T_CHART_DETAILSTORAGE_index ON TABLE T_CHART_DETAILSTORAGE (owner_num);<file_sep>/complete/JINSHANG-110/del_2.sql
create job del_2_job(2)
begin

dataset file T_ZY_RK_INBILL_dataset_22
(
	schema: T_ZY_RK_INBILL_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_rk_inbill/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select union_select
(   
	inputs: "T_ZY_RK_INBILL_dataset_22",
	fields: 
	 (
       (fname:"0",alias:"store_amount",type:"double"),
       (fname:"netweightsum",alias:"store_in_amount",type:"double"),
       (fname:"0",alias:"store_out_amount",type:"double"),
       (fname:"0",alias:"store_process_amount",type:"double")
	 ),
	distinct: true,
	data_opr:delete,
    cache:true,
	conditions:" deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
); 

  dataproc statistics T_ZY_RK_INBILL_del_statistics
(
	inputs:union_select,
	table:union_all,
	data_opr:delete
);

end;

run job del_2_job (threads:8);<file_sep>/complete/JINSHANG-75/1_schema.sql
create database db;
use db;

create schema t_common_dept_schema
source type csv
FIELDS(
 "DEPTID"                	TYPE string,
 "DEPTCD"                	TYPE string,
 "DEPTNAME"              	TYPE string,
 "DEPTLEVEL"             	TYPE double,
 "DEPTDESC"              	TYPE string,
 "DEPTORDER"             	TYPE double,
 "PARENTDEPTID"          	TYPE string,
 "LEVEL1DEPTID"          	TYPE string,
 "LEVEL1DEPTCD"          	TYPE string,
 "LEVEL1DEPTNAME"        	TYPE string,
 "LEVEL2DEPTID"          	TYPE string,
 "LEVEL2DEPTCD"          	TYPE string,
 "LEVEL2DEPTNAME"        	TYPE string,
 "LEVEL3DEPTID"          	TYPE string,
 "LEVEL3DEPTCD"          	TYPE string,
 "LEVEL3DEPTNAME"        	TYPE string,
 "LEVEL4DEPTID"          	TYPE string,
 "LEVEL4DEPTCD"          	TYPE string,
 "LEVEL4DEPTNAME"        	TYPE string,
 "R_RECORD_CREATE_DATE"  	TYPE datetime,
 "R_RECORD_CREATE_USER"  	TYPE string,
 "R_RECORD_UPDATE_DATE"  	TYPE datetime,
 "R_RECORD_UPDATE_USER"  	TYPE string,
 "R_RECORD_IS_DELETED"   	TYPE double,
 "R_RECORD_CHANGE_FLAG"  	TYPE double,
 "DEPTADDRESS"           	TYPE string,
 "DEPTTYPE"              	TYPE string default value '22',
 "DISTRINGICTID"         	TYPE string,
 "DISTRINGICTNAME"       	TYPE string,
 "BELONGAREA"            	TYPE string,
 "FIRSTDIS"              	TYPE string,
 "OPSELECTED"            	TYPE string default value '0',
 "OPUPLOAD"              	TYPE string,
 "LIMITTIME"             	TYPE datetime,
 "CONTRACTNO"            	TYPE string,
 "BAOSAAS_CUSTOMER_NAME" 	TYPE string
)
RECORD DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

create parser t_common_dept_parser
type rcd
schema t_common_dept_schema;

create table t_common_dept using t_common_dept_parser; 

create index t_common_dept_index on table t_common_dept PRIMARY KEY(DEPTID);

create map t_common_dept_map on table t_common_dept
key (DEPTID) 
value (DEPTNAME)
type string;

create schema t_gg_sj_goods_schema
source type csv
FIELDS(
 "GOODSID"              TYPE string,
 "DEPTID"               TYPE string,
 "PACKNUM"              TYPE string,
 "BARCODE"              TYPE string,
 "GOODSLOCID"           TYPE string,
 "STOCKTYPE"			type string,
 "OWNERID"              TYPE string,
 "OWNERNAME"            TYPE string,
 "GOODSOWNERMANAGENO"   TYPE string,
 "INBILLID"             TYPE string,
 "GOODSOWNERPACKNO"     TYPE string,
 "MANAGENO"             TYPE string,
 "FEEBEGINDATE"         TYPE datetime,
 "CONTRACTID"           TYPE string,
 "GOODSSTATENO"         TYPE string,
 "GOODSSTATENAME"       TYPE string,
 "CHANGEOWNERTIMES"     TYPE double default value '0',
 "GOODSTYPE"            TYPE string,
 "GOODSTYPENAME"        TYPE string,
 "KINDNO"               TYPE string,
 "KINDNAME"             TYPE string,
 "SHOPSIGNID"           TYPE string,
 "SHOPSIGNNAME"         TYPE string,
 "PRODAREAID"           TYPE string,
 "PRODAREANAME"         TYPE string,
 "GOODSBATCHNO"         TYPE string,
 "PRODSTOVENO"          TYPE string,	
 "GRADENUM"             TYPE string,
 "GRADENUMTHICK"        TYPE double,
 "GRADENUMWIDTH"        TYPE double,
 "GRADENUMLENGTH"       TYPE double,
 "GROSSWEIGHT"          TYPE double,
 "NETWEIGHT"            TYPE double,
 "POUNDWEIGHT"          TYPE double,
 "CHECKWEIGHT"          TYPE double,
 "SHEETNUM"             TYPE double default value '1',
 "UNIT"                 TYPE string,
 "PACKTYPE"             TYPE string,
 "STOCKAREAID"          TYPE string,
 "QUALITYMEMO"          TYPE string,
 "FIRSTINOWNERID"       TYPE string,
 "FIRSTINDATE"          TYPE datetime,
 "OUTBILLID"            TYPE string,
 "LDGLISTID"            TYPE string,
 "MATERIALGOODSID"      TYPE string,
 "INTYPE"  				type string,
 "OUTTYPE"              TYPE string,
 "BILLSTATE"            TYPE double,
 "OUTBILLTIME"          TYPE datetime,
 "MEMO"                 TYPE string,
 "EXTSYSPLANOBJECTID"   TYPE string,
 "EXTSYSKINDID"         TYPE string,
 "EXTSYSSHOPSIGNID"     TYPE string,
 "EXTSYSPRODAREAID"     TYPE string,
 "FOREIGNLISTNO"        TYPE string,
 "SENDFLAG"             TYPE double,
 "R_RECORD_CREATE_DATE" TYPE datetime,
 "R_RECORD_CREATE_USER" TYPE string,
 "R_RECORD_UPDATE_DATE" TYPE datetime,
 "R_RECORD_UPDATE_USER" TYPE string,
 "R_RECORD_IS_DELETED"  TYPE double,
 "INCUSTTIME"           TYPE datetime,
 "SIDEMARK"             TYPE string,
 "TEMP"                 TYPE string,
 "LENGTH_PRODUCT_MAX"   TYPE double,
 "HEAT_NUM"             TYPE string,
 "TEST_LOT_NUM"         TYPE string,
 "R_RECORD_CHANGE_FLAG" TYPE double,
 "SDPRICE"              TYPE string,
 "EXTSYSGRADENUM"       TYPE string,
 "COLLECTIONMANNAME"    TYPE string,
 "LOCKFLAG"             TYPE string,
 "CHECK_TYPE"           TYPE string,
 "OUTDATE"              TYPE datetime,
 "YFWEIGHT"             TYPE double,
 "YFSHEET"              TYPE double,
 "PREGOODSID"           TYPE string,
 "ISSPLIT"              TYPE double,
 "GRADENUMXH"           TYPE double,
 "GRADENUMWHDW"         TYPE string,
 "SPLITTIME"            TYPE double,
 "ISCLEAR"              TYPE double,
 "SINGLESHEETNUM"       TYPE double,
 "GRADENUMHZ"           TYPE string,
 "GRADENUMTHICKHZ"      TYPE double,
 "SINGLESHEET"          TYPE double,
 "LOCLV1"               TYPE string,
 "SINGLESHEETUNIT"      TYPE string,
 "DCEMP"                TYPE string,
 "QZEMP"                TYPE string,
 "DCEMP2"               TYPE string,
 "SHIPNO"               TYPE string,
 "SHIPNAME"             TYPE string,
 "SHIPCD"               TYPE string,
 "SHIPLEVEL"            TYPE string,
 "CMMEMO"               TYPE string,
 "CMMEMOCK"             TYPE string,
 "SHOPSIGNCD"           TYPE string,
 "PROCESSTYPENAME"      TYPE string,
 "PACKTYPENAME"         TYPE string,
 "SORT_EMP"             TYPE string,
 "CUSTOMERID"           TYPE string,
 "LVGOODSID"            TYPE string,
 "DISPERSESHEET"        TYPE double,
 "DBDEPTID"             TYPE string,
 "DBCUSTOMER"           TYPE string,
 "DBGULENDER"           TYPE string,
 "LOCKED_OBJECT"        TYPE string,
 "LOCKED_DATE"          TYPE datetime,
 "UNLOCKED_DATE"        TYPE datetime,
 "PREOWNERNAME"         TYPE string,
 "PLY"                  TYPE double default value '0',
 "TDSTATE"              type string default value '1',
 "OPSELECTED"           TYPE string,
 "OPLOCK"               TYPE string,
 "OPINUPLOAD"           TYPE string,
 "OPCHANGEUPLOAD"       TYPE string,
 "OPINBATCHID"          TYPE string,
 "OPCHANGEBATCHID"      TYPE string,
 "OPINUPLOAD_DATE"      TYPE datetime,
 "OUT_PACKAGE_STATUS"   TYPE string,
 "OUT_PACKAGE_DESC"     TYPE string,
 "GMPACKTYPE"           TYPE string,
 "HANDNO"               TYPE string,
 "SAVENO"               TYPE string,
 "DRAWNO"               TYPE string,
 "DANGEROUSLEVEL"       TYPE string,
 "ACCEPTANCECRITERIA"   TYPE string,
 "SHIPPINGMARK"         TYPE string,
 "LOCLV2"               TYPE string,
 "PAYEDFLAG"            TYPE string,
 "ORDERGOODSOWNERID"    TYPE string,
 "ORDERGOODSOWNERNAME"  TYPE string,
 "VF_DEPTNAME" type `expr` data type string value iilmap("t_common_dept_map",DEPTID)
 )
RECORD DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

create parser t_gg_sj_goods_parser
type rcd
schema t_gg_sj_goods_schema;

create table t_gg_sj_goods using t_gg_sj_goods_parser; 

create index t_gg_sj_goods_index on table t_gg_sj_goods PRIMARY KEY(GOODSID);
<file_sep>/uncomplete/JINSHANG-98/jinshang-98.sql

SELECT t.DEPTID,
       t.PLANENDDATE,
       t.OUTCARBILLTIME,
       t.PROCESSTYPENAME,
       t.PROCESSID,
       t.PROCESSDEPT,
       t.PROCESSDEPTNAME,
       t.PROCESSCUSTOMNO,
       t.PROCESSCUSTOMNAME,
       t.PROCESSMOLDNAME,
       t.SETTLEDEPTNO,
       t.SETTLEDEPTNAME,
       t.M_MANAGENO,
       t.M_GRADENUM,
       t.M_NETWEIGHT,
       t.NETWEIGHT,
       t.A_GRADENUM,
       t.A_GRADENUM2,
       t.A_SHOPSIGNNAME,
       t.s_COUNTUNIT,
       t.s_SETTLENUM,
       t.s_SETTLESUM,
       t.s_INVOICEKINDID,
       t.s_INVOICEKINDNAME,
       t.FACTSUM,
       t.LASTSUM,
       t.PACKTYPENAME,
       t.settle_date,
       t.customerid,
       t.FEETYPE,
       t.FEETYPENAME,
       t.JSMEMO ,
       t.PRODAREANAME,
       t.chanxian,
       t.Goodslocid
FROM
  (SELECT a.DEPTID,
          a.PROCESSID,
          a.PROCESSDEPT,
          a.PROCESSDEPTNAME,
          a.PROCESSCUSTOMNO,
          a.PROCESSCUSTOMNAME,
          a.SETTLEDEPTNO,
          a.SETTLEDEPTNAME,
          a.PROCESSTYPENAME,
          a.PROCESSMOLDNAME,
          a.PLANENDDATE,
          a.OUTCARBILLTIME,
          a.PREWEIGHTSUM,
          a.M_MANAGENO,
          a.M_GRADENUM,
          a.PACKNUM_NUM,
          a.NETWEIGHT,
          a.M_NETWEIGHT,
          a.A_GRADENUM,
          a.A_GRADENUM2,
          a.A_SHOPSIGNNAME,
          b.s_SETTLENUM,
          b.s_SETTLESUM,
          b.s_COUNTUNIT,
          b.s_INVOICEKINDID,
          b.s_INVOICEKINDNAME,
          b.factsum,
          b.s_SETTLESUM-b.factsum Lastsum,
          a.packtypename,
          a.CUSTOMERID,
          b.CREATDATE settle_date,
          b.FEETYPE,
          b.FEETYPENAME,
          b.JSMEMO,
          a.PRODAREANAME,
          a.chanxian,
          a.Goodslocid
   FROM
     (SELECT P.DEPTID,
             P.PROCESSID,
             P.PROCESSDEPT,
             P.PROCESSDEPTNAME,
             P.PROCESSCUSTOMNO,
             P.PROCESSCUSTOMNAME,
             P.SETTLEDEPTNO,
             P.SETTLEDEPTNAME,
             P.PROCESSTYPENAME,
             P.PROCESSMOLDNAME,
             P.PLANENDDATE,
             p.preweightsum,
             p.packtypename,
             p.customerid,

        (SELECT MAX(JM.MANAGENO)
         FROM wmsdba.T_ZY_JG_PROCMATERIALDTL JM
         WHERE JM.DEPTID = P.DEPTID
           AND JM.PROCESSID = P.PROCESSID) AS M_MANAGENO,
             --原料采购资源号


        (SELECT MAX(JM.GRADENUM) AS GRADENUM
         FROM wmsdba.T_ZY_JG_PROCMATERIALDTL JM
         WHERE JM.DEPTID = P.DEPTID
           AND JM.PROCESSID = P.PROCESSID) AS M_GRADENUM,
             --原料规格

             COUNT(JA.PACKNUM) AS PACKNUM_NUM,
             --成品数量

             sum(JA.NETWEIGHT) AS NETWEIGHT,
             --成品重量


        (SELECT SUM(JM.NETWEIGHT) AS NETWEIGHT
         FROM wmsdba.T_ZY_JG_PROCMATERIALDTL JM
         WHERE JM.DEPTID = P.DEPTID
           AND JM.PROCESSID = P.PROCESSID) AS M_NETWEIGHT,
             --原料重量


        (SELECT JM.GRADENUM
         FROM wmsdba.T_ZY_JG_PROCARTICLEDTL JM
         WHERE JM.DEPTID = P.DEPTID
           AND JM.PROCESSID = P.PROCESSID
           AND rownum=1) AS A_GRADENUM,

        (SELECT JM.GRADENUM
         FROM wmsdba.T_ZY_JG_PROCARTICLEDTL JM
         WHERE JM.DEPTID = P.DEPTID
           AND JM.PROCESSID = P.PROCESSID
           AND rownum=1
           AND jm.goodstypename='加工成品') AS A_GRADENUM2,
             min(JA.SHOPSIGNNAME) AS A_SHOPSIGNNAME,
             --成品牌号

             max(JA.FIRSTINDATE) AS OUTCARBILLTIME,
             --成品验收日期

             max(JA.PRODAREANAME) AS PRODAREANAME,
             --产地

             max(P.Chanxian) AS Chanxian,
             --产线

             max(JA.Goodslocid) AS Goodslocid--库位
FROM wmsdba.T_ZY_JG_PROCESS P,
     wmsdba.T_ZY_JG_PROCARTICLEDTL JA
      WHERE P.DEPTID = JA.DEPTID
        AND P.PROCESSID = JA.PROCESSID
        AND P.Processstate=1
        AND JA.GOODSTYPENAME!='加工余料'
      GROUP BY P.DEPTID,
               P.PROCESSID,
               P.PROCESSDEPT,
               P.PROCESSDEPTNAME,
               P.PROCESSCUSTOMNO,
               P.PROCESSCUSTOMNAME,
               P.SETTLEDEPTNO,
               P.SETTLEDEPTNAME,
               P.PROCESSTYPENAME,
               P.PROCESSMOLDNAME,
               P.PLANENDDATE,
               p.preweightsum,
               p.customerid,
               p.packtypename) A,
     (SELECT T.DEPTID,
             T.BUSINESSNO,
             SUM(T.SETTLENUM) AS s_SETTLENUM,
             SUM(T.SETTLESUM) AS s_SETTLESUM,
             MAX(T.COUNTUNIT) AS s_COUNTUNIT,
             T.INVOICEKINDID AS s_INVOICEKINDID,
             T.INVOICEKINDNAME AS s_INVOICEKINDNAME,
             mst.Factsum,
             mst.CREATDATE,
             t.FEETYPE,
             t.FEETYPENAME,
             MAX(T.MEMO) JSMEMO
      FROM WMSDBA.T_ZY_JS_SETTLEMENT MST,
           WMSDBA.T_ZY_JS_SETTLEMENTDETAIL T
      WHERE T.DEPTID=MST.Deptid
        AND T.Settlecd=MST.Settlecd
      GROUP BY T.DEPTID,
               T.BUSINESSNO,
               T.INVOICEKINDID,
               T.INVOICEKINDNAME,
               mst.Factsum,
               T.Settlecd,
               mst.CREATDATE,
               t.feetype,
               t.feetypename) B
   WHERE A.DEPTID = B.DEPTID
     AND A.PROCESSID = B.BUSINESSNO) t
WHERE t.DEPTID=:dp
  AND t.processdept='KH03632'
  AND settle_date>=to_date('2015/7/3','yyyy-mm-dd')
  AND settle_date<to_date('2015/8/4','yyyy-mm-dd')
  AND OUTCARBILLTIME>=to_date('2015/7/3','yyyy-mm-dd')
  AND OUTCARBILLTIME<to_date('2015/8/4','yyyy-mm-dd')
  AND FeeType = '001002'
ORDER BY t.PLANENDDATE ;

<file_sep>/schema/T_ZY_JG_PROCESS.sql
create schema T_ZY_JG_PROCESS_schema
SOURCE TYPE CSV
FIELDS(
"processid" type str,
"deptid" type str,
"customerid" type str,
"processdept" type str,
"processdeptname" type str,
"processtype" type str,
"processtypename" type str,
"processmold" type str,
"processmoldname" type str,
"processstate" type double,
"planenddate" type datetime,
"kindno" type str,
"kindname" type str,
"packtype" type str,
"packtypename" type str,
"woodtype" type str,
"woodtypename" type str,
"straptype" type str,
"straptypename" type str,
"processprecision" type str,
"orderinfo" type str,
"fee" type double,
"length" type double,
"weigtht" type double,
"sheet" type double,
"piecenum" type double,
"outcarbilltime" type datetime,
"outcarbillempno" type str,
"outcarbillempname" type str,
"planno" type str,
"preweightsum" type double,
"meno" type str,
"gradenumrange" type str,
"gradenumrangename" type str,
"thickrange" type str,
"thickrangename" type str,
"r_record_create_date" type datetime,
"r_record_create_user" type str,
"r_record_update_date" type datetime,
"r_record_update_user" type str,
"r_record_is_deleted" type double,
"r_record_change_flag" type double,
"density" type double,
"processcustomno" type str,
"processcustomname" type str,
"settledeptno" type str,
"settledeptname" type str,
"settle_staus" type str,
"settle_staus_name" type str,
"settle_no" type str,
"settle_date" type datetime,
"acceptancer" type str,
"acceptance_time" type datetime,
"chanxian" type str,
"mddeptname" type str,
"articleys" type str,
"materialgradenum" type str,
"materialshopsign" type str,
"cbxjgtype" type str,
"jgmessage" type str,
"jgstatus" type str,
"articlefee" type str,
"issettled" type double,
"specialdown" type str,
"articlesheet" type double,
"articleweight" type double,
"username" type str,
"jfsendflag" type double,
"isreceived" type str,
"specialmemo" type str,
"toprocessid" type str,
"jxlocked" type str
)
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_JG_PROCESS_parser
TYPE rcd
SCHEMA T_ZY_JG_PROCESS_schema;

CREATE TABLE T_ZY_JG_PROCESS using T_ZY_JG_PROCESS_parser; 

create index T_ZY_JG_PROCESS_index on table T_ZY_JG_PROCESS(processid);<file_sep>/uncomplete/JINSHANG-95/jinshang-95.sql
JINSHANG-95

SELECT rptdate,
       Sum(nt)        nt,
       Sum(injs)      injs,
       Sum(OUTWEIGHT) OUTWEIGHT,
       Sum(outjs)     outjs
FROM   (SELECT To_char(FirstInDate, 'yyyy-mm-dd') AS rptdate,
               Sum(netweight)                     AS nt,
               Count(*)                           AS injs,
               0                                  OUTWEIGHT,
               0                                  outjs
        FROM   T_ZY_RK_InBillDetail
        WHERE  ( goodsstateno = '20' )
               AND ( DeptID = '0301' )
               AND ( FirstInDate >= To_date('2015/7/1', 'yyyy-mm-dd') )
               AND ( FirstInDate < To_date('2015/9/1', 'yyyy-mm-dd') )
               AND ownerid = 'KH00001'
               AND ( 1 = 2
                      OR MANAGENO LIKE 'M%')
        GROUP  BY To_char(FirstInDate, 'yyyy-mm-dd')
        UNION ALL
        SELECT To_char(b.changedate, 'yyyy-mm-dd') AS rptdate,
               Sum(netweight)                      AS nt,
               Count(*)                            AS injs,
               0                                   OUTWEIGHT,
               0                                   outjs
        FROM   T_ZY_GH_ChangeOwnerDetail a,
               T_ZY_GH_ChangeOwnerlist b
        WHERE  a.deptid = b.deptid
               AND a.changeownerno = b.changeownerid
               AND a.DeptID = '0301'
               AND newownerno = 'KH00001'
               AND ( 1 = 2
                      OR a.premanagenum LIKE 'M%' )
               AND changedate >= To_date('2015/7/1', 'yyyy-mm-dd')
               AND changedate < To_date('2015/9/1', 'yyyy-mm-dd')
        GROUP  BY To_char(b.changedate, 'yyyy-mm-dd')
        UNION ALL
        SELECT To_char(bill_date, 'yyyy-mm-dd') AS rptdate,
               0                                nt,
               0                                injs,
               Sum(unit_weight)                 AS OUTWEIGHT,
               Count(*)                         AS outjs
        FROM   (SELECT a.bill_num,
                       a.bill_date,
                       pack_id     pack_num,
                       plan_weight unit_weight
                FROM   (SELECT *
                        FROM   T_GG_TX_DL_BIL_M
                        WHERE  ( DeptID = '0301' )
                               AND ( OWNER_NUM = 'GM0' )
                               AND ( BILL_DATE >= To_date('2015/7/1', 'yyyy-mm-dd') )
                               AND ( BILL_DATE < To_date('2015/9/1', 'yyyy-mm-dd') )
                               AND billstate >= '20'
                               AND ( 1 = 2
                                      OR resource_num LIKE 'M%' )) a
                       LEFT JOIN wl.t_s_bill_d b
                              ON a.seg_no = b.seg_no
                                 AND a.resource_num = b.factory_product_id
                                 AND a.BILL_NUM = b.BILL_ID) t3
        GROUP  BY To_char(bill_date, 'yyyy-mm-dd'))
GROUP  BY rptdate;


1.里层条件不能永远都写死，必须传到外层给我们JQL输入的where条件做过滤。
<file_sep>/complete/JINSHANG-110/add_3.sql
create job add_3_job(2)
begin

dataset file T_ZY_CK_OUTBILL_dataset_11
(
	schema: T_ZY_CK_OUTBILL_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_ck_outbill/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select union_select
(   
	inputs: "T_ZY_CK_OUTBILL_dataset_11",
	fields: 
	 (
       (fname:"0",alias:"store_amount",type:"double"),
       (fname:"0",alias:"store_in_amount",type:"double"),
       (fname:"netweightsum",alias:"store_out_amount",type:"double"),
       (fname:"0",alias:"store_process_amount",type:"double")
	 ),
	distinct: true,
	cache:true,
	conditions:" deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
); 

  dataproc statistics T_ZY_CK_OUTBILL_add_statistics
(
	inputs:union_select,
	table:union_all
);

end;

run job add_3_job (threads:8);<file_sep>/uncomplete/JINSHANG-93/T_HIS_T_STACKING_D.sql
CREATE SCHEMA T_HIS_T_STACKING_D_schema
SOURCE TYPE CSV
FIELDS(
  "manu_id"                                                type str,
  "stacking_rec_num"                                       type str,
  "pick_num"                                               type str,
  "pack_num"                                               type str,
  "weight_active"                                          type double,
  "weight_theo"                                            type double,
  "n_pack"                                                 type double,
  "time_receive"                                           type datetime,
  "time_proc"                                              type datetime,
  "proc_mark"                                              type str,
  "error_text1"                                            type str,
  "error_text2"                                            type str,
  "ws_flag"                                                type str default value '0',
  "ws_datat"                                               type datetime,
  "seg_no"                                                 type str,
  "downloadflag"                                           type str default value '0',
  "length_product"                                         type double,
  "length_product_max"                                     type double,
  "length_product_min"                                     type double,
  "optflag"                                                type str,
  "heat_num"                                               type str,
  "test_lot_num"                                           type str,
  "order_num"                                              type str,
  "spec1"                                                  type str,
  "spec3"                                                  type str,
  "spec5"                                                  type str,
  "ppflag"                                                 type str default value '0',
  "scan_flag"                                              type str default value '0'
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_HIS_T_STACKING_D_parser
TYPE rcd
SCHEMA T_HIS_T_STACKING_D_schema;

CREATE TABLE T_HIS_T_STACKING_D using T_HIS_T_STACKING_D_parser;

CREATE INDEX T_HIS_T_STACKING_D_index ON TABLE T_HIS_T_STACKING_D (manu_id); <file_sep>/complete/JINSHANG-102/job7.sql
create job 7_job(8)
begin

dataset file T_ZY_JG_PROCMATERIALDTL_dataset
(
	schema: T_ZY_JG_PROCMATERIALDTL_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_JG_PROCMATERIALDTL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCMATERIALDTL_syncher
(
    inputs: T_ZY_JG_PROCMATERIALDTL_dataset,
    database:db,
    operation:add, 
    table:T_ZY_JG_PROCMATERIALDTL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_JG_PROCMATERIALDTL_dataset,
		serviceid: idx_job)
	)
);
end;

run job 7_job (threads:8);
<file_sep>/complete/JINSHANG-82/jinshang-82.sql
SELECT count(DISTINCT deptid)
FROM t_zy_jg_process;


SELECT count(DISTINCT t.destination_mobile)
FROM xt.t_ss_sms_send_log t;


SELECT count(DISTINCT t.kindname)
FROM t_gg_sj_producttype t;


SELECT count(DISTINCT t.ownername)
FROM t_gg_sj_customer t;

<file_sep>/uncomplete/JINSHANG-103/jinshang-103.sql
SELECT sum(netweight),
       sum(sheetnum),
       sum(kdwt),
       sum(zrrk),
       sum(jrrk),
       sum(zrck),
       sum(jrck),
       sum(byrk),
       sum(byck),
       sum(warn)
FROM
  ( SELECT sum(netweight) netweight,
           sum(sheetnum) sheetnum,
           0 kdwt,
             0 zrrk,
               0 jrrk,
                 0 zrck,
                   0 jrck,
                     0 byrk,
                       0 byck,
                         0 warn
   FROM wmsdba.t_gg_sj_goods t
   WHERE goodsstateno=20
     AND deptid='0106'
     AND exists
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.ownerid=w.owner_id)
   UNION ALL SELECT 0,
                    0,
                    sum(netweight),
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0 warn
   FROM wmsdba.t_gg_sj_goods t
   WHERE goodsstateno=20
     AND deptid='0106'
     AND exists
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.ownerid=w.owner_id)
     AND exists
       (SELECT 1
        FROM wl.t_s_bill_d d
        WHERE t.packnum=d.pack_id
          AND d.seg_no='00103')
   UNION ALL SELECT 0,
                    0,
                    0,
                    sum(netweightsum),
                    0,
                    0,
                    0,
                    0,
                    0,
                    0
   FROM wmsdba.t_zy_rk_inbill t
   WHERE deptid='0106'
     AND r_record_create_date>=to_date(to_char(sysdate-1,'yyyy-mm-dd'),'yyyy-mm-dd')
     AND r_record_create_date<to_date (to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
     AND EXISTS
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.inbillownerno=w.owner_id)
   UNION ALL SELECT 0,
                    0,
                    0,
                    0,
                    sum(netweightsum),
                    0,
                    0,
                    0,
                    0,
                    0
   FROM wmsdba.t_zy_rk_inbill t
   WHERE deptid='0106'
     AND r_record_create_date>=to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
     AND EXISTS
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.inbillownerno=w.owner_id)
   UNION ALL SELECT 0,
                    0,
                    0,
                    0,
                    0,
                    sum(netweightsum),
                    0,
                    0,
                    0,
                    0
   FROM wmsdba.t_zy_ck_outbill t
   WHERE deptid='0106'
     AND r_record_create_date>=to_date(to_char(sysdate-1,'yyyy-mm-dd'),'yyyy-mm-dd')
     AND r_record_create_date<to_date (to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
     AND EXISTS
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.OUTBILLOWNERNO=w.owner_id)
   UNION ALL SELECT 0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    sum(netweightsum),
                    0,
                    0,
                    0
   FROM wmsdba.t_zy_ck_outbill t
   WHERE deptid='0106'
     AND r_record_create_date>=to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
     AND EXISTS
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.OUTBILLOWNERNO=w.owner_id)
   UNION ALL SELECT 0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    sum(netweightsum),
                    0,
                    0
   FROM wmsdba.t_zy_rk_inbill t
   WHERE deptid='0106'
     AND r_record_create_date>=to_date(to_char(sysdate,'yyyy-mm'),'yyyy-mm')
     AND EXISTS
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.inbillownerno=w.owner_id)
   UNION ALL SELECT 0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    sum(netweightsum),
                    0
   FROM wmsdba.t_zy_ck_outbill t
   WHERE deptid='0106'
     AND r_record_create_date>=to_date(to_char(sysdate,'yyyy-mm'),'yyyy-mm')
     AND EXISTS
       (SELECT 1
        FROM WL.T_OWNER W
        WHERE SEG_NO='00103'
          AND T.DEPTID=W.DEPTID
          AND t.OUTBILLOWNERNO=w.owner_id)
   UNION ALL SELECT 0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    storelimit
   FROM wmsdba.t_wl_store t
   WHERE DEPT_ID='0106');

<file_sep>/schema/T_GG_SJ_GOODS.sql
create schema T_GG_SJ_GOODS_schema
source type CSV
fields(
 "goodsid"              type str,
 "deptid"               type str,
 "packnum"              type str,
 "barcode"              type str,
 "goodslocid"           type str,
 "stocktype"            type str,
 "ownerid"              type str,
 "ownername"            type str,
 "goodsownermanageno"   type str,
 "inbillid"             type str,
 "goodsownerpackno"     type str,
 "manageno"             type str,
 "feebegindate"         type DATETIME,
 "contractid"           type str,
 "goodsstateno"         type str,
 "goodsstatename"       type str,
 "changeownertimes"     type double default value '0',
 "goodstype"            type str,
 "goodstypename"        type str,
 "kindno"               type str,
 "kindname"             type str,
 "shopsignid"           type str,
 "shopsignname"         type str,
 "prodareaid"           type str,
 "prodareaname"         type str,
 "goodsbatchno"         type str,
 "prodstoveno"          type str,
 "gradenum"             type str,
 "gradenumthick"        type double,
 "gradenumwidth"        type double,
 "gradenumlength"       type double,
 "grossweight"          type double,
 "netweight"            type double,
 "poundweight"          type double,
 "checkweight"          type double,
 "sheetnum"             type double default value '1',
 "unit"                 type str,
 "packtype"             type str,
 "stockareaid"          type str,
 "qualitymemo"          type str,
 "firstinownerid"       type str,
 "firstindate"          type DATETIME,
 "outbillid"            type str,
 "ldglistid"            type str,
 "materialgoodsid"      type str,
 "intype"               type str,
 "outtype"              type str,
 "billstate"            type double,
 "outbilltime"          type DATETIME,
 "memo"                 type str,
 "extsysplanobjectid"   type str,
 "extsyskindid"         type str,
 "extsysshopsignid"     type str,
 "extsysprodareaid"     type str,
 "foreignlistno"        type str,
 "sendflag"             type double,
 "r_record_create_date" type DATETIME,
 "r_record_create_user" type str,
 "r_record_update_date" type DATETIME,
 "r_record_update_user" type str,
 "r_record_is_deleted"  type double,
 "incusttime"           type DATETIME,
 "sidemark"             type str,
 "temp"                 type str,
 "length_product_max"   type double,
 "heat_num"             type str,
 "test_lot_num"         type str,
 "r_record_change_flag" type double,
 "sdprice"              type str,
 "extsysgradenum"       type str,
 "collectionmanname"    type str,
 "lockflag"             type str,
 "check_type"           type str,
 "outdate"              type DATETIME,
 "yfweight"             type double,
 "yfsheet"              type double,
 "pregoodsid"           type str,
 "issplit"              type double,
 "gradenumxh"           type double,
 "gradenumwhdw"         type str,
 "splittime"            type double,
 "isclear"              type double,
 "singlesheetnum"       type double,
 "gradenumhz"           type str,
 "gradenumthickhz"      type double,
 "singlesheet"          type double,
 "loclv1"               type str,
 "singlesheetunit"      type str,
 "dcemp"                type str,
 "qzemp"                type str,
 "dcemp2"               type str,
 "shipno"               type str,
 "shipname"             type str,
 "shipcd"               type str,
 "shiplevel"            type str,
 "cmmemo"               type str,
 "cmmemock"             type str,
 "shopsigncd"           type str,
 "processtypename"      type str,
 "packtypename"         type str,
 "sort_emp"             type str,
 "customerid"           type str,
 "lvgoodsid"            type str,
 "dispersesheet"        type double,
 "dbdeptid"             type str,
 "dbcustomer"           type str,
 "dbgulender"           type str,
 "locked_object"        type str,
 "locked_date"          type DATETIME,
 "unlocked_date"        type DATETIME,
 "preownername"         type str,
 "ply"                  type double default value '0',
 "tdstate"              type str default value '1',
 "opselected"           type str,
 "oplock"               type str,
 "opinupload"           type str,
 "opchangeupload"       type str,
 "opinbatchid"          type str,
 "opchangebatchid"      type str,
 "opinupload_date"      type DATETIME,
 "out_package_status"   type str,
 "out_package_desc"     type str,
 "gmpacktype"           type str,
 "handno"               type str,
 "saveno"               type str,
 "drawno"               type str,
 "dangerouslevel"       type str,
 "acceptancecriteria"   type str,
 "shippingmark"         type str,
 "loclv2"               type str,
 "payedflag"            type str,
 "ordergoodsownerid"    type str,
 "ordergoodsownername"  type str
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "NULL";

CREATE PARSER T_GG_SJ_GOODS_parser
TYPE rcd
SCHEMA T_GG_SJ_GOODS_schema;

CREATE TABLE T_GG_SJ_GOODS using T_GG_SJ_GOODS_parser; 

CREATE INDEX T_GG_SJ_GOODS_index ON TABLE T_GG_SJ_GOODS (goodsid);<file_sep>/uncomplete/JINSHANG-93/T_HIS_T_STACKING_M.sql
CREATE SCHEMA T_HIS_T_STACKING_M_schema
SOURCE TYPE CSV
FIELDS(
"manu_id"                                                  type str,
"stacking_rec_num"                                         type str,
"pick_num"                                                 type str,
"order_num"                                                type str,
"company_code"                                             type str,
"ready_num"                                                type str,
"trnp_mode_code"                                           type str,
"carry_company_code"                                       type str,
"carry_company_name"                                       type str,
"n_stacking_rec"                                           type double,
"weight_strc"                                              type double,
"product_dscr"                                             type str,
"shopsign"                                                 type str,
"domestic_export"                                          type str,
"storehouse_code"                                          type str,
"lade_code"                                                type str,
"dlv_spot_code"                                            type str,
"private_route_code"                                       type str,
"dlv_spot_name"                                            type str,
"consignee_num"                                            type str,
"consignee_name"                                           type str,
"settle_user_num"                                          type str,
"settle_user_name"                                         type str,
"qlt_decide_code"                                          type str,
"vehicle_code"                                             type str,
"n_grass_pack"                                             type double,
"delivery_date_chr"                                        type str,
"t_delivery"                                               type str,
"dept"                                                     type str,
"user_id"                                                  type str,
"operator_name"                                            type str,
"product_code_fb1"                                         type str,
"product_code_fb2"                                         type str,
"product_code_fb3"                                         type str,
"expense_status"                                           type str,
"weight_theo"                                              type double,
"weight_type"                                              type str,
"stacking_type"                                            type str,
"code_all_thr_ready"                                       type str,
"stin_sths_code"                                           type str,
"time_receive"                                             type datetime,
"time_proc"                                                type datetime,
"proc_mark"                                                type str,
"error_text1"                                              type str,
"error_text2"                                              type str,
"stacking_print_batch_id"                                  type str,
"ws_flag"                                                  type str default value '0',
"ws_date"                                                  type datetime,
"seg_no"                                                   type str,
"proc_mark_seg"                                            type str,
"product_id"                                               type str,
"wprovider_id"                                             type str,
"insert_time"                                              type datetime,
"downloadflag"                                             type str default value '0',
"optflag"                                                  type str default value '0',
"product_adress"                                           type str,
"shopsgin"                                                 type str,
"owner_num"                                                type str,
"deptid"                                                   type str,
"trans_commission_subid"                                   type str,
"pay_style"                                                type str,
"getflag"                                                  type str,
"settle_flag"                                              type str,
"source_seg_no"                                            type str,
"operation_type"                                           type str,
"r_jk_update_date"                                         type datetime
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_HIS_T_STACKING_M_parser
TYPE rcd
SCHEMA T_HIS_T_STACKING_M_schema;

CREATE TABLE T_HIS_T_STACKING_M using T_HIS_T_STACKING_M_parser;

CREATE INDEX T_HIS_T_STACKING_M_index ON TABLE T_HIS_T_STACKING_M (manu_id); 
<file_sep>/uncomplete/JINSHANG-74/2_init.sql

create job 1_job(6)
begin
dataset file T_ZY_CK_OUTBILL_1_dataset
(
	schema: "T_ZY_CK_OUTBILL_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_CK_OUTBILL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc index T_ZY_CK_OUTBILL_index
(
 inputs:T_ZY_CK_OUTBILL_1_dataset,
 table:T_ZY_CK_OUTBILL
 );
 
dataproc doc T_ZY_CK_OUTBILL_doc
(  
   inputs:T_ZY_CK_OUTBILL_1_dataset,
   table:T_ZY_CK_OUTBILL
);

   dataproc map T_ZY_CK_CLEAR_1_map
(  
   inputs:T_ZY_CK_OUTBILL_1_dataset,
   table:T_ZY_CK_OUTBILL
);
end;
run job 1_job (threads:8);


create job 2_job(2)
begin
dataset file T_ZY_GH_CHANGEOWNERLIST_1_dataset
(
	schema: "T_ZY_GH_CHANGEOWNERLIST_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_GH_CHANGEOWNERLIST.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc index T_ZY_GH_CHANGEOWNERLIST_index
(
 inputs:T_ZY_GH_CHANGEOWNERLIST_1_dataset,
 table:T_ZY_GH_CHANGEOWNERLIST
 );
 
dataproc doc T_ZY_GH_CHANGEOWNERLIST_doc
(  
   inputs:T_ZY_GH_CHANGEOWNERLIST_1_dataset,
   table:T_ZY_GH_CHANGEOWNERLIST
);

   dataproc map T_ZY_GH_CHANGEOWNERLIST_1_map
(  
   inputs:T_ZY_GH_CHANGEOWNERLIST_1_dataset,
   table:T_ZY_GH_CHANGEOWNERLIST
);
end;
run job 2_job (threads:8);

create job 3_job(3)
begin
dataset file T_ZY_JG_PROCESS_1_dataset
(
	schema: "T_ZY_JG_PROCESS_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCESS.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc index T_ZY_JG_PROCESS_index
(
 inputs:T_ZY_JG_PROCESS_1_dataset,
 table:T_ZY_JG_PROCESS
 );
 
dataproc doc T_ZY_JG_PROCESS_doc
(  
   inputs:T_ZY_JG_PROCESS_1_dataset,
   table:T_ZY_JG_PROCESS
);

   dataproc map T_ZY_JG_PROCESS_1_map
(  
   inputs:T_ZY_JG_PROCESS_1_dataset,
   table:T_ZY_JG_PROCESS
);
end;
run job 3_job (threads:8);

create job 4_job(4)
begin
dataset file T_XTSZ_BIND_1_dataset
(
	schema: "T_XTSZ_BIND_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_XTSZ_BIND.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc index T_XTSZ_BIND_index
(
 inputs:T_XTSZ_BIND_1_dataset,
 table:T_XTSZ_BIND
 );
 
dataproc doc T_XTSZ_BIND_doc
(  
   inputs:T_XTSZ_BIND_1_dataset,
   table:T_XTSZ_BIND
);

   dataproc map T_XTSZ_BIND_1_map
(  
   inputs:T_XTSZ_BIND_1_dataset,
   table:T_XTSZ_BIND
);
end;
run job 4_job (threads:8);



create job 5_job(3)
begin
dataset file T_XTSZ_BIND_dataset
(
	schema: "T_XTSZ_BIND_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_XTSZ_BIND.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_GG_SJ_GOODS_dataset
(
	schema: "T_GG_SJ_GOODS_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_GG_SJ_GOODS.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_RK_INBILLDETAIL_dataset
(
	schema: T_ZY_RK_INBILLDETAIL_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_RK_INBILLDETAIL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_JG_PROCARTICLEDTL_dataset
(
	schema: T_ZY_JG_PROCARTICLEDTL_schema,
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCARTICLEDTL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_GH_CHANGEOWNERLIST_dataset
(
	schema: T_ZY_GH_CHANGEOWNERLIST_schema,
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_GH_CHANGEOWNERLIST.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_GH_CHANGEOWNERDETAIL_dataset
(
	schema: T_ZY_GH_CHANGEOWNERDETAIL_schema,
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_GH_CHANGEOWNERDETAIL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_CK_OUTPACK_dataset
(
	schema: T_ZY_CK_OUTPACK_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_CK_OUTPACK.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_JG_PROCMATERIALDTL_dataset
(
	schema: T_ZY_JG_PROCMATERIALDTL_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCMATERIALDTL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_CK_OUTBILL_dataset
(
	schema: T_ZY_CK_OUTBILL_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_CK_OUTBILL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_JG_PROCESS_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCESS.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select T_GG_SJ_GOODS_select 
(
	fields:
	(
		(fname:"MANAGENO"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_GG_SJ_GOODS_dataset",
	order_by:("DEPTID"),
	conditions:"GOODSSTATENO = '110'
	and DEPT_ID = '1' "
);

dataproc select T_ZY_RK_INBILLDETAIL_select 
(
	fields:
	(
		(fname:"MANAGENO"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_RK_INBILLDETAIL_dataset",
	order_by:("DEPTID"),
	conditions:"TO_CHAR (FIRSTINDATE, '%Y-%m-%d') > '2012-07-16'
	and DEPT_ID = '1'"
);

dataproc select T_ZY_GH_CHANGEOWNERDETAIL_select 
(
	fields:
	(
		(fname:"MANAGENUM"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_GH_CHANGEOWNERDETAIL_dataset",
	order_by:("DEPTID"),
	conditions:"vf_DEPTID = '1' 
	and CHANGEOWNERID = '1'"
);

dataproc select T_ZY_JG_PROCARTICLEDTL_select 
(
	fields:
	(
		(fname:"MANAGENO"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_JG_PROCARTICLEDTL_dataset",
	order_by:("DEPTID"),
	conditions:"DEPTID = '101'
	and TO_CHAR (ACCEPTANCE_TIME, '%Y-%m-%d') > '2012-07-16'
	and DEPT_ID = '1'"
);

dataproc select T_ZY_CK_OUTPACK_select 
(
	fields:
	(
		(fname:"MANAGENUM"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_CK_OUTPACK_dataset",
	order_by:("DEPTID"),
	conditions:"DEPT_ID = '1'
	and vf_DEPTID = '1'"
);

dataproc select T_ZY_GH_CHANGEOWNERDETAIL_2_select 
(
	fields:
	(
		(fname:"MANAGENUM"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_GH_CHANGEOWNERDETAIL_dataset",
	order_by:("DEPTID"),
	conditions:"vf_DEPTID = '1' 
	and CHANGEOWNERID = '1'"
);

dataproc select T_ZY_JG_PROCMATERIALDTL_select 
(
	fields:
	(
		(fname:"MANAGENO"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_JG_PROCMATERIALDTL_dataset",
	order_by:("DEPTID"),
	conditions:"DEPTID LIKE '080%'
	and vf_DEPTID = '1'
	and DEPT_ID = '1'"
);

dataproc union union_1_1
(
	inputs:("T_GG_SJ_GOODS_select","T_ZY_RK_INBILLDETAIL_select","T_ZY_GH_CHANGEOWNERDETAIL_select","T_ZY_JG_PROCARTICLEDTL_select","T_ZY_CK_OUTPACK_select","T_ZY_GH_CHANGEOWNERDETAIL_2_select","T_ZY_JG_PROCMATERIALDTL_select")
);

dataproc select union_1_select 
(
	fields:
	(
		(fname:"MANAGENO"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"NETWEIGHT")
	),
	inputs:"union_1_1",
	order_by:("MANAGENO")
);

dataproc select union_2_select
(
	fields:
	(
		(fname:"MANAGENO"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"30",alias:"GOODTYPE",type:"double"),
		(fname:"NETWEIGHT")
	),
	inputs:"union_1_1",
	order_by:("MANAGENO")
);

dataproc index T_ZY_CK_OUTBILL_index
(
 inputs:union_1_select,
 table:union_1
 );
 
dataproc doc T_ZY_CK_OUTBILL_doc
(  
   inputs:union_1_select,
   table:union_1,
   format:union_1_parser,
   fields:("MANAGENO","KINDNAME","SHOPSIGNNAME","GRADENUM","PRODAREANAME","DEPTID","NETWEIGHT")
);

dataproc select T_ZY_RK_INBILLDETAIL_2_select 
(
	fields:
	(
		(fname:"MANAGENO"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"10",alias:"GOODTYPE",type:"double"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_RK_INBILLDETAIL_dataset",
	order_by:("MANAGENO"),
	conditions:"TO_CHAR (FIRSTINDATE, '%Y-%m-%d') >= '2012-07-16'
	and TO_CHAR (FIRSTINDATE, '%Y-%m-%d') <= '2015-07-16'
	and DEPT_ID = '1' 
	and OWNER_ID = '1'"
);

dataproc select T_ZY_CK_OUTPACK_2_select 
(
	fields:
	(
		(fname:"MANAGENUM"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"20",alias:"GOODTYPE",type:"double"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_CK_OUTPACK_dataset",
	order_by:("DEPTID"),
	conditions:"DEPT_ID = '1' 
	and OWNER_ID = '1'
	and vf_2_DEPTID = '1' 
	and vf_2_OUTBILLID = '1'"
);

dataproc select T_ZY_GH_CHANGEOWNERDETAIL_3_select 
(
	fields:
	(
		(fname:"MANAGENUM"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"11",alias:"GOODTYPE",type:"double"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_GH_CHANGEOWNERDETAIL_dataset",
	order_by:("DEPTID"),
	conditions:"NEWOWNERNO = OWNER_ID
	and vf_2_DEPTID = '1' 
	and vf_2_CHANGEOWNERID = '1'"
);

dataproc select T_ZY_GH_CHANGEOWNERDETAIL_4_select 
(
	fields:
	(
		(fname:"MANAGENUM"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"21",alias:"GOODTYPE",type:"double"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_GH_CHANGEOWNERDETAIL_dataset",
	order_by:("DEPTID"),
	conditions:"PREOWNERNO = OWNER_ID
	and vf_2_DEPTID = '1' 
	and vf_2_CHANGEOWNERID = '1'"
);

dataproc select T_ZY_JG_PROCARTICLEDTL_2_select 
(
	fields:
	(
		(fname:"MANAGENO"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"12",alias:"GOODTYPE",type:"double"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_JG_PROCARTICLEDTL_dataset",
	order_by:("DEPTID"),
	conditions:"DEPTID LIKE '080%'
	and TO_CHAR (ACCEPTANCE_TIME, '%Y-%m-%d') >= '2012-07-16'
	and TO_CHAR (ACCEPTANCE_TIME, '%Y-%m-%d') <= '2015-07-16'
	and DEPT_ID = '1' 
	and OWNER_ID = '1'"
);

dataproc select T_ZY_JG_PROCMATERIALDTL_2_select 
(
	fields:
	(
		(fname:"MANAGENO"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"GRADENUM"),
		(fname:"PRODAREANAME"),
		(fname:"DEPTID"),
		(fname:"22",alias:"GOODTYPE",type:"double"),
		(fname:"NETWEIGHT")
	),
	inputs:"T_ZY_JG_PROCMATERIALDTL_dataset",
	order_by:("DEPTID"),
	conditions:"DEPTID LIKE '080%'
	and vf_DEPTID = '1'
	and vf_PROCESSID = '1'
	and vf_2_DEPTID = '1' 
	and vf_2_PROCESSID = '1'"
);

dataproc union union_all_1
(
	inputs:("union_2_select","T_ZY_RK_INBILLDETAIL_2_select","T_ZY_CK_OUTPACK_2_select","T_ZY_GH_CHANGEOWNERDETAIL_3_select","T_ZY_GH_CHANGEOWNERDETAIL_4_select","T_ZY_JG_PROCARTICLEDTL_2_select","T_ZY_JG_PROCMATERIALDTL_2_select")
);

dataproc select union_all_1_select
(
	fields:(
		(fname:"nvl (MANAGENO,'NULL')",alias:"MANAGENO",type:"string"),
		(fname:"nvl (KINDNAME,'NULL')",alias:"KINDNAME",type:"string"),
		(fname:"nvl (SHOPSIGNNAME,'NULL')",alias:"SHOPSIGNNAME",type:"string"),
		(fname:"nvl (PRODAREANAME,'NULL')",alias:"PRODAREANAME",type:"string"),
		(fname:"sum(case GOODTYPE when 10 then NETWEIGHT else 0 end)",alias:"INSTOCK",type:"double"),
		(fname:"sum(case GOODTYPE when 20 then NETWEIGHT else 0 end)",alias:"OUTSTOCK",type:"double"),
		(fname:"sum(case GOODTYPE when 11 then NETWEIGHT else 0 end)",alias:"CHANGINSTOCK",type:"double"),
		(fname:"sum(case GOODTYPE when 21 then NETWEIGHT else 0 end)",alias:"CHANGOUTSTOCK",type:"double"),
		(fname:"sum(case GOODTYPE when 12 then NETWEIGHT else 0 end)",alias:"PROCESSINSTOCK",type:"double"),
		(fname:"sum(case GOODTYPE when 22 then NETWEIGHT else 0 end)",alias:"PROCESSOUTSTOCK",type:"double"),
		(fname:"sum(case GOODTYPE when 30 then NETWEIGHT else 0 end)",alias:"ENDSTOCK",type:"double")
	),
	inputs: "union_all_1"
);

dataproc select union_all_1_1_select
(
	fields:(
		(fname:"MANAGENO",type:"string"),
		(fname:"KINDNAME",type:"string"),
		(fname:"SHOPSIGNNAME",type:"string"),
		(fname:"PRODAREANAME",type:"string"),
		(fname:"INSTOCK",type:"double"),
		(fname:"OUTSTOCK",type:"double"),
		(fname:"CHANGINSTOCK",type:"double"),
		(fname:"CHANGOUTSTOCK",type:"double"),
		(fname:"PROCESSINSTOCK",type:"double"),
		(fname:"PROCESSOUTSTOCK",type:"double"),
		(fname:"ENDSTOCK",type:"double"),
		(fname:"ENDSTOCK-INSTOCK+OUTSTOCK",alias:"BEGINSTOCK",type:"double")
	),
	inputs: "union_all_1_select",
	group_by:(MANAGENO,KINDNAME,SHOPSIGNNAME,PRODAREANAME)
);

dataproc index union_all_2_index
(
 inputs:union_all_1_1_select,
 table:union_all
 );
 
dataproc doc union_all_2_doc
(  
   inputs:union_all_1_1_select,
   table:union_all,
   format:union_all_parser,
   fields:("MANAGENO","KINDNAME","SHOPSIGNNAME","PRODAREANAME","INSTOCK","OUTSTOCK","CHANGINSTOCK","CHANGOUTSTOCK","PROCESSINSTOCK","PROCESSOUTSTOCK","ENDSTOCK","BEGINSTOCK")
);

end;

run job 5_job (threads:8);
<file_sep>/complete/JINSHANG-102/job4.sql
create job 4_job(8)
begin

dataset file T_ZY_RK_INBILLDETAIL_dataset
(
	schema: T_ZY_RK_INBILLDETAIL_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_RK_INBILLDETAIL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_RK_INBILLDETAIL_syncher
(
    inputs: T_ZY_RK_INBILLDETAIL_dataset,
    database:db,
    operation:add, 
    table:T_ZY_RK_INBILLDETAIL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_RK_INBILLDETAIL_dataset,
		serviceid: idx_job)
	)
);
end;

run job 4_job (threads:8);
<file_sep>/complete/JINSHANG-87/jinshang-87.sql
SELECT sum(weightsum)
FROM t_gu_gub
WHERE R_RECORD_CREATE_DATE>to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd');


SELECT sum(releaseweight)
FROM t_gu_gub
WHERE R_RECORD_CREATE_DATE>to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd');

<file_sep>/uncomplete/JINSHANG-81&85/jinshang-81.sql
SELECT T_ZY_CK_OutPack.StockType,
       T_ZY_CK_OutBill.OutBillOwnerName OwnerName,
       T_ZY_CK_OutPack.ManageNum,
       T_ZY_CK_OutPack.OutBillNo BillNo,
       SUM(T_ZY_CK_OutPack.NetWeight) NetWeightSum,
       SUM(T_ZY_CK_OutPack.GrossWeight) GrossWeightSum,
       SUM(T_ZY_CK_OutPack.SheetNum) SheetNumSum,
       T_ZY_CK_OutPack.ShopSignName,
       T_ZY_CK_OutPack.GradeNum,
       T_ZY_CK_OutBill.ForeignListNo,
       to_char(T_ZY_CK_OutBill.Outcusttime, 'yyyy-mm-dd') OutBillTime,
       T_ZY_CK_OutPack.CreaterName
FROM T_ZY_CK_OutBill
JOIN T_ZY_CK_OutPack ON T_ZY_CK_OutBill.OutBillID = T_ZY_CK_OutPack.OutBillNo
AND T_ZY_CK_OutBill.DeptID = T_ZY_CK_OutPack.DeptID
WHERE T_ZY_CK_OutPack.GoodsStateNo = '40'
  AND T_ZY_CK_OutBill.DeptID = '0301'
  AND T_ZY_CK_OutBill.ForeignListNo LIKE 'TDGM%'
  AND T_ZY_CK_OutPack.ManageNum LIKE 'M%'
  AND T_ZY_CK_OutBill.OutBillOwnerNo = 'KH00001'
  AND T_ZY_CK_OutBill.Outcusttime >=to_date('2015/7/1','yyyy-mm-dd')
  AND T_ZY_CK_OutBill.Outcusttime <to_date('2015/8/1','yyyy-mm-dd')
GROUP BY T_ZY_CK_OutPack.StockType,
         T_ZY_CK_OutBill.OutBillOwnerName,
         T_ZY_CK_OutPack.ManageNum,
         T_ZY_CK_OutPack.OutBillNo,
         T_ZY_CK_OutBill.ForeignListNo,
         T_ZY_CK_OutBill.Outcusttime,
         T_ZY_CK_OutPack.CreaterName,
         T_ZY_CK_OutPack.ShopSignName,
         T_ZY_CK_OutPack.GradeNum
UNION ALL
SELECT NULL StockType,
            t_zy_gh_changeownerlist.proownername OwnerName,
            t_zy_gh_changeownerdetail.ManageNum,
            t_zy_gh_changeownerdetail.changeownerno BillNo,
            SUM(t_zy_gh_changeownerdetail.NetWeight) NetWeightSum,
            SUM(t_zy_gh_changeownerdetail.GrossWeight) GrossWeightSum,
            SUM(t_zy_gh_changeownerdetail.SheetNum) SheetNumSum,
            t_zy_gh_changeownerdetail.ShopSignName,
            t_zy_gh_changeownerdetail.GradeNum,
            t_zy_gh_changeownerlist.ForeignListNo,
            to_char(t_zy_gh_changeownerdetail.incusttime, 'yyyy-mm-dd') OutBillTime,
            t_zy_gh_changeownerdetail.r_record_create_user CreaterName
FROM t_zy_gh_changeownerlist
JOIN t_zy_gh_changeownerdetail ON t_zy_gh_changeownerlist.changeownerid = t_zy_gh_changeownerdetail.changeownerno
AND t_zy_gh_changeownerlist.DeptID = t_zy_gh_changeownerdetail.DeptID
WHERE t_zy_gh_changeownerlist.DeptID = '0301'
  AND t_zy_gh_changeownerlist.ForeignListNo LIKE 'TDGM%'
  AND t_zy_gh_changeownerdetail.ManageNum LIKE 'M%'
  AND t_zy_gh_changeownerlist.preownerno = 'KH00001'
  AND t_zy_gh_changeownerdetail.incusttime >=to_date('2015/7/1','yyyy-mm-dd')
  AND t_zy_gh_changeownerdetail.incusttime <to_date('2015/8/1','yyyy-mm-dd')
GROUP BY t_zy_gh_changeownerlist.proownername,
         t_zy_gh_changeownerdetail.ManageNum,
         t_zy_gh_changeownerdetail.changeownerno,
         t_zy_gh_changeownerdetail.ShopSignName,
         t_zy_gh_changeownerdetail.GradeNum,
         t_zy_gh_changeownerlist.ForeignListNo,
         t_zy_gh_changeownerdetail.incusttime,
         t_zy_gh_changeownerdetail.r_record_create_user;

<file_sep>/schema/T_GG_SJ_PRODUCTTYPE.sql
create schema T_GG_SJ_PRODUCTTYPE_schema
source type CSV
fields(
 "kindno"               type str,
 "kindname"             type str,
 "parentid"             type str,
 "shortcut"             type str,
 "remark"               type str,
 "deptid"               type str,
 "kindsettleid"         type str,
 "r_record_create_date" type DATETIME,
 "r_record_create_user" type str,
 "r_record_update_date" type DATETIME,
 "r_record_update_user" type str,
 "r_record_is_deleted"  type double,
 "innercd"              type str,
 "r_record_change_flag" type double,
 "kindcheck"            type double,
 "kindmemo"             type str,
 "kindunit"             type str,
 "kindwei"              type double,
 "xhunit"               type str,
 "sheetunit"            type str,
 "gradenum"             type str,
 "lv1unit"              type str,
 "bwlno"                type str,
 "bwlnoparentid"        type str
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "NULL";

CREATE PARSER T_GG_SJ_PRODUCTTYPE_parser
TYPE rcd
SCHEMA T_GG_SJ_PRODUCTTYPE_schema;

CREATE TABLE T_GG_SJ_PRODUCTTYPE using T_GG_SJ_PRODUCTTYPE_parser; 

CREATE INDEX T_GG_SJ_PRODUCTTYPE_index ON TABLE T_GG_SJ_PRODUCTTYPE (kindno);<file_sep>/uncomplete/JINSHANG-102/2_init.sql

create job 1_job(1)
begin
dataset file T_ZY_CK_CLEAR_1_dataset
(
	schema: "T_ZY_CK_CLEAR_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_CK_CLEAR.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc index T_ZY_CK_CLEAR_index
(
 inputs:T_ZY_CK_CLEAR_1_dataset,
 table:T_ZY_CK_CLEAR
 );
 
dataproc doc T_ZY_CK_CLEAR_doc
(  
   inputs:T_ZY_CK_CLEAR_1_dataset,
   table:T_ZY_CK_CLEAR
);

   dataproc map T_ZY_CK_CLEAR_1_map
(  
   inputs:T_ZY_CK_CLEAR_1_dataset,
   table:T_ZY_CK_CLEAR
);
end;
run job 1_job (threads:8);

create job 2_job(1)
begin
dataset file T_ZY_JG_PROCESS_1_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCESS.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc index P_index
(
 inputs:T_ZY_JG_PROCESS_1_dataset,
 table:T_ZY_JG_PROCESS
 );
 
dataproc doc P_doc
(  
   inputs:T_ZY_JG_PROCESS_1_dataset,
   table:T_ZY_JG_PROCESS
);

   dataproc map P_1_map
(  
   inputs:T_ZY_JG_PROCESS_1_dataset,
   table:T_ZY_JG_PROCESS
);
end;
run job 2_job (threads:8);





create job 3_job(3)
begin
dataset file T_GG_SJ_GOODS_dataset
(
	schema: "T_GG_SJ_GOODS_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_GG_SJ_GOODS.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_RK_INBILLDETAIL_dataset
(
	schema: T_ZY_RK_INBILLDETAIL_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_RK_INBILLDETAIL.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_JG_PROCARTICLEDTL_dataset
(
	schema: T_ZY_JG_PROCARTICLEDTL_schema,
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCARTICLEDTL.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_GH_CHANGEOWNERLIST_dataset
(
	schema: T_ZY_GH_CHANGEOWNERLIST_schema,
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_GH_CHANGEOWNERLIST.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_GH_CHANGEOWNERDETAIL_dataset
(
	schema: T_ZY_GH_CHANGEOWNERDETAIL_schema,
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_GH_CHANGEOWNERDETAIL.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_CK_OUTPACK_dataset
(
	schema: T_ZY_CK_OUTPACK_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_CK_OUTPACK.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_JG_PROCMATERIALDTL_dataset
(
	schema: T_ZY_JG_PROCMATERIALDTL_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCMATERIALDTL.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_CK_CLEAR_dataset
(
	schema: T_ZY_CK_CLEAR_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_CK_CLEAR.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_JG_PROCESS_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCESS.txt",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_select
(
	fields: 
	 (
       (fname:"DEPTID"),
       (fname:"CHANGEOWNERID"),
       (fname:"NEWOWNERNO"),
       (fname:"NEWOWNERNAME"),
	   (fname:"PREOWNERNO"),
	   (fname:"PROOWNERNAME"),
	   (fname:"CHANGEDATE")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_dataset",
	 order_by:("DEPTID","CHANGEOWNERID"),
	 conditions:"DEPTID = '101'
	AND CHANGEDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')"
);

dataproc select T_ZY_GH_CHANGEOWNERDETAIL_select
(
	fields: 
	 (
		(fname:"PREMANAGENUM"),
		(fname:"CASE WHEN ( MANAGENUM IS NULL OR MANAGENUM = '') THEN PREMANAGENUM ELSE MANAGENUM END ",alias:"MANAGENUM",type:"string"),
		(fname:"SHOPSIGNID"),
		(fname:"SHOPSIGNNAME"),
		(fname:"PRODAREAID"),
		(fname:"PRODAREANAME"),
		(fname:"GRADENUM"),
		(fname:"NETWEIGHT"),
		(fname:"GROSSWEIGHT"),
		(fname:"SHEETNUM"),
		(fname:"FIRSTINDATE"),
		(fname:"KINDNAME"),
		(fname:"GOODSLOCID"),
		(fname:"PACKNUM"),
		(fname:"CHANGEOWNERNO"),
		(fname:"DEPTID",alias:"DEPTID_1",type:"string"),
		(fname:"GRADENUMXH"),
		(fname:"SINGLESHEETNUM"),
		(fname:"OWNERNAME"),
		(fname:"GOODSOWNERMANAGENUM",alias:"GOODSOWNERMANAGENO",type:"string")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERDETAIL_dataset",
	 order_by:("DEPTID_1","CHANGEOWNERNO")
);

dataproc join T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join
(
	inputs:
		(left_input:T_ZY_GH_CHANGEOWNERLIST_select,right_input:T_ZY_GH_CHANGEOWNERDETAIL_select),
	join_keys:
	(
		("left_input.DEPTID","right_input.DEPTID_1"),
		("left_input.CHANGEOWNERID","right_input.CHANGEOWNERNO")
	)
);



dataproc select T_GG_SJ_GOODS_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_GG_SJ_GOODS_dataset",
	 conditions:"GOODSSTATENO = '110'
		AND R_RECORD_IS_DELETED = 0
		AND DEPTID = '101'",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE)
);

dataproc select T_ZY_RK_INBILLDETAIL_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_RK_INBILLDETAIL_dataset",
	 conditions:"DEPTID = '101'
		AND GOODSSTATENO = '20'
		AND FIRSTINDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE)
);
 
 dataproc select T_ZY_JG_PROCARTICLEDTL_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_JG_PROCARTICLEDTL_dataset",
	 conditions:"DEPTID = '101'
		AND FIRSTINDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')
		AND GOODSSTATENO = '130'",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE)
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_select
(
	 fields: 
	 (
       (fname:"NEWOWNERNO",alias:"OWNERID"),
       (fname:"NEWOWNERNAME",alias:"OWNERNAME"),
       (fname:"MANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE)
);

dataproc select T_ZY_CK_OUTPACK_select
(
	 fields: 
	 (
       (fname:"OWNERNO"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENUM",alias:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_CK_OUTPACK_dataset",
	 conditions:"DEPTID = '101'
		AND OUTCUSTTIME >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	 group_by:(OWNERNO,OWNERNAME,MANAGENUM,GOODSOWNERMANAGENUM,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE)
);

dataproc select T_GG_SJ_GOODS_2_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
	   (fname:"PACKNUM"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_GG_SJ_GOODS_dataset",
	 conditions:"CREATDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE)
);

dataproc select T_ZY_JG_PROCMATERIALDTL_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_JG_PROCMATERIALDTL_dataset",
	 conditions:"vf_PROCESSID = '1'
	   and vf_DEPTID = '1' 
	   and DEPTID = '101' ",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE)
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_1_select
(
	 fields: 
	 (
       (fname:"PREOWNERNO",alias:"OWNERID"),
       (fname:"PROOWNERNAME",alias:"OWNERNAME"),
       (fname:"PREMANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE)
);
 
dataproc union 1_union
(
    inputs:("T_GG_SJ_GOODS_select","T_ZY_RK_INBILLDETAIL_select","T_ZY_JG_PROCARTICLEDTL_select","T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_select","T_ZY_CK_OUTPACK_select","T_GG_SJ_GOODS_2_select","T_ZY_JG_PROCMATERIALDTL_select","T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_1_select")
);

dataproc select union_select
(
	fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "1_union",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE)
);
 
  dataproc statistics union_all_statistics
(
  inputs:union_select,
  table:union_all
);

end;

run job 3_job (threads:8);
<file_sep>/schema/T_ZY_CK_CLEAR.sql
CREATE SCHEMA T_ZY_CK_CLEAR_schema
SOURCE TYPE CSV
FIELDS(                                                          
"clearno"                                                  type str,
"deptid"                                                   type str,
"packnum"                                                  type str,
"goodsid"                                                  type str,
"creatdate"                                                type datetime,
"operater"                                                 type str,
"memo"                                                     type str,
"r_record_create_date"                                     type datetime,
"r_record_create_user"                                     type str,
"r_record_update_date"                                     type datetime,
"r_record_update_user"                                     type str,
"r_record_is_deleted"                                      type double,
"r_record_change_flag"                                     type double
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM"; 

CREATE PARSER T_ZY_CK_CLEAR_parser
TYPE rcd
SCHEMA T_ZY_CK_CLEAR_schema;

CREATE TABLE T_ZY_CK_CLEAR using T_ZY_CK_CLEAR_parser;

CREATE INDEX T_ZY_CK_CLEAR_index ON TABLE T_ZY_CK_CLEAR (clearno); 

<file_sep>/complete/JINSHANG-102/job5.sql
create job 5_job(8)
begin

dataset file T_ZY_JG_PROCARTICLEDTL_dataset
(
	schema: T_ZY_JG_PROCARTICLEDTL_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_JG_PROCARTICLEDTL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCARTICLEDTL_syncher
(
    inputs: T_ZY_JG_PROCARTICLEDTL_dataset,
    database:db,
    operation:add, 
    table:T_ZY_JG_PROCARTICLEDTL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_JG_PROCARTICLEDTL_dataset,
		serviceid: idx_job)
	)
);
end;

run job 5_job (threads:8);
<file_sep>/complete/JINSHANG-76/del.sql
create job t_common_dept_delete_q1(zykie)
begin
dataset file t_common_dept2_dataset
(
	schema:T_COMMON_DEPT_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_common_dept/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher t_common_dept_syncher 
( 
inputs:t_common_dept2_dataset, 
database:db, 
operator:delete, 
table:T_COMMON_DEPT
); 
end;
run job t_common_dept_delete_q1(threads:8);

create job t_bm_ui_configure_delete_q1(zykie)
begin
dataset file T_BM_UI_CONFIGURE2_dataset
(
	schema:T_BM_UI_CONFIGURE_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_bm_ui_configure/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher t_common_dept_syncher 
( 
inputs:T_BM_UI_CONFIGURE2_dataset, 
database:db, 
operator:delete, 
table:T_BM_UI_CONFIGURE
); 
end;
run job t_bm_ui_configure_delete_q1(threads:8);

create job t_gg_sj_goods_delete_q1(zykie)
begin
dataset file T_GG_SJ_GOODS2_dataset
(
	schema:T_GG_SJ_GOODS_schema,
	filename:"/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/delete/delete.csv",
	serverid:0,
	splitter:(block_size: 10000000)		  
);
dataproc select T_GG_SJ_GOODS3_select
(
	fields: 
	(
     (fname:"nvl (deptid,'NULL')",alias:"deptid",type:"str"),	  
     (fname:"iilmap('T_COMMON_DEPT_map')",alias:"vf_deptname",type:"str"),
     (fname:"nvl (gradenum, 'NULL')",alias:"gradenum",type:"str"),
	 (fname:"nvl (shopsignid, 'NULL')",alias:"shopsignid",type:"str"),
	 (fname:"nvl (shopsignname, 'NULL')",alias:"shopsignname",type:"str"),
     (fname:"nvl (prodareaid, 'NULL')",alias:"prodareaid",type:"str"),
     (fname:"nvl (prodareaname, 'NULL')",alias:"prodareaname",type:"str"),
	 (fname:"nvl (kindno, 'NULL')",alias:"kindno",type:"str"),
	 (fname:"nvl (kindname, 'NULL')",alias:"kindname",type:"str"),
	 (fname:"nvl (ownername, 'NULL')",alias:"ownername",type:"str"),
	 (fname:"nvl (goodsownerpackno, 'NULL')",alias:"goodsownerpackno",type:"str"),
	 (fname:"nvl (netweight, 0)",alias:"netweight",type:"str"),
	 (fname:"nvl (grossweight, 0)",alias:"grossweight",type:"str"),
	 (fname:"nvl (sheetnum,  0)",alias:"sheetnum",type:"str"),
	 (fname:"iilmap('T_BM_UI_CONFIGURE_map',1)",alias:"vf_count",type:"str")
	),
	 inputs: "T_GG_SJ_GOODS2_dataset"
);

dataproc select T_GG_SJ_GOODS11_select
(
	fields: 
	(
     (fname:"deptid",type:"str"), 
     (fname:"vf_deptname",type:"str"),
     (fname:"gradenum",type:"str"),
	 (fname:"shopsignid",type:"str"),
	 (fname:"shopsignname",type:"str"),
     (fname:"prodareaid",type:"str"),
     (fname:"prodareaname",type:"str"),
	 (fname:"kindno",type:"str"),
	 (fname:"kindname",type:"str"),
	 (fname:"ownername",type:"str"),
	 (fname:"goodsownerpackno",type:"str"),
	 (fname:"sum(netweight)",alias:"sumnetweight",type:"str"),
	 (fname:"sum(grossweight)",alias:"sumgrossweight",type:"str"),
	 (fname:"sum(sheetnum)",alias:"sumsheetnum",type:"str"),
	 (fname:"vf_count",type:"str"),
	 (fname:"case vf_count when '0' then '101%'  else '101' end",alias:"vf_countcase",type:"str") 
	),
	 inputs: "T_GG_SJ_GOODS3_select",
	 group_by:(deptid,vf_deptname,gradenum,shopsignid,shopsignname,prodareaid,prodareaname,kindno,kindname,ownername,goodsownerpackno,vf_count,vf_countcase)
);
dataproc syncher T_GG_SJ_GOODS1_syncher
(
    inputs: T_GG_SJ_GOODS11_select,
    database:db,
    operator:delete, 
    table:T_GG_SJ_GOODS1
);
end;
run job t_gg_sj_goods_delete_q1(threads:8);<file_sep>/complete/JINSHANG-102/job6.sql
create job 6_job(8)
begin

dataset file T_ZY_GH_CHANGEOWNERLIST_dataset
(
	schema: T_ZY_GH_CHANGEOWNERLIST_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_GH_CHANGEOWNERLIST.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_GH_CHANGEOWNERLIST_syncher
(
    inputs: T_ZY_GH_CHANGEOWNERLIST_dataset,
    database:db,
    operation:add, 
    table:T_ZY_GH_CHANGEOWNERLIST,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_GH_CHANGEOWNERLIST_dataset,
		serviceid: idx_job)
	)
);
end;

run job 6_job (threads:8);
<file_sep>/uncomplete/JINSHANG-100/1_schema.sql
create database db;
use db;

create schema T_GG_SJ_GOODS_schema
source type CSV
fields(
 "GOODSID"              		type string,
 "DEPTID"               		type string,
 "PACKNUM"              		type string,
 "BARCODE"              		type string,
 "GOODSLOCID"           		type string,
 "STOCKTYPE"            		type string,
 "OWNERID"              		type string,
 "OWNERNAME"            		type string,
 "GOODSOWNERMANAGENO"   		type string,
 "INBILLID"             		type string,
 "GOODSOWNERPACKNO"     		type string,
 "MANAGENO"             		type string,
 "FEEBEGINDATE"         		type DATETIME,
 "CONTRACTID"           		type string,
 "GOODSSTATENO"         		type string,
 "GOODSSTATENAME"       		type string,
 "CHANGEOWNERTIMES"     		type double default value '0',
 "GOODSTYPE"            		type string,
 "GOODSTYPENAME"        		type string,
 "KINDNO"               		type string,
 "KINDNAME"             		type string,
 "SHOPSIGNID"           		type string,
 "SHOPSIGNNAME"         		type string,
 "PRODAREAID"           		type string,
 "PRODAREANAME"         		type string,
 "GOODSBATCHNO"         		type string,
 "PRODSTOVENO"          		type string,
 "GRADENUM"             		type string,
 "GRADENUMTHICK"        		type double,
 "GRADENUMWIDTH"        		type double,
 "GRADENUMLENGTH"       		type double,
 "GROSSWEIGHT"          		type double,
 "NETWEIGHT"            		type double,
 "POUNDWEIGHT"          		type double,
 "CHECKWEIGHT"          		type double,
 "SHEETNUM"             		type double default value '1',
 "UNIT"                 		type string,
 "PACKTYPE"             		type string,
 "STOCKAREAID"          		type string,
 "QUALITYMEMO"          		type string,
 "FIRSTINOWNERID"       		type string,
 "FIRSTINDATE"          		type datetime,
 "OUTBILLID"            		type string,
 "LDGLISTID"            		type string,
 "MATERIALGOODSID"      		type string,
 "INTYPE"               		type string,
 "OUTTYPE"              		type string,
 "BILLSTATE"            		type double,
 "OUTBILLTIME"          		type DATETIME,
 "MEMO"                 		type string,
 "EXTSYSPLANOBJECTID"   		type string,
 "EXTSYSKINDID"         		type string,
 "EXTSYSSHOPSIGNID"     		type string,
 "EXTSYSPRODAREAID"     		type string,
 "FOREIGNLISTNO"        		type string,
 "SENDFLAG"             		type double,
 "R_RECORD_CREATE_DATE" 		type DATETIME,
 "R_RECORD_CREATE_USER" 		type string,
 "R_RECORD_UPDATE_DATE" 		type DATETIME,
 "R_RECORD_UPDATE_USER" 		type string,
 "R_RECORD_IS_DELETED"  		type double,
 "INCUSTTIME"           		type DATETIME,
 "SIDEMARK"             		type string,
 "TEMP"                 		type string,
 "LENGTH_PRODUCT_MAX"   		type double,
 "HEAT_NUM"             		type string,
 "TEST_LOT_NUM"         		type string,
 "R_RECORD_CHANGE_FLAG" 		type double,
 "SDPRICE"              		type string,
 "EXTSYSGRADENUM"       		type string,
 "COLLECTIONMANNAME"    		type string,
 "LOCKFLAG"             		type string,
 "CHECK_TYPE"           		type string,
 "OUTDATE"              		type DATETIME,
 "YFWEIGHT"             		type double,
 "YFSHEET"              		type double,
 "PREGOODSID"           		type string,
 "ISSPLIT"              		type double,
 "GRADENUMXH"           		type double,
 "GRADENUMWHDW"         		type string,
 "SPLITTIME"            		type double,
 "ISCLEAR"              		type double,
 "SINGLESHEETNUM"       		type double,
 "GRADENUMHZ"           		type string,
 "GRADENUMTHICKHZ"      		type double,
 "SINGLESHEET"          		type double,
 "LOCLV1"               		type string,
 "SINGLESHEETUNIT"      		type string,
 "DCEMP"                		type string,
 "QZEMP"                		type string,
 "DCEMP2"               		type string,
 "SHIPNO"               		type string,
 "SHIPNAME"             		type string,
 "SHIPCD"               		type string,
 "SHIPLEVEL"            		type string,
 "CMMEMO"               		type string,
 "CMMEMOCK"             		type string,
 "SHOPSIGNCD"           		type string,
 "PROCESSTYPENAME"      		type string,
 "PACKTYPENAME"         		type string,
 "SORT_EMP"             		type string,
 "CUSTOMERID"           		type string,
 "LVGOODSID"            		type string,
 "DISPERSESHEET"        		type double,
 "DBDEPTID"             		type string,
 "DBCUSTOMER"           		type string,
 "DBGULENDER"           		type string,
 "LOCKED_OBJECT"        		type string,
 "LOCKED_DATE"          		type DATETIME,
 "UNLOCKED_DATE"        		type DATETIME,
 "PREOWNERNAME"         		type string,
 "PLY"                  		type double default value '0',
 "TDSTATE"              		type string default value '1',
 "OPSELECTED"           		type string,
 "OPLOCK"               		type string,
 "OPINUPLOAD"           		type string,
 "OPCHANGEUPLOAD"       		type string,
 "OPINBATCHID"          		type string,
 "OPCHANGEBATCHID"      		type string,
 "OPINUPLOAD_DATE"      		type DATETIME,
 "OUT_PACKAGE_STATUS"   		type string,
 "OUT_PACKAGE_DESC"     		type string,
 "GMPACKTYPE"           		type string,
 "HANDNO"               		type string,
 "SAVENO"               		type string,
 "DRAWNO"               		type string,
 "DANGEROUSLEVEL"       		type string,
 "ACCEPTANCECRITERIA"   		type string,
 "SHIPPINGMARK"         		type string,
 "LOCLV2"               		type string,
 "PAYEDFLAG"            		type string,
 "ORDERGOODSOWNERID"    		type string,
 "ORDERGOODSOWNERNAME"  		type string,
 "CREATDATE" type `expr` data type datetime value  iilmap("T_ZY_CK_CLEAR_map",GOODSID)
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_GG_SJ_GOODS_parser
TYPE rcd
SCHEMA T_GG_SJ_GOODS_schema;

CREATE TABLE T_GG_SJ_GOODS using T_GG_SJ_GOODS_parser; 

create schema T_ZY_RK_INBILLDETAIL_schema
source type CSV
fields(
  "GOODSID"              type string not null,
  "DEPTID"               type string not null,
  "PACKNUM"              type string,
  "BARCODE"              type string,
  "GOODSLOCID"           type string,
  "STOCKTYPE"            type string,
  "OWNERID"              type string,
  "OWNERNAME"            type string,
  "GOODSOWNERMANAGENO"   type string,
  "INBILLID"             type string,
  "GOODSOWNERPACKNO"     type string,
  "MANAGENO"             type string not null,
  "FEEBEGINDATE"         type datetime,
  "CONTRACTID"           type string,
  "GOODSSTATENO"         type string,
  "GOODSSTATENAME"       type string,
  "CHANGEOWNERTIMES"     type double,
  "GOODSTYPE"            type string,
  "GOODSTYPENAME"        type string,
  "KINDNO"               type string,
  "KINDNAME"            type string,
  "SHOPSIGNID"           type string,
  "SHOPSIGNNAME"         type string,
  "PRODAREAID"           type string,
  "PRODAREANAME"         type string,
  "GOODSBATCHNO"         type string,
  "PRODSTOVENO"          type string,
  "GRADENUM"             type string,
  "GRADENUMTHICK"        type double,
  "GRADENUMWIDTH"        type double,
  "GRADENUMLENGTH"       type double,
  "GROSSWEIGHT"          type double,
  "NETWEIGHT"            type double,
  "POUNDWEIGHT"          type double,
  "CHECKWEIGHT"          type double,
  "SHEETNUM"             type double,
  "UNIT"                 type string,
  "STOCKAREAID"          type string,
  "QUALITYMEMO"          type string,
  "FIRSTINOWNERID"       type string,
  "FIRSTINDATE"          type datetime,
  "OUTBILLID"            type string,
  "LDGLISTID"            type string,
  "MATERIALGOODSID"      type string,
  "INTYPE"               type string,
  "OUTTYPE"              type string,
  "BILLSTATE"            type double,
  "OUTBILLTIME"          type datetime,
  "MEMO"                 type string,
  "EXTSYSPLANOBJECTID"   type string,
  "EXTSYSKINDID"         type string,
  "EXTSYSSHOPSIGNID"     type string,
  "EXTSYSPRODAREAID"     type string,
  "SENDFLAG"             type double,
  "R_RECORD_CREATE_DATE" type datetime,
  "R_RECORD_CREATE_USER" type string,
  "R_RECORD_UPDATE_DATE" type datetime,
  "R_RECORD_UPDATE_USER" type string,
  "R_RECORD_IS_DELETED"  type double,
  "INCUSTTIME"           type datetime,
  "FOREIGNLISTNO"        type string,
  "SIDEMARK"             type string,
  "LENGTH_PRODUCT_MAX"   type double,
  "R_RECORD_CHANGE_FLAG" type double,
  "SDPRICE"              type string,
  "INBILLEMPNAME"        type string,
  "EXTSYSGRADENUM"       type string,
  "HEAT_NUM"             type string,
  "ERRORMESSAGE"         type string,
  "CHECK_TYPE"           type string,
  "OUTDATE"              type datetime,
  "YFWEIGHT"             type double,
  "YFSHEET"              type double,
  "PREGOODSID"           type string,
  "SINGLESHEETNUM"       type double,
  "GRADENUMHZ"           type string,
  "GRADENUMTHICKHZ"      type double,
  "SINGLESHEET"          type double,
  "GRADENUMXH"           type double,
  "SHIPNO"               type string,
  "SHIPNAME"             type string,
  "SHIPCD"               type string,
  "SHIPLEVEL"            type string,
  "SORT_EMP"             type string,
  "DBRKFLAG"             type double,
  "DBCKFLAG"             type double,
  "DBOWNER"              type string,
  "DBGOODSID"            type string,
  "DISPERSESHEET"        type double,
  "PLY"                  type double,
  "OUT_PACKAGE_STATUS"   type string,
  "OUT_PACKAGE_DESC"     type string,
  "GMPACKTYPE"           type string,
  "HANDNO"               type string,
  "SAVENO"               type string,
  "DANGEROUSLEVEL"       type string,
  "ACCEPTANCECRITERIA"   type string,
  "SHIPPINGMARK"         type string,
  "GRADENUMWHDW"         type string,
  "LOCLV2"               type string,
  "PACKTYPE"             type string,
  "PAYEDFLAG"            type string,
  "COLLECTIONMANNAME"    type string,
  "LOCLV1"               type string
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_RK_INBILLDETAIL_parser
TYPE rcd
SCHEMA T_ZY_RK_INBILLDETAIL_schema;

CREATE TABLE T_ZY_RK_INBILLDETAIL using T_ZY_RK_INBILLDETAIL_parser; 

create schema T_ZY_JG_PROCARTICLEDTL_schema
source type CSV
fields(
  "PROCARTICLEDTLID"     type string not null,
  "DEPTID"               type string not null,
  "PROCESSID"            type string,
  "PACKNUM"              type string,
  "BARCODE"              type string,
  "GOODSLOCID"           type string,
  "OWNERID"              type string,
  "OWNERNAME"            type string,
  "GOODSOWNERMANAGENO"   type string,
  "GOODSOWNERPACKNO"     type string,
  "MANAGENO"             type string  not null,
  "FEEBEGINDATE"         type datetime,
  "CONTRACTID"           type string,
  "GOODSSTATENO"         type string,
  "GOODSSTATENAME"       type string,
  "CHANGEOWNERTIMES"     type double,
  "GOODSTYPE"            type string,
  "GOODSTYPENAME"        type string,
  "KINDNO"               type string,
  "KINDNAME"             type string,
  "SHOPSIGNID"           type string,
  "SHOPSIGNNAME"         type string,
  "PRODAREAID"           type string,
  "PRODAREANAME"         type string,
  "GOODSBATCHNO"         type string,
  "PRODSTOVENO"          type string,
  "GRADENUM"             type string,
  "GRADENUMTHICK"        type double,
  "GRADENUMWIDTH"        type double,
  "GRADENUMLENGTH"       type double,
  "GROSSWEIGHT"          type double,
  "NETWEIGHT"            type double,
  "POUNDWEIGHT"          type double,
  "CHECKWEIGHT"          type double,
  "SHEETNUM"             type double,
  "PACKTYPE"             type string,
  "PACKTYPENAME"         type string,
  "UNIT"                 type string,
  "QUALITYMEMO"          type string,
  "FIRSTINOWNERID"       type string,
  "FIRSTINDATE"          type datetime,
  "PRINTFLAG"            type string,
  "QUALITY"              type string,
  "QAMEMBER"             type string,
  "QAFLAG"               type string,
  "PROCESSQUALITYID"     type string,
  "R_RECORD_CREATE_DATE" type datetime,
  "R_RECORD_CREATE_USER" type string,
  "R_RECORD_UPDATE_DATE" type datetime,
  "R_RECORD_UPDATE_USER" type string,
  "R_RECORD_IS_DELETED"  type double,
  "ORDERBY"              type double,
  "R_RECORD_CHANGE_FLAG" type double,
  "INSTRUCTION_ID"       type string,
  "SENDFLAG"             type double,
  "ACCEPTANCE_TIMES"     type double,
  "ACCEPTANCER"          type string,
  "ACCEPTANCE_TIME"      type datetime,
  "SKINWEIGHT"           type double,
  "CYYWEIGHT"            type double,
  "GOODSID"              type string,
  "ARTICLEMEMO1"         type string,
  "ARTICLEMEMO2"         type string,
  "ARTICLEMEMO3"         type string,
  "ARTICLEMEMO4"         type string,
  "ARTICLEMEMO5"         type string,
  "ARTICLEMEMO6"         type string,
  "ARTICLEMEMO7"         type string,
  "ARTICLEMEMO8"         type string,
  "ARTICLEMEMO9"         type string,
  "ARTICLEMEMO10"        type string,
  "ARTICLEYS"            type string,
  "CUSTOMERID"           type string,
  "CBXJGTYPE"            type string,
  "WALLWIDTH"            type double,
  "WOODTYPE"             type string,
  "WOODTYPENAME"         type string,
  "CHANXIAN"             type string,
  "DRAWNO"               type string,
  "ZCFLAG"               type string ,
  "CLASSGROUP"           type string,
  "LOCLV1"               type string,
  "LOCLV2"               type string
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_JG_PROCARTICLEDTL_parser
TYPE rcd
SCHEMA T_ZY_JG_PROCARTICLEDTL_schema;

CREATE TABLE T_ZY_JG_PROCARTICLEDTL using T_ZY_JG_PROCARTICLEDTL_parser; 

create schema T_ZY_GH_CHANGEOWNERLIST_schema
source type CSV
fields(
 "CHANGEOWNERID"        	type string not null,
 "DEPTID"               	type string not null,
 "PROOWNERNAME"         	type string,
 "PREOWNERNO"           	type string,
 "CONTRACTNO"           	type string,
 "PREMANAGENUM"         	type string,
 "NEWOWNERNAME"         	type string,
 "NEWOWNERNO"           	type string,
 "NEWMANAGENUM"         	type string,
 "CHANGEDATE"           	type datetime,
 "GETBIILLDATE"         	type datetime,
 "FOREIGNLISTNO"        	type string,
 "ORDERLISTNO"          	type string,
 "OUTCARBILLTIME"       	type datetime,
 "OUTCARBILLEMPNO"      	type string,
 "OUTCARBILLEMPNAME"    	type string,
 "OUTCARBILLMEMO"       	type string,
 "R_RECORD_CREATE_DATE" 	type datetime,
 "R_RECORD_CREATE_USER" 	type string,
 "R_RECORD_UPDATE_DATE" 	type datetime,
 "R_RECORD_UPDATE_USER" 	type string,
 "R_RECORD_IS_DELETED"  	type double,
 "NETWEIGHTSUM"         	type double,
 "GROSSWEIGHTSUM"       	type double,
 "SHEETNUMSUM"          	type double,
 "ORIGINSETTLE"         	type double,
 "R_RECORD_CHANGE_FLAG" 	type double,
 "ISSPLIT"              	type double,
 "OUTPASSWORD"          	type string,
 "INVOICEKINDID"        	type string,
 "INVOICEKINDNAME"      	type string,
 "SORTEMP"              	type string,
 "SORTEMPTELE"          	type string,
 "SETTLESTATUS"         	type string,
 "CONFIRM_DATE"         	type datetime,
 "CONFIRM_EMP"          	type string,
 "CONFIRM_FLAG"         	type string,
 "DTLCOUNT"             	type double,
 "ISSETTLED"            	type double,
 "JFSENDFLAG"           	type double,
 "JYZXFLAG"             	type double,
 "SENDMESSAGE"          	type string,
 "JYZXCHECKDATE"        	type datetime,
 "JYZXCHECKFLAG"        	type double,
 "IDCODE"               	type string,
 "USERNAME"             	type string
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_GH_CHANGEOWNERLIST_parser
TYPE rcd
SCHEMA T_ZY_GH_CHANGEOWNERLIST_schema;

CREATE TABLE T_ZY_GH_CHANGEOWNERLIST using T_ZY_GH_CHANGEOWNERLIST_parser; 

create schema T_ZY_GH_CHANGEOWNERDETAIL_schema
source type CSV
fields(
  "MANAGENO"               type string not null,
  "DEPTID"                 type string not null,
  "CHANGEOWNERNO"          type string,
  "PACKNUM"                type string,
  "GOODSID"                type string,
  "INBEGINTIME"            type datetime,
  "BARCODE"                type string,
  "GOODSLOCID"             type string,
  "OWNERNAME"              type string,
  "OWNERNO"                type string,
  "PREGOODSOWNERMANAGENUM" type string,
  "GOODSOWNERMANAGENUM"    type string,
  "GOODSOWNERPACKNUM"      type string,
  "PREMANAGENUM"           type string,
  "MANAGENUM"              type string,
  "CONTRACTNO"             type string,
  "GOODSSTATENAME"         type string,
  "GOODSSTATENO"           type string,
  "GOODSTYPENAME"          type string,
  "GOODSTYPE"              type string,
  "KINDNAME"               type string,
  "KINDNO"                 type string,
  "SHOPSIGNNAME"           type string,
  "SHOPSIGNID"             type string,
  "PRODAREANAME"           type string,
  "PRODAREAID"             type string,
  "GOODSBATCHNUM"          type string,
  "GRADENUM"               type string,
  "GRADENUMTHICK"          type double,
  "GRADENUMWIDTH"          type double,
  "GRADENUMLENGTH"         type double,
  "GROSSWEIGHT"            type double,
  "NETWEIGHT"              type double,
  "POUNDWEIGHT"            type double,
  "CHECKWEIGHT"            type double,
  "SHEETNUM"               type double,
  "QUALITYMEMO"            type string,
  "FIRSTINOWNERID"         type string,
  "FIRSTINDATE"            type datetime,
  "INBILLID"               type string,
  "INTYPE"                 type string,
  "PREMEMO"                type string,
  "MEMO"                   type string,
  "FOREIGNLISTNO"          type string,
  "PREFOREIGNLISTNO"       type string,
  "ORDERLISTNO"            type string,
  "PREORDERLISTNO"         type string,
  "R_RECORD_CREATE_DATE"   type datetime,
  "R_RECORD_CREATE_USER"   type string,
  "R_RECORD_UPDATE_DATE"   type datetime,
  "R_RECORD_UPDATE_USER"   type string,
  "R_RECORD_IS_DELETED"    type double,
  "PREINCUSTTIME"          type datetime,
  "INCUSTTIME"             type datetime,
  "SENDFLAG"               type double,
  "OUTCHANGESENDFLAG"      type double,
  "CHANGETIMES"            type double,
  "ORIGINOWNERNAME"        type string,
  "ORIGINOWNERNO"          type string,
  "R_RECORD_CHANGE_FLAG"   type double,
  "CUSTDAY"                type double,
  "SDPRICE"                type string,
  "NEWDATE"                type datetime,
  "PREGOODSID"             type string,
  "CHECK_TYPE"             type string,
  "SINGLESHEETNUM"         type double,
  "GRADENUMXH"             type double,
  "SIDEMARK"               type string,
  "SORT_EMP"               type string,
  "DISPERSESHEET"          type double,
  "PLY"                    type double ,
  "ORIGINSHEETNUM"         type double,
  "ORIGINNETWEIGHT"        type double,
  "ISSPLIT"                type double,
  "GMPACKTYPE"             type string,
  "PREFOREIGNLISTCODE"     type string,
  "CONFIRMFLAG"            type string ,
  "JYZXFLAG"               type double,
  "LOCLV1"                 type string,
  "LOCLV2"                 type string,
  "OUTNETWEIGHT"           type double
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_GH_CHANGEOWNERDETAIL_parser
TYPE rcd
SCHEMA T_ZY_GH_CHANGEOWNERDETAIL_schema;

CREATE TABLE T_ZY_GH_CHANGEOWNERDETAIL using T_ZY_GH_CHANGEOWNERDETAIL_parser; 

create schema T_ZY_CK_OUTPACK_schema
source type CSV
fields(
  "OUTPACKID"            type string not null,
  "DEPTID"               type string not null,
  "OUTBILLNO"            type string not null,
  "GOODSID"              type string,
  "PACKNUM"              type string,
  "BARCODE"              type string,
  "GOODSLOCID"           type string,
  "OWNERNAME"            type string,
  "OWNERNO"              type string,
  "GOODSOWNERMANAGENUM"  type string,
  "GOODSOWNERPACKNUM"    type string,
  "MANAGENUM"            type string,
  "INBEGINTIME"          type datetime,
  "CONTRACTNO"           type string,
  "OLDGOODSSTATENAME"    type string,
  "OLDGOODSSTATENO"      type string,
  "GOODSSTATENAME"       type string,
  "GOODSSTATENO"         type string,
  "GOODSTYPENAME"        type string,
  "GOODSTYPE"            type string,
  "KINDNAME"             type string,
  "KINDNO"               type string,
  "SHOPSIGNNAME"         type string,
  "SHOPSIGNID"           type string,
  "PRODAREANAME"         type string,
  "PRODAREAID"           type string,
  "GOODSBATCHNUM"        type string,
  "GRADENUM"             type string,
  "GRADENUMTHICK"        type double,
  "GRADENUMWIDTH"        type double,
  "GRADENUMLENGTH"       type double,
  "GROSSWEIGHT"          type double,
  "OUTGROSSWEIGHT"       type double,
  "OUTNETWEIGHT"         type double,
  "NETWEIGHT"            type double,
  "POUNDWEIGHT"          type double,
  "CHECKWEIGHT"          type double,
  "SHEETNUM"             type double,
  "PACKTYPE"             type string,
  "QUALITYMEMO"          type string,
  "FIRSTINOWNERID"       type string,
  "FIRSTINDATE"          type datetime,
  "INBILLID"             type string,
  "MATERIALGOODSID"      type string,
  "INTYPE"               type string,
  "MEMO"                 type string,
  "CUSTBILL"             type string,
  "SENDFLAG"             type double,
  "VELFLAG"              type double,
  "R_RECORD_CREATE_DATE" type datetime,
  "R_RECORD_CREATE_USER" type string,
  "R_RECORD_UPDATE_DATE" type datetime,
  "R_RECORD_UPDATE_USER" type string,
  "R_RECORD_IS_DELETED"  type double,
  "FOREIGNLISTNO"        type string,
  "CREATEID"             type string,
  "CREATERNAME"          type string,
  "SIDEMARK"             type string,
  "STOCKTYPE"            type string,
  "OUTBILLPICKOWNERNAME" type string,
  "R_RECORD_CHANGE_FLAG" type double,
  "INCUSTTIME"           type datetime,
  "CUSTDAY"              type double,
  "SDPRICE"              type string,
  "OUTTYPE"              type string,
  "EXTSYSKINDID"         type string,
  "EXTSYSSHOPSIGNID"     type string,
  "EXTSYSGRADENUM"       type string,
  "PRODSTOVENO"          type string,
  "CHECK_TYPE"           type string,
  "SINGLESHEETNUM"       type double,
  "SINGLESHEET"          type double,
  "GRADENUMXH"           type double,
  "OUTBILLPICKOWNERNO"   type string,
  "OUTPASSWORD"          type string,
  "SHIPNO"               type string,
  "SHIPNAME"             type string,
  "SHIPCD"               type string,
  "SHIPLEVEL"            type string,
  "SORT_EMP"             type string,
  "LENGTH_PRODUCT_MAX"   type double,
  "PACKTYPENAME"         type string,
  "DBCKFLAG"             type double,
  "DBOWNER"              type string,
  "DISPERSESHEET"        type double,
  "OUTCARNO"             type string,
  "OUTCUSTTIME"          type datetime,
  "PLY"                  type double,
  "ORIGINOUTSHEETNUM"    type double,
  "OUTSHEETNUM"          type double,
  "ORIGINOUTNETWEIGHT"   type double,
  "ISSPLIT"              type double,
  "PREFOREIGNLISTNO"     type string,
  "DRAWNO"               type string,
  "HANDNO"               type string,
  "SAVENO"               type string,
  "LOCLV2"               type string,
  "GRADENUMWHDW"         type string,
  "OPTFLAG"              type double,
  "PAYEDFLAG"            type string,
  "SALE_PRICE_AT"        type double,
  "PRICE"                type double,
  "CHANGEOWNERTIMES"     type double,
  "CONTRACT_ID"          type string,
  "CONTRACT_SUBID"       type string,
  "JYZXFLAG"             type double,
  "OUTBILLDATE"          type datetime,
  "ROLLPLY"              type double,
  "READYOUT"             type datetime,
  "VALIDDATE"            type datetime,
  "LOCKCOUNT"            type double ,
  "LOCLV1"               type string
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_CK_OUTPACK_parser
TYPE rcd
SCHEMA T_ZY_CK_OUTPACK_schema;

CREATE TABLE T_ZY_CK_OUTPACK using T_ZY_CK_OUTPACK_parser; 

create schema T_ZY_CK_CLEAR_schema
source type CSV
fields(
  "CLEARNO"              type string,
  "DEPTID"               type string,
  "PACKNUM"              type string,
  "GOODSID"              type string not null,
  "CREATDATE"            type datetime,
  "OPERATER"             type string,
  "MEMO"                 type string,
  "R_RECORD_CREATE_DATE" type datetime,
  "R_RECORD_CREATE_USER" type string,
  "R_RECORD_UPDATE_DATE" type datetime,
  "R_RECORD_UPDATE_USER" type string,
  "R_RECORD_IS_DELETED"  type double,
  "R_RECORD_CHANGE_FLAG" type double
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_CK_CLEAR_parser
TYPE rcd
SCHEMA T_ZY_CK_CLEAR_schema;

CREATE TABLE T_ZY_CK_CLEAR using T_ZY_CK_CLEAR_parser; 

create index T_ZY_CK_CLEAR_index on table T_ZY_CK_CLEAR(GOODSID);

create map T_ZY_CK_CLEAR_map on table T_ZY_CK_CLEAR
KEY (GOODSID)
VALUE (CREATDATE)
TYPE datetime
WHERE CREATDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d');

create schema T_ZY_JG_PROCMATERIALDTL_schema
source type CSV
fields(
 "PROCMATERIALDTLID"    type string not null,
 "DEPTID"               type string not null,
 "PROCESSID"            type string,
 "PACKNUM"              type string,
 "GOODSID"              type string,
 "BARCODE"              type string,
 "GOODSLOCID"           type string,
 "OWNERID"              type string,
 "OWNERNAME"            type string,
 "GOODSOWNERMANAGENO"   type string,
 "GOODSOWNERPACKNO"     type string,
 "MANAGENO"             type string,
 "FEEBEGINDATE"         type datetime,
 "CONTRACTID"           type string,
 "GOODSSTATENO"         type string,
 "GOODSSTATENAME"       type string,
 "CHANGEOWNERTIMES"     type double,
 "GOODSTYPE"            type string,
 "GOODSTYPENAME"        type string,
 "KINDNO"               type string,
 "KINDNAME"             type string,
 "SHOPSIGNID"           type string,
 "SHOPSIGNNAME"         type string,
 "PRODAREAID"           type string,
 "PRODAREANAME"         type string,
 "GOODSBATCHNO"         type string,
 "PRODSTOVENO"          type string,
 "GRADENUM"             type string,
 "GRADENUMTHICK"        type double,
 "GRADENUMWIDTH"        type double,
 "GRADENUMLENGTH"       type double,
 "GROSSWEIGHT"          type double,
 "NETWEIGHT"            type double,
 "POUNDWEIGHT"          type double,
 "CHECKWEIGHT"          type double,
 "SHEETNUM"             type double,
 "PACKTYPE"             type string,
 "PACKTYPENAME"         type string,
 "UNIT"                 type string,
 "QUALITYMEMO"          type string,
 "FIRSTINOWNERID"       type string,
 "FIRSTINDATE"          type datetime,
 "INBILLID"             type string,
 "INTYPE"               type string,
 "R_RECORD_CREATE_DATE" type datetime,
 "R_RECORD_CREATE_USER" type string,
 "R_RECORD_UPDATE_DATE" type datetime,
 "R_RECORD_UPDATE_USER" type string,
 "R_RECORD_IS_DELETED"  type double,
 "ORDERBY"              type double,
 "R_RECORD_CHANGE_FLAG" type double,
 "SHOPSIGNCD"           type string,
 "CUSTOMERID"           type string,
 "CHANXIAN"             type string,
 "PLY"                  type double,
 "MEMO"                 type string,
 "JYZXFLAG"             type double,
 "LOCLV1"               type string,
 "LOCLV2"               type string,
 "SPECIALMEMO"          type string,
 "vf_PROCESSID" type `expr` data type string value  iilmap("PROCESSID_map",PROCESSID),
 "vf_DEPTID" type `expr` data type string value  iilmap("DEPTID_map",DEPTID)
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_JG_PROCMATERIALDTL_parser
TYPE rcd
SCHEMA T_ZY_JG_PROCMATERIALDTL_schema;

CREATE TABLE T_ZY_JG_PROCMATERIALDTL using T_ZY_JG_PROCMATERIALDTL_parser; 

create schema T_ZY_JG_PROCESS_schema
source type CSV
fields(
 "PROCESSID"            type string not null,
 "DEPTID"               type string,
 "CUSTOMERID"           type string,
 "PROCESSDEPT"          type string,
 "PROCESSDEPTNAME"      type string,
 "PROCESSTYPE"          type string,
 "PROCESSTYPENAME"      type string,
 "PROCESSMOLD"          type string,
 "PROCESSMOLDNAME"      type string,
 "PROCESSSTATE"         type double,
 "PLANENDDATE"          type datetime,
 "KINDNO"               type string,
 "KINDNAME"             type string,
 "PACKTYPE"             type string,
 "PACKTYPENAME"         type string,
 "WOODTYPE"             type string,
 "WOODTYPENAME"         type string,
 "STRAPTYPE"            type string,
 "STRAPTYPENAME"        type string,
 "PROCESSPRECISION"     type string,
 "ORDERINFO"            type string,
 "FEE"                  type double,
 "LENGTH"               type double,
 "WEIGTHT"              type double,
 "SHEET"                type double,
 "PIECENUM"             type double,
 "OUTCARBILLTIME"       type datetime,
 "OUTCARBILLEMPNO"      type string,
 "OUTCARBILLEMPNAME"    type string,
 "PLANNO"               type string,
 "PREWEIGHTSUM"         type double,
 "MENO"                 type string,
 "GRADENUMRANGE"        type string,
 "GRADENUMRANGENAME"    type string,
 "THICKRANGE"           type string,
 "THICKRANGENAME"       type string,
 "R_RECORD_CREATE_DATE" type datetime,
 "R_RECORD_CREATE_USER" type string,
 "R_RECORD_UPDATE_DATE" type datetime,
 "R_RECORD_UPDATE_USER" type string,
 "R_RECORD_IS_DELETED"  type double,
 "R_RECORD_CHANGE_FLAG" type double,
 "DENSITY"              type double,
 "PROCESSCUSTOMNO"      type string,
 "PROCESSCUSTOMNAME"    type string,
 "SETTLEDEPTNO"         type string,
 "SETTLEDEPTNAME"       type string,
 "SETTLE_STAUS"         type string,
 "SETTLE_STAUS_NAME"    type string,
 "SETTLE_NO"            type string,
 "SETTLE_DATE"          type datetime,
 "ACCEPTANCER"          type string,
 "ACCEPTANCE_TIME"      type datetime,
 "CHANXIAN"             type string,
 "MDDEPTNAME"           type string,
 "ARTICLEYS"            type string,
 "MATERIALGRADENUM"     type string,
 "MATERIALSHOPSIGN"     type string,
 "CBXJGTYPE"            type string,
 "JGMESSAGE"            type string,
 "JGSTATUS"             type string,
 "ARTICLEFEE"           type string,
 "ISSETTLED"            type double,
 "SPECIALDOWN"          type string,
 "ARTICLESHEET"         type double,
 "ARTICLEWEIGHT"        type double,
 "USERNAME"             type string,
 "JFSENDFLAG"           type double,
 "ISRECEIVED"           type string,
 "SPECIALMEMO"          type string,
 "TOPROCESSID"          type string,
 "JXLOCKED"             type string
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_JG_PROCESS_parser
TYPE rcd
SCHEMA T_ZY_JG_PROCESS_schema;

CREATE TABLE T_ZY_JG_PROCESS using T_ZY_JG_PROCESS_parser; 

create index T_ZY_JG_PROCESS_index on table T_ZY_JG_PROCESS(DEPTID);

create map PROCESSID_map on table T_ZY_JG_PROCESS
KEY (PROCESSID)
VALUE (1)
TYPE string
where OUTCARBILLTIME >= TO_DATE ('2012-07-02', '%Y-%m-%d');

create map DEPTID_map on table T_ZY_JG_PROCESS
KEY (DEPTID)
VALUE (1)
TYPE string
where OUTCARBILLTIME >= TO_DATE ('2012-07-02', '%Y-%m-%d');

create schema T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_schema
source type CSV
fields(
 "DEPTID"				type string,
 "CHANGEOWNERID"		type string,		
 "PREOWNERNO"           type string,        
 "NEWOWNERNO"			type string,        
 "PROOWNERNAME"         type string,        
 "CHANGEDATE"           type datetime,      
 "NEWOWNERNAME"			type string,
 "NETWEIGHT"			type double,        
 "GROSSWEIGHT"			type double,
 "SHEETNUM"				type double,
 "GOODSID"				type string,
 "CHANGEOWNERNO"		type string,
 "DEPTID_1"				type string
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_parser
TYPE rcd
SCHEMA T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_schema;

CREATE TABLE T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL using T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_parser; 

create index T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_index on table T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL(DEPTID);

create schema union_all_schema
source type CSV
fields(
 "GOODSID"              	type string,
 "OWNERID"             		type string,          
 "OWNERNAME"              	type string,          
 "GRADENUMXH"           	type double,          
 "SINGLESHEETNUM"           type double,          
 "NETWEIGHT"         		type double,          
 "GROSSWEIGHT"     			type double,          
 "SHEETNUM"         		type double
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER union_all_parser
TYPE rcd
SCHEMA union_all_schema;

CREATE TABLE union_all using union_all_parser; 

create index union_all_index on table union_all(OWNERID);

create schema join_1_schema
source type CSV
fields(
 "PREGOODSID"				type string,
 "OWNERID"					type string,
 "GRADENUMXH"           	type double,
 "SINGLESHEETNUM"			type double,
 "SIDEMARK"         		type string,
 "SHIPNAME"           		type string,
 "NETWEIGHT"				type double,
 "OWNERNAME"				type string,
 "GROSSWEIGHT"				type double,
 "SHEETNUM"					type double,
 "DEPTID"					type string,
 "R_RECORD_IS_DELETED"     	type double,
 "GOODSID"					type string,
 "GOODSID_1"				type string
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER join_1_parser
TYPE rcd
SCHEMA join_1_schema;

CREATE TABLE join_1 using join_1_parser; 

create index join_1_index on table join_1(OWNERID);

create statistics model join_1_model on table join_1
group by (PREGOODSID,OWNERID,SIDEMARK,SHIPNAME)
measures (sum(GRADENUMXH),sum(SINGLESHEETNUM),sum(NETWEIGHT),sum(GROSSWEIGHT),sum(SHEETNUM));

create schema join_2_schema
source type CSV
fields(
 "OWNERID"					type string,
 "OWNERNAME"				type string,
 "GRADENUMXH"           	type double,
 "SINGLESHEETNUM"			type double,
 "SIDEMARK"         		type string,
 "SHIPNAME"           		type string,
 "NETWEIGHT"				type double,
 "GROSSWEIGHT"				type double,
 "SHEETNUM"					type double,
 "PACKNUM"					type string,
 "MANAGENO"     			type string,
 "GRADENUM"					type string,
 "PREGOODSID"				type string,
 
 "GOODSLOCID"				type string,
 "DEPTID"					type string,
 "R_RECORD_IS_DELETED"		type double,
 "GOODSID"					type string,
 "KINDNAME"					type string,
 "SHOPSIGNNAME"				type string,
 "PRODAREANAME"				type string,
 "FIRSTINDATE"				type datetime
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER join_2_parser
TYPE rcd
SCHEMA join_2_schema;

CREATE TABLE join_2 using join_2_parser; 

create index join_2_index on table join_2(OWNERID);
<file_sep>/schema/T_ZY_CK_OUTPACK.sql
use db;
create schema T_ZY_CK_OUTPACK_schema 
source type CSV
fields(
 "outpackid"       type str,
 "deptid"              type str,
 "outbillno"           type str,
 "goodsid"              type str,
 "packnum"             type str,
 "barcode"             type str,
 "goodslocid"          type str,
 "ownername"          type str,
 "ownerno"              type str,
 "goodsownermanagenum"  type str,
 "goodsownerpacknum"    type str,
 "managenum"            type str,
 "inbegintime"          type datetime,
 "contractno"          type str,
 "oldgoodsstatename"   type str,
 "oldgoodsstateno"  type str,
 "goodsstatename"  type str,
 "goodsstateno"  type str,
 "goodstypename"  type str,
 "goodstype"  type str,
 "kindname"  type str,
 "kindno"  type str,
 "shopsignname"  type str,
 "shopsignid"  type str,
 "prodareaname"  type str,
 "prodareaid"  type str,
 "goodsbatchnum"  type str,
 "gradenum"  type str,
 "gradenumthick" type double,
 "gradenumwidth" type double,
 "gradenumlength" type double,
 "grossweight" type double,
 "outgrossweight" type double,
 "outnetweight" type double,
 "netweight" type double,
 "poundweight" type double,
 "checkweight" type double,
 "sheetnum" type double,
 "packtype" type double,
 "qualitymemo" type double,
 "firstinownerid" type double,
 "firstindatetime"      type datetime,
 "inbillid"  type str,
 "materialgoodsid"  type str,
 "intype"  type str,
 "memo"  type str,
 "custbill"  type str,
 "sendflag"  type double,
 "velflag"  type double,
 "r_record_create_date" type datatime,
 "r_record_create_user"type str,
 "r_record_update_date" type datetime,
 "r_record_update_user" type str,
 "r_record_is_deleted" type double,
 "foreignlistno"       type str,
 "createid"          type str,
 "creatername"         type str,
 "sidemark"            type str,
 "stocktype"           type str,
 "outbillpickownername" type str,
 "r_record_change_flag" type double,
 "incusttime"           type datetime,
 "custday"             type double,
 "sdprice"           type str,
 "outtype"           type str,
 "extsyskindid"      type str,
 "extsysshopsignid"   type str,
 "extsysgradenum"     type str,
 "prodstoveno"        type str,
 "check_type"        type str,
 "singlesheetnum"       type double,
 "singlesheet"          type double,
 "gradenumxh"           type double,
 "outbillpickownerno" type str,
 "outpassword"       type str,
 "shipno"            type str,
 "shipname"          type str,
 "shipcd"            type str,
 "shiplevel"         type str,
 "sort_emp"         type str,
 "length_product_max"   type double,
 "packtypename"       type str,
 "dbckflag"             type double,
 "dbowner"            type str,
 "dispersesheet"        type double,
 "outcarno"           type str,
 "outcusttime"  type datetime,
 "ply"  type double,
 "originoutsheetnum"  type double,
 "outsheetnum"  type double,
 "originoutnetweight"  type double,
 "issplit"  type double,
 "preforeignlistno"type str,
 "drawno" type str,
 "handno" type str,
 "saveno" type str,
 "loclv2" type str,
 "gradenumwhdw" type str,
 "optflag"  type double,
 "payedflag" type str,
 "sale_price_at"  type double,
 "price"  type double,
 "changeownertimes"  type double,
 "contract_id" type str,
 "contract_subid" type str,
 "jyzxflag"  type double,
 "outbilldatetime"      type datetime,
 "rollply"  type double,
 "readyout"  type datetime,
 "validdatetime"      type datetime,
 "lockcount"  type double default value "0",
 "loclv1"type str
 )
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "NULL";
CREATE PARSER T_ZY_CK_OUTPACK_parser
TYPE rcd
SCHEMA T_ZY_CK_OUTPACK_schema;
CREATE TABLE T_ZY_CK_OUTPACK using T_ZY_CK_OUTPACK_parser;
CREATE INDEX T_ZY_CK_OUTPACK_index ON TABLE T_ZY_CK_OUTPACK(price);<file_sep>/uncomplete/JINSHANG-78/jinshang-78.sql
SELECT
	*
FROM
	(
		SELECT
			tt10.*, '' ownername
		FROM
			(
				(
					SELECT
						ownerid,
						manageno,
						SUM (qcnetweight) qcnetweight,
						SUM (INnetweight) INnetweight,
						SUM (JGRnetweight) JGRnetweight,
						SUM (GHRnetweight) GHRnetweight,
						SUM (OUTnetweight) OUTnetweight,
						SUM (GHOnetweight) GHOnetweight,
						SUM (JGCnetweight) JGCnetweight,
						SUM (QMnetweight) QMnetweight,
						SUM (js) js,
						SUM (sheetnum) sheetnum,
						MAX (kindno) kindno,
						MAX (kindname) kindname,
						MAX (prodareaid) prodareaid,
						MAX (prodareaname) prodareaname,
						MAX (shopsignid) shopsignid,
						MAX (shopsignname) shopsignname,
						MAX (gradenum) gradenum
					FROM
						(
							(
								SELECT
									ownerid,
									manageno,
									SUM (netweight) qcnetweight,
									0 INnetweight,
									0 JGRnetweight,
									0 GHRnetweight,
									0 OUTnetweight,
									0 GHOnetweight,
									0 JGCnetweight,
									0 QMnetweight,
									0 js,
									0 sheetnum,
									MAX (kindno) kindno,
									MAX (kindname) kindname,
									MAX (prodareaid) prodareaid,
									MAX (prodareaname) prodareaname,
									MAX (shopsignid) shopsignid,
									MAX (shopsignname) shopsignname,
									MAX (gradenum) gradenum
								FROM
									(
										SELECT
											ownerid,
											'' ownername,
											manageno,
											SUM (netweight) netweight,
											MAX (kindno) kindno,
											MAX (kindname) kindname,
											MAX (prodareaid) prodareaid,
											MAX (prodareaname) prodareaname,
											MAX (shopsignid) shopsignid,
											MAX (shopsignname) shopsignname,
											MAX (gradenum) gradenum
										FROM
											T_GG_SJ_Goods
										WHERE
											goodsstateno = '20'
										AND deptid = '0301'
										GROUP BY
											ownerid,
											manageno
										UNION ALL
											SELECT
												ownerid,
												'' ownername,
												manageno ,- SUM (netweight) netweight,
												MAX (kindno) kindno,
												MAX (kindname) kindname,
												MAX (prodareaid) prodareaid,
												MAX (prodareaname) prodareaname,
												MAX (shopsignid) shopsignid,
												MAX (shopsignname) shopsignname,
												MAX (gradenum) gradenum
											FROM
												T_ZY_RK_InBillDetail
											WHERE
												deptid = '0301'
											AND (goodsstateno = '20')
											AND firstindate < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
											AND firstindate >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
											GROUP BY
												ownerid,
												manageno
											UNION ALL
												SELECT
													ownerid,
													'' ownername,
													manageno ,- SUM (netweight) netweight,
													MAX (kindno) kindno,
													MAX (kindname) kindname,
													MAX (prodareaid) prodareaid,
													MAX (prodareaname) prodareaname,
													MAX (shopsignid) shopsignid,
													MAX (shopsignname) shopsignname,
													MAX (gradenum) gradenum
												FROM
													T_ZY_JG_ProcArticleDtl
												WHERE
													deptid = '0301'
												AND firstindate < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
												AND firstindate >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
												AND goodsstateno = '130'
												GROUP BY
													ownerid,
													manageno
												UNION ALL
													SELECT
														newownerno aownerid,
														newownername ownername,
														managenum manageno ,- SUM (netweight) netweight,
														MAX (kindno) kindno,
														MAX (kindname) kindname,
														MAX (prodareaid) prodareaid,
														MAX (prodareaname) prodareaname,
														MAX (shopsignid) shopsignid,
														MAX (shopsignname) shopsignname,
														MAX (gradenum) gradenum
													FROM
														(
															SELECT
																A .newownerno,
																A .newownername,
																(
																	CASE
																	WHEN (
																		managenum IS NULL
																		OR managenum = ''
																	) THEN
																		premanagenum
																	ELSE
																		managenum
																	END
																) managenum,
																b.shopsignid,
																b.shopsignname,
																b.prodareaid,
																b.prodareaname,
																b.gradenum,
																b.netweight,
																b.kindname,
																b.kindno
															FROM
																(
																	SELECT
																		deptid,
																		ChangeOwnerID,
																		newownerno,
																		'' newownername
																	FROM
																		T_ZY_GH_ChangeOwnerList
																	WHERE
																		DeptID = '0301'
																	AND ChangeDate < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
																	AND changedate >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
																) A
															LEFT JOIN T_ZY_GH_ChangeOwnerDetail b ON A .changeownerid = b.changeownerno
															AND A .deptid = b.deptid
														) tb1
													GROUP BY
														newownerno,
														newownername,
														managenum
													UNION ALL
														SELECT
															ownerno,
															'' ownername,
															managenum,
															SUM (netweight) netweight,
															MAX (kindno) kindno,
															MAX (kindname) kindname,
															MAX (prodareaid) prodareaid,
															MAX (prodareaname) prodareaname,
															MAX (shopsignid) shopsignid,
															MAX (shopsignname) shopsignname,
															MAX (gradenum) gradenum
														FROM
															T_ZY_CK_OutPack
														WHERE
															deptid = '0301'
														AND OutCustTime >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
														AND OutCustTime < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
														GROUP BY
															ownerno,
															managenum
														UNION ALL
															SELECT
																ownerid,
																'' ownername,
																manageno,
																SUM (netweight) anetweight,
																MAX (kindno) kindno,
																MAX (kindname) kindname,
																MAX (prodareaid) prodareaid,
																MAX (prodareaname) prodareaname,
																MAX (shopsignid) shopsignid,
																MAX (shopsignname) shopsignname,
																MAX (gradenum) gradenum
															FROM
																T_ZY_JG_ProcMaterialDtl
															WHERE
																deptid = '0301'
															AND EXISTS (
																SELECT
																	1
																FROM
																	T_ZY_JG_PROCESS
																WHERE
																	ProcessID = T_ZY_JG_ProcMaterialDtl.ProcessID
																AND deptid = T_ZY_JG_ProcMaterialDtl.deptid
																AND OutCarBillTime >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
																AND OutCarBillTime < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
															)
															GROUP BY
																ownerid,
																manageno
															UNION ALL
																SELECT
																	preownerno,
																	proownername,
																	premanagenum,
																	SUM (netweight) anetweight,
																	MAX (kindno) kindno,
																	MAX (kindname) kindname,
																	MAX (prodareaid) prodareaid,
																	MAX (prodareaname) prodareaname,
																	MAX (shopsignid) shopsignid,
																	MAX (shopsignname) shopsignname,
																	MAX (gradenum) gradenum
																FROM
																	(
																		SELECT
																			A .preownerno,
																			A .proownername,
																			b.premanagenum,
																			b.netweight,
																			b.gradenum,
																			b.shopsignname,
																			b.shopsignid,
																			b.prodareaname,
																			b.prodareaid,
																			b.kindno,
																			b.kindname
																		FROM
																			(
																				SELECT
																					deptid,
																					ChangeOwnerID,
																					preownerno,
																					'' proownername
																				FROM
																					T_ZY_GH_ChangeOwnerList
																				WHERE
																					DeptID = '0301'
																				AND ChangeDate < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
																				AND changedate >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
																			) A
																		LEFT JOIN T_ZY_GH_ChangeOwnerDetail b ON A .changeownerid = b.changeownerno
																		AND A .deptid = b.deptid
																	) tb1
																GROUP BY
																	preownerno,
																	proownername,
																	premanagenum
									) tbx
								GROUP BY
									ownerid,
									ownername,
									manageno
							)
							UNION ALL
								(
									SELECT
										ownerid,
										manageno,
										0 qcnetweight,
										SUM (netweight) INnetweight,
										0 JGRnetweight,
										0 GHRnetweight,
										0 OUTnetweight,
										0 GHOnetweight,
										0 JGCnetweight,
										0 QMnetweight,
										0 js,
										0 sheetnum,
										MAX (kindno) kindno,
										MAX (kindname) kindname,
										MAX (prodareaid) prodareaid,
										MAX (prodareaname) prodareaname,
										MAX (shopsignid) shopsignid,
										MAX (shopsignname) shopsignname,
										MAX (gradenum) gradenum
									FROM
										T_ZY_RK_InBillDetail
									WHERE
										deptid = '0301'
									AND goodsstateno = '20'
									AND firstindate < TO_DATE ('2015/8/1', 'yyyy-mm-dd')
									AND firstindate >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
									GROUP BY
										ownerid,
										manageno
								)
							UNION ALL
								(
									SELECT
										ownerid,
										manageno,
										0 qcnetweight,
										0 INnetweight,
										SUM (netweight) JGRnetweight,
										0 GHRnetweight,
										0 OUTnetweight,
										0 GHOnetweight,
										0 JGCnetweight,
										0 QMnetweight,
										0 js,
										0 sheetnum,
										MAX (kindno) kindno,
										MAX (kindname) kindname,
										MAX (prodareaid) prodareaid,
										MAX (prodareaname) prodareaname,
										MAX (shopsignid) shopsignid,
										MAX (shopsignname) shopsignname,
										MAX (gradenum) gradenum
									FROM
										T_ZY_JG_ProcArticleDtl
									WHERE
										deptid = '0301'
									AND firstindate <= TO_DATE ('2015/8/1', 'yyyy-mm-dd')
									AND firstindate >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
									AND goodsstateno = '130'
									GROUP BY
										ownerid,
										manageno
								)
							UNION ALL
								(
									SELECT
										newownerno ownerid,
										managenum manageno,
										0 qcnetweight,
										0 INnetweight,
										0 JGRnetweight,
										SUM (netweight) GHRnetweight,
										0 OUTnetweight,
										0 GHOnetweight,
										0 JGCnetweight,
										0 QMnetweight,
										0 js,
										0 sheetnum,
										MAX (kindno) kindno,
										MAX (kindname) kindname,
										MAX (prodareaid) prodareaid,
										MAX (prodareaname) prodareaname,
										MAX (shopsignid) shopsignid,
										MAX (shopsignname) shopsignname,
										MAX (gradenum) gradenum
									FROM
										(
											SELECT
												A .newownerno,
												A .newownername,
												(
													CASE
													WHEN (
														managenum IS NULL
														OR managenum = ''
													) THEN
														premanagenum
													ELSE
														managenum
													END
												) managenum,
												b.shopsignid,
												b.shopsignname,
												b.prodareaid,
												b.prodareaname,
												b.gradenum,
												b.netweight,
												b.kindno,
												b.kindname
											FROM
												(
													SELECT
														deptid,
														ChangeOwnerID,
														newownerno,
														'' newownername
													FROM
														T_ZY_GH_ChangeOwnerList
													WHERE
														DeptID = '0301'
													AND ChangeDate >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
													AND changedate < TO_DATE ('2015/8/1', 'yyyy-mm-dd')
												) A
											LEFT JOIN T_ZY_GH_ChangeOwnerDetail b ON A .changeownerid = b.changeownerno
											AND A .deptid = b.deptid
										) tb1
									GROUP BY
										newownerno,
										newownername,
										managenum
								)
							UNION ALL
								(
									SELECT
										ownerno ownerid,
										managenum manageno,
										0 qcnetweight,
										0 INnetweight,
										0 JGRnetweight,
										0 GHRnetweight,
										SUM (netweight) OUTnetweight,
										0 GHOnetweight,
										0 JGCnetweight,
										0 QMnetweight,
										0 js,
										0 sheetnum,
										MAX (kindno) kindno,
										MAX (kindname) kindname,
										MAX (prodareaid) prodareaid,
										MAX (prodareaname) prodareaname,
										MAX (shopsignid) shopsignid,
										MAX (shopsignname) shopsignname,
										MAX (gradenum) gradenum
									FROM
										T_ZY_CK_OutPack
									WHERE
										deptid = '0301'
									AND OutCustTime >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
									AND OutCustTime < TO_DATE ('2015/8/1', 'yyyy-mm-dd')
									GROUP BY
										ownerno,
										managenum
								)
							UNION ALL
								(
									SELECT
										PREOWNERNO ownerid,
										managenum manageno,
										0 qcnetweight,
										0 INnetweight,
										0 JGRnetweight,
										0 GHRnetweight,
										0 OUTnetweight,
										SUM (netweight) GHOnetweight,
										0 JGCnetweight,
										0 QMnetweight,
										0 js,
										0 sheetnum,
										MAX (kindno) kindno,
										MAX (kindname) kindname,
										MAX (prodareaid) prodareaid,
										MAX (prodareaname) prodareaname,
										MAX (shopsignid) shopsignid,
										MAX (shopsignname) shopsignname,
										MAX (gradenum) gradenum
									FROM
										(
											SELECT
												A .PREOWNERNO,
												A .PRoOWNERName,
												(
													CASE
													WHEN (
														premanagenum IS NULL
														OR premanagenum = ''
													) THEN
														managenum
													ELSE
														premanagenum
													END
												) managenum,
												b.netweight,
												b.gradenum,
												b.shopsignname,
												b.shopsignid,
												b.kindname,
												b.kindno,
												b.prodareaname,
												b.prodareaid
											FROM
												(
													SELECT
														deptid,
														ChangeOwnerID,
														PReOWNERNO,
														'' PRoOWNERName
													FROM
														T_ZY_GH_ChangeOwnerList
													WHERE
														DeptID = '0301'
													AND changedate < TO_DATE ('2015/8/1', 'yyyy-mm-dd')
													AND changedate >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
												) A
											LEFT JOIN T_ZY_GH_ChangeOwnerDetail b ON A .changeownerid = b.changeownerno
											AND A .deptid = b.deptid
										) tb1
									GROUP BY
										PREOWNERNO,
										PRoOWNERName,
										managenum
								)
							UNION ALL
								(
									SELECT
										ownerid,
										manageno,
										0 qcnetweight,
										0 INnetweight,
										0 JGRnetweight,
										0 GHRnetweight,
										0 OUTnetweight,
										0 GHOnetweight,
										SUM (netweight) JGCnetweight,
										0 QMnetweight,
										0 js,
										0 sheetnum,
										MAX (kindno) kindno,
										MAX (kindname) kindname,
										MAX (prodareaid) prodareaid,
										MAX (prodareaname) prodareaname,
										MAX (shopsignid) shopsignid,
										MAX (shopsignname) shopsignname,
										MAX (gradenum) gradenum
									FROM
										T_ZY_JG_ProcMaterialDtl
									WHERE
										deptid = '0301'
									AND EXISTS (
										SELECT
											1
										FROM
											T_ZY_JG_PROCESS
										WHERE
											ProcessID = T_ZY_JG_ProcMaterialDtl.ProcessID
										AND deptid = T_ZY_JG_ProcMaterialDtl.deptid
										AND OutCarBillTime >= TO_DATE ('2015/7/1', 'yyyy-mm-dd')
										AND OutCarBillTime < TO_DATE ('2015/8/1', 'yyyy-mm-dd')
									)
									GROUP BY
										ownerid,
										manageno
								)
							UNION ALL
								(
									SELECT
										ownerid,
										manageno,
										0 qcnetweight,
										0 INnetweight,
										0 JGRnetweight,
										0 GHRnetweight,
										0 OUTnetweight,
										0 GHOnetweight,
										0 JGCnetweight,
										SUM (netweight) QMnetweight,
										SUM (js) js,
										SUM (sheetnum) sheetnum,
										MAX (kindno) kindno,
										MAX (kindname) kindname,
										MAX (prodareaid) prodareaid,
										MAX (prodareaname) prodareaname,
										MAX (shopsignid) shopsignid,
										MAX (shopsignname) shopsignname,
										MAX (gradenum) gradenum
									FROM
										(
											SELECT
												ownerid,
												'' ownername,
												manageno,
												SUM (netweight) netweight,
												COUNT js,
												SUM (sheetnum) sheetnum,
												MAX (kindno) kindno,
												MAX (kindname) kindname,
												MAX (prodareaid) prodareaid,
												MAX (prodareaname) prodareaname,
												MAX (shopsignid) shopsignid,
												MAX (shopsignname) shopsignname,
												MAX (gradenum) gradenum
											FROM
												T_GG_SJ_Goods
											WHERE
												goodsstateno = '20'
											AND deptid = '0301'
											GROUP BY
												ownerid,
												manageno
											UNION ALL
												SELECT
													ownerid,
													'' ownername,
													manageno ,- SUM (netweight) netweight ,- COUNT js ,- SUM (sheetnum) sheetnum,
													MAX (kindno) kindno,
													MAX (kindname) kindname,
													MAX (prodareaid) prodareaid,
													MAX (prodareaname) prodareaname,
													MAX (shopsignid) shopsignid,
													MAX (shopsignname) shopsignname,
													MAX (gradenum) gradenum
												FROM
													T_ZY_RK_InBillDetail
												WHERE
													deptid = '0301'
												AND (goodsstateno = '20')
												AND firstindate < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
												AND firstindate >= TO_DATE ('2015/8/1', 'yyyy-mm-dd')
												GROUP BY
													ownerid,
													manageno
												UNION ALL
													SELECT
														ownerid,
														'' ownername,
														manageno ,- SUM (netweight) netweight ,- COUNT js ,- SUM (sheetnum) sheetnum,
														MAX (kindno) kindno,
														MAX (kindname) kindname,
														MAX (prodareaid) prodareaid,
														MAX (prodareaname) prodareaname,
														MAX (shopsignid) shopsignid,
														MAX (shopsignname) shopsignname,
														MAX (gradenum) gradenum
													FROM
														T_ZY_JG_ProcArticleDtl
													WHERE
														deptid = '0301'
													AND firstindate < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
													AND firstindate >= TO_DATE ('2015/8/1', 'yyyy-mm-dd')
													AND goodsstateno = '130'
													GROUP BY
														ownerid,
														manageno
													UNION ALL
														SELECT
															newownerno ownerid,
															newownername ownername,
															managenum manageno ,- SUM (netweight) netweight,
															- COUNT js ,- SUM (sheetnum) sheetnum,
															MAX (kindno) kindno,
															MAX (kindname) kindname,
															MAX (prodareaid) prodareaid,
															MAX (prodareaname) prodareaname,
															MAX (shopsignid) shopsignid,
															MAX (shopsignname) shopsignname,
															MAX (gradenum) gradenum
														FROM
															(
																SELECT
																	A .newownerno,
																	A .newownername,
																	(
																		CASE
																		WHEN (
																			managenum IS NULL
																			OR managenum = ''
																		) THEN
																			premanagenum
																		ELSE
																			managenum
																		END
																	) managenum,
																	b.netweight,
																	b.sheetnum,
																	b.gradenum,
																	b.shopsignname,
																	b.shopsignid,
																	b.kindname,
																	b.kindno,
																	b.prodareaname,
																	b.prodareaid
																FROM
																	(
																		SELECT
																			deptid,
																			ChangeOwnerID,
																			newownerno,
																			'' newownername
																		FROM
																			T_ZY_GH_ChangeOwnerList
																		WHERE
																			DeptID = '0301'
																		AND ChangeDate < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
																		AND changedate >= TO_DATE ('2015/8/1', 'yyyy-mm-dd')
																	) A
																LEFT JOIN T_ZY_GH_ChangeOwnerDetail b ON A .changeownerid = b.changeownerno
																AND A .deptid = b.deptid
															) tb1
														GROUP BY
															newownerno,
															newownername,
															managenum
														UNION ALL
															SELECT
																ownerno,
																'' ownername,
																managenum,
																SUM (netweight) netweight,
																COUNT js,
																SUM (sheetnum) sheetnum,
																MAX (kindno) kindno,
																MAX (kindname) kindname,
																MAX (prodareaid) prodareaid,
																MAX (prodareaname) prodareaname,
																MAX (shopsignid) shopsignid,
																MAX (shopsignname) shopsignname,
																MAX (gradenum) gradenum
															FROM
																T_ZY_CK_OutPack
															WHERE
																deptid = '0301'
															AND OutCustTime >= TO_DATE ('2015/8/1', 'yyyy-mm-dd')
															AND OutCustTime < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
															GROUP BY
																ownerno,
																managenum
															UNION ALL
																SELECT
																	ownerid,
																	'' ownername,
																	manageno,
																	SUM (netweight) netweight,
																	COUNT js,
																	SUM (sheetnum) sheetnum,
																	MAX (kindno) kindno,
																	MAX (kindname) kindname,
																	MAX (prodareaid) prodareaid,
																	MAX (prodareaname) prodareaname,
																	MAX (shopsignid) shopsignid,
																	MAX (shopsignname) shopsignname,
																	MAX (gradenum) gradenum
																FROM
																	T_ZY_JG_ProcMaterialDtl
																WHERE
																	deptid = '0301'
																AND EXISTS (
																	SELECT
																		1
																	FROM
																		T_ZY_JG_PROCESS
																	WHERE
																		ProcessID = T_ZY_JG_ProcMaterialDtl.ProcessID
																	AND deptid = T_ZY_JG_ProcMaterialDtl.deptid
																	AND OutCarBillTime >= TO_DATE ('2015/8/1', 'yyyy-mm-dd')
																	AND OutCarBillTime < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
																)
																GROUP BY
																	ownerid,
																	manageno
																UNION ALL
																	SELECT
																		preownerno,
																		proownername,
																		premanagenum,
																		SUM (netweight) netweight,
																		COUNT js,
																		SUM (sheetnum) sheetnum,
																		MAX (kindno) kindno,
																		MAX (kindname) kindname,
																		MAX (prodareaid) prodareaid,
																		MAX (prodareaname) prodareaname,
																		MAX (shopsignid) shopsignid,
																		MAX (shopsignname) shopsignname,
																		MAX (gradenum) gradenum
																	FROM
																		(
																			SELECT
																				A .preownerno,
																				A .proownername,
																				b.premanagenum,
																				b.netweight,
																				b.sheetnum,
																				b.gradenum,
																				b.shopsignname,
																				b.shopsignid,
																				b.kindno,
																				b.kindname,
																				b.prodareaname,
																				b.prodareaid
																			FROM
																				(
																					SELECT
																						deptid,
																						ChangeOwnerID,
																						preownerno,
																						'' proownername
																					FROM
																						T_ZY_GH_ChangeOwnerList
																					WHERE
																						DeptID = '0301'
																					AND ChangeDate < TO_DATE ('2015/8/4', 'yyyy-mm-dd')
																					AND changedate >= TO_DATE ('2015/8/1', 'yyyy-mm-dd')
																				) A
																			LEFT JOIN T_ZY_GH_ChangeOwnerDetail b ON A .changeownerid = b.changeownerno
																			AND A .deptid = b.deptid
																		) tb1
																	GROUP BY
																		preownerno,
																		proownername,
																		premanagenum
										) tbx
									GROUP BY
										ownerid,
										ownername,
										manageno
								)
						)
					GROUP BY
						ownerid,
						manageno
				) tt10
			)
	) tt30
WHERE
	ownerid IS NOT NULL
AND NOT (
	qcnetweight = 0
	AND INnetweight = 0
	AND JGRnetweight = 0
	AND GHRnetweight = 0
	AND OUTnetweight = 0
	AND GHOnetweight = 0
	AND JGCnetweight = 0
	AND QMnetweight = 0
	AND js = 0
	AND sheetnum = 0
)
AND ownerid = 'KH00001'
AND manageno = 'M'
ORDER BY
	ownerid,
	manageno;

<file_sep>/uncomplete/JINSHANG-72/jinshang-72.sql
SELECT *
FROM
  (SELECT rownum AS rownum_,
          aa.*
   FROM
     (SELECT /*+ index(g,T_GG_SJ_GOODS_INDX02) */ nvl(DEPTID, 'null') AS DEPTID,

        (SELECT deptname
         FROM wmsdba.t_common_dept d
         WHERE d.deptid = g.deptid) AS DEPTNAME,
                                                  nvl(GRADENUM, 'null') AS GRADENUM,
                                                  nvl(SHOPSIGNID, 'null') AS SHOPSIGNID,
                                                  nvl(SHOPSIGNNAME, 'null') AS SHOPSIGNNAME,
                                                  nvl(PRODAREAID, 'null') AS PRODAREAID,
                                                  nvl(PRODAREANAME, 'null') AS PRODAREANAME,
                                                  nvl(KINDNO, 'null') AS KINDNO,
                                                  nvl(KINDNAME, 'null') AS KINDNAME,
                                                  nvl(ownername, 'null') AS OWNERSHORT,
                                                  nvl(GOODSOWNERPACKNO, 'null') AS GOODSOWNERPACKNO,
                                                  nvl(SUM(NETWEIGHT), 0) AS NETWEIGHT,
                                                  nvl(SUM(GROSSWEIGHT), 0) AS GROSSWEIGHT,
                                                  nvl(SUM(SHEETNUM), 0) AS SHEETNUM
      FROM wmsdba.t_gg_sj_goods g,
           ST.T_XTSZ_BIND b
      WHERE 1 = 1
        AND g.deptid = b.dept_id
        AND g.ownerid = b.owner_id
        AND b.alive_flag = '1'
        AND b.seg_no = '080001'
        AND goodsstateno = '20'
        AND KINDNAME LIKE '%' ||'²»Ðâ¸Ö'|| '%'
        AND SHOPSIGNNAME LIKE '%'|| 'spcd'|| '%'
        AND GRADENUM LIKE '%' ||'11*11*11'|| '%'
        AND PRODAREANAME LIKE '%'||'°ÍÎ÷'|| '%'
        AND GOODSOWNERPACKNO LIKE '%' ||'123'|| '%'
        AND FIRSTINDATE >= to_date('2015-07-16', 'yyyy-MM-dd')
        AND FIRSTINDATE < to_date('2015-07-16', 'yyyy-MM-dd') + 1
      GROUP BY g.deptid,
               GRADENUM,
               SHOPSIGNID,
               SHOPSIGNNAME,
               PRODAREAID,
               PRODAREANAME,
               KINDNO,
               KINDNAME,
               ownername,
               GOODSOWNERPACKNO) aa)
WHERE rownum_ > 0
  AND rownum_ <= 10<file_sep>/uncomplete/JINSHANG-100/2_init.sql

create job 1_job(1)
begin
dataset file T_ZY_CK_CLEAR_1_dataset
(
	schema: "T_ZY_CK_CLEAR_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_CK_CLEAR.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc index T_ZY_CK_CLEAR_index
(
 inputs:T_ZY_CK_CLEAR_1_dataset,
 table:T_ZY_CK_CLEAR
 );
 
dataproc doc T_ZY_CK_CLEAR_doc
(  
   inputs:T_ZY_CK_CLEAR_1_dataset,
   table:T_ZY_CK_CLEAR
);

   dataproc map T_ZY_CK_CLEAR_1_map
(  
   inputs:T_ZY_CK_CLEAR_1_dataset,
   table:T_ZY_CK_CLEAR
);
end;
run job 1_job (threads:8);

create job 2_job(1)
begin
dataset file T_ZY_JG_PROCESS_1_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCESS.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc index P_index
(
 inputs:T_ZY_JG_PROCESS_1_dataset,
 table:T_ZY_JG_PROCESS
 );
 
dataproc doc P_doc
(  
   inputs:T_ZY_JG_PROCESS_1_dataset,
   table:T_ZY_JG_PROCESS
);

   dataproc map P_1_map
(  
   inputs:T_ZY_JG_PROCESS_1_dataset,
   table:T_ZY_JG_PROCESS
);
end;
run job 2_job (threads:8);

create job 3_job(3)
begin
dataset file T_GG_SJ_GOODS_dataset
(
	schema: "T_GG_SJ_GOODS_schema",
    filename: "/home/zhaoshun/Data/jinshang_New/T_GG_SJ_GOODS.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_RK_INBILLDETAIL_dataset
(
	schema: T_ZY_RK_INBILLDETAIL_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_RK_INBILLDETAIL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_JG_PROCARTICLEDTL_dataset
(
	schema: T_ZY_JG_PROCARTICLEDTL_schema,
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCARTICLEDTL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_GH_CHANGEOWNERLIST_dataset
(
	schema: T_ZY_GH_CHANGEOWNERLIST_schema,
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_GH_CHANGEOWNERLIST.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_GH_CHANGEOWNERDETAIL_dataset
(
	schema: T_ZY_GH_CHANGEOWNERDETAIL_schema,
    filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_GH_CHANGEOWNERDETAIL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_CK_OUTPACK_dataset
(
	schema: T_ZY_CK_OUTPACK_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_CK_OUTPACK.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_JG_PROCMATERIALDTL_dataset
(
	schema: T_ZY_JG_PROCMATERIALDTL_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCMATERIALDTL.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_CK_CLEAR_dataset
(
	schema: T_ZY_CK_CLEAR_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_CK_CLEAR.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataset file T_ZY_JG_PROCESS_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/zhaoshun/Data/jinshang_New/T_ZY_JG_PROCESS.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_select
(
	fields: 
	 (
       (fname:"DEPTID"),
       (fname:"CHANGEOWNERID"),
       (fname:"NEWOWNERNO"),
       (fname:"NEWOWNERNAME"),
	   (fname:"PREOWNERNO"),
	   (fname:"PROOWNERNAME"),
	   (fname:"CHANGEDATE")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_dataset",
	 order_by:("DEPTID","CHANGEOWNERID"),
	 conditions:"DEPTID = '101'
	AND CHANGEDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')"
);

dataproc select T_ZY_GH_CHANGEOWNERDETAIL_select
(
	fields: 
	 (
		(fname:"GOODSID"),
		(fname:"NETWEIGHT"),
		(fname:"GROSSWEIGHT"),
		(fname:"SHEETNUM"),
		(fname:"CHANGEOWNERNO"),
		(fname:"DEPTID",alias:"DEPTID_1",type:"string")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERDETAIL_dataset",
	 order_by:("DEPTID_1","CHANGEOWNERNO")
);

dataproc join T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join
(
	inputs:
		(left_input:T_ZY_GH_CHANGEOWNERLIST_select,right_input:T_ZY_GH_CHANGEOWNERDETAIL_select),
	join_keys:
	(
		("left_input.DEPTID","right_input.DEPTID_1"),
		("left_input.CHANGEOWNERID","right_input.CHANGEOWNERNO")
	)
);

dataproc index T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_index
(
 inputs:T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join,
 table:T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL
 );
 
dataproc doc T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_doc
(
   inputs:T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join,
   table:T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL,
   format:T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_parser,
   fields:("DEPTID","CHANGEOWNERID","PREOWNERNO","NEWOWNERNO","PROOWNERNAME","CHANGEDATE","NEWOWNERNAME","NETWEIGHT","GROSSWEIGHT","SHEETNUM","GOODSID","CHANGEOWNERNO","DEPTID_1")
);



dataproc select T_GG_SJ_GOODS_select
(
	 fields: 
	 (
       (fname:"GOODSID"),
       (fname:"OWNERID"),
	   (fname:"OWNERNAME"),
       (fname:"GRADENUMXH"),
	   (fname:"SINGLESHEETNUM"),
	   (fname:"NETWEIGHT"),
       (fname:"GROSSWEIGHT"),
       (fname:"SHEETNUM")
	 ),
	 inputs: "T_GG_SJ_GOODS_dataset",
	 conditions:"GOODSSTATENO = '110'
		AND R_RECORD_IS_DELETED = 0
		AND DEPTID = '101'",
	 order_by:("GOODSID")	 
);

dataproc select T_ZY_RK_INBILLDETAIL_select
(
	 fields: 
	 (
       (fname:"GOODSID"),
       (fname:"OWNERID"),
	   (fname:"OWNERNAME"),
       (fname:"GRADENUMXH"),
	   (fname:"SINGLESHEETNUM"),
	   (fname:"NETWEIGHT"),
       (fname:"GROSSWEIGHT"),
       (fname:"SHEETNUM")
	 ),
	 inputs: "T_ZY_RK_INBILLDETAIL_dataset",
	 conditions:"DEPTID = '101'
		AND GOODSSTATENO = '110'
		AND FIRSTINDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	  order_by:("GOODSID")
);

dataproc select T_ZY_JG_PROCARTICLEDTL_select
(
	 fields: 
	 (
       (fname:"PROCARTICLEDTLID"),
       (fname:"OWNERID"),
	   (fname:"OWNERNAME"),
       (fname:"\'0\'",alias:"GRADENUMXH",type:"double"),
	   (fname:"\'0\'",alias:"SINGLESHEETNUM",type:"double"),
	   (fname:"NETWEIGHT"),
       (fname:"GROSSWEIGHT"),
       (fname:"SHEETNUM")
	 ),
	 inputs: "T_ZY_JG_PROCARTICLEDTL_dataset",
	 conditions:"DEPTID = '101'
		AND FIRSTINDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')
		AND GOODSSTATENO = '130'",
	 order_by:("OWNERID")
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_select
(
	 fields: 
	 (
       (fname:"GOODSID"),
       (fname:"NEWOWNERNO",alias:"OWNERID",type:"string"),
       (fname:"NEWOWNERNAME",alias:"OWNERNAME",type:"string"),
       (fname:"\'0\'",alias:"GRADENUMXH",type:"double"),
	   (fname:"\'0\'",alias:"SINGLESHEETNUM",type:"double"),
	   (fname:"NETWEIGHT"),
       (fname:"GROSSWEIGHT"),
       (fname:"SHEETNUM")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join",
	 order_by:("GOODSID")
);

dataproc select T_ZY_CK_OUTPACK_select
(
	 fields: 
	 (
       (fname:"GOODSID"),
       (fname:"OWNERNO"),
	   (fname:"OWNERNAME"),
       (fname:"GRADENUMXH"),
	   (fname:"SINGLESHEETNUM"),
	   (fname:"NETWEIGHT"),
       (fname:"GROSSWEIGHT"),
       (fname:"SHEETNUM")
	 ),
	 inputs: "T_ZY_CK_OUTPACK_dataset",
	 conditions:"DEPTID = '101'
		AND OUTCUSTTIME >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	order_by:("GOODSID")
);

dataproc select T_GG_SJ_GOODS_2_select
(
	 fields: 
	 (
       (fname:"GOODSID"),
       (fname:"OWNERID"),
	   (fname:"OWNERNAME"),
       (fname:"GRADENUMXH"),
	   (fname:"SINGLESHEETNUM"),
	   (fname:"NETWEIGHT"),
       (fname:"GROSSWEIGHT"),
       (fname:"SHEETNUM")
	 ),
	 inputs: "T_GG_SJ_GOODS_dataset",
	 conditions:"CREATDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	 order_by:("GOODSID")
);

dataproc select T_ZY_JG_PROCMATERIALDTL_select
(
	 fields: 
	 (
       (fname:"GOODSID"),
       (fname:"OWNERID"),
	   (fname:"OWNERNAME"),
       (fname:"\'0\'",alias:"GRADENUMXH",type:"double"),
	   (fname:"\'0\'",alias:"SINGLESHEETNUM",type:"double"),
	   (fname:"NETWEIGHT"),
       (fname:"GROSSWEIGHT"),
       (fname:"SHEETNUM")
	 ),
	 inputs: "T_ZY_JG_PROCMATERIALDTL_dataset",
	 conditions:"vf_PROCESSID = 1
	   and vf_DEPTID = 1 ",
	 order_by:("GOODSID")
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_1_select
(
	 fields: 
	 (
       (fname:"GOODSID"),
       (fname:"PREOWNERNO",alias:"OWNERID",type:"string"),
       (fname:"PROOWNERNAME",alias:"OWNERNAME",type:"string"),
       (fname:"\'0\'",alias:"GRADENUMXH",type:"double"),
	   (fname:"\'0\'",alias:"SINGLESHEETNUM",type:"double"),
	   (fname:"NETWEIGHT"),
       (fname:"GROSSWEIGHT"),
       (fname:"SHEETNUM")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join",
	order_by:("GOODSID")
);

dataproc union 1_union
(
    inputs:("T_GG_SJ_GOODS_select","T_ZY_RK_INBILLDETAIL_select","T_ZY_JG_PROCARTICLEDTL_select","T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_select","T_ZY_CK_OUTPACK_select","T_GG_SJ_GOODS_2_select","T_ZY_JG_PROCMATERIALDTL_select","T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_1_select")
);

dataproc select T_GG_SJ_GOODS_3_select
(
	fields:
	(
		(fname:"PREGOODSID"),
		(fname:"SIDEMARK"),
		(fname:"SHIPNAME"),
		(fname:"R_RECORD_IS_DELETED"),
		(fname:"DEPTID"),
		(fname:"GOODSID",alias:"GOODSID_1",type:"string")
	),
	inputs:"T_GG_SJ_GOODS_dataset",
	conditions:"DEPTID = '101'
	   and R_RECORD_IS_DELETED = 0 ",
	order_by:("GOODSID_1")
);

dataproc select 1_union_select
(
	fields:
	(
		(fname:"OWNERID"),
		(fname:"OWNERNAME"),
		(fname:"GRADENUMXH"),
		(fname:"SINGLESHEETNUM"),
		(fname:"NETWEIGHT"),
		(fname:"GROSSWEIGHT"),
		(fname:"SHEETNUM"),
		(fname:"GOODSID")
	),
	inputs:"1_union",
	order_by:("GOODSID")
);

dataproc leftjoin T_GG_SJ_GOODS_3_1_union_join
(
	inputs:
		(left_input:T_GG_SJ_GOODS_3_select,right_input:1_union_select),
	join_keys:
	(
		("left_input.GOODSID_1","right_input.GOODSID")
	)
);

dataproc select leftjoin_select
(
	fields: 
	 (
       (fname:"PREGOODSID"),
       (fname:"OWNERID"),
	   (fname:"OWNERNAME"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
	   (fname:"SIDEMARK",alias:"SIDEMARK",type:"string"),
	   (fname:"SHIPNAME",alias:"SHIPNAME",type:"string"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_GG_SJ_GOODS_3_1_union_join",
	 group_by:(PREGOODSID,OWNERID,SIDEMARK,SHIPNAME)
);

dataproc select leftjoin_1_select
(
	fields: 
	 (
       (fname:"PREGOODSID"),
       (fname:"OWNERID"),
	   (fname:"OWNERNAME"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
	   (fname:"SIDEMARK",alias:"SIDEMARK",type:"string"),
	   (fname:"SHIPNAME",alias:"SHIPNAME",type:"string"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_GG_SJ_GOODS_3_1_union_join",
	 group_by:(PREGOODSID,OWNERID,SIDEMARK,SHIPNAME)
);


dataproc statistics union_all_statistics
(
  inputs:leftjoin_select,
  table:join_1
);

dataproc select T_GG_SJ_GOODS_4_select
(
	fields:
	(
		(fname:"GOODSLOCID"),
		(fname:"DEPTID"),
		(fname:"R_RECORD_IS_DELETED"),
		(fname:"GOODSID",type:"string"),
		(fname:"KINDNAME"),
		(fname:"SHOPSIGNNAME"),
		(fname:"PRODAREANAME"),
		(fname:"FIRSTINDATE"),
		(fname:"PACKNUM"),
		(fname:"GRADENUM"),  
		(fname:"MANAGENO")
	),
	inputs:"T_GG_SJ_GOODS_dataset",
	conditions:"DEPTID = '101'
	   and R_RECORD_IS_DELETED = 0 ",
	order_by:("GOODSID")
);

dataproc select leftjoin_2_select
(
	fields:
	(
		(fname:"OWNERID"),
		(fname:"\'0\'",alias:"OWNERNAME",type:"string"),
		(fname:"GRADENUMXH"),
		(fname:"SINGLESHEETNUM"),
		(fname:"SIDEMARK"),      
		(fname:"SHIPNAME"),      
		(fname:"NETWEIGHT"),     
		(fname:"GROSSWEIGHT"),   
		(fname:"SHEETNUM"),      
		(fname:"PREGOODSID")     
	),
	inputs:"leftjoin_1_select",
	order_by:("PREGOODSID")
);

dataproc leftjoin T_GG_SJ_GOODS_4_join
(
	inputs:
		(left_input:T_GG_SJ_GOODS_4_select,right_input:leftjoin_2_select),
	join_keys:
	(
		("left_input.GOODSID","right_input.PREGOODSID")
	)
);

dataproc index join_2_1_index
(
 inputs:T_GG_SJ_GOODS_4_join,
 table:join_2
 );
 
dataproc doc join_2_doc
(  
   inputs:T_GG_SJ_GOODS_4_join,
   table:join_2,
   format:join_2_parser,
   fields:("OWNERID","OWNERNAME","GRADENUMXH","SINGLESHEETNUM","SIDEMARK","SHIPNAME","NETWEIGHT","GROSSWEIGHT","SHEETNUM","PACKNUM","MANAGENO","GRADENUM","PREGOODSID","GOODSLOCID","DEPTID","R_RECORD_IS_DELETED","GOODSID","KINDNAME","SHOPSIGNNAME","PRODAREANAME","FIRSTINDATE")
);

end;

run job 3_job (threads:8);
<file_sep>/uncomplete/JINSHANG-97/schema/T_ZY_CK_OUTBILL.sql
CREATE SCHEMA t_zy_ck_outbill_schema
SOURCE TYPE CSV
FIELDS(                                                          
"outbillid"                                                type str,
"deptid"                                                   type str,
"foreignlistno"                                            type str,
"outbillownername"                                         type str,
"outbillownerno"                                           type str,
"outbillpickownername"                                     type str,
"outbillpickownerno"                                       type str,
"outtype"                                                  type str,
"outcusttime"                                              type datetime format '%Y/%m/%d %H:%M:%S',
"outbillempno"                                             type str,
"outbillempname"                                           type str,
"outbilltime"                                              type datetime format '%Y/%m/%d %H:%M:%S',
"newmanagenum"                                             type str,
"truckgroupno"                                             type str,
"outcarno"                                                 type str,
"outbillmemo"                                              type str,
"planno"                                                   type str,
"netweightsum"                                             type double,
"sheetnumsum"                                              type double,
"r_record_create_date"                                     type datetime format '%Y/%m/%d %H:%M:%S',
"r_record_create_user"                                     type str,
"r_record_update_date"                                     type datetime format '%Y/%m/%d %H:%M:%S',
"r_record_update_user"                                     type str,
"r_record_is_deleted"                                      type double,
"outstate"                                                 type str,
"invoicekindid"                                            type str,
"invoicekindname"                                          type str,
"r_record_change_flag"                                     type double,
"printcount"                                               type double,
"maxprintcount"                                            type double,
"issplit"                                                  type double,
"outtypename"                                              type str,
"check_type"                                               type str,
"operator"                                                 type str,
"outcardrivername"                                         type str,
"idcode"                                                   type str,
"settlenum"                                                type str,
"outpassword"                                              type str,
"sendmessage"                                              type str,
"dtlcount"                                                 type double,
"confirm_flag"                                             type str default value '0',
"confirm_date"                                             type datetime format '%Y/%m/%d %H:%M:%S',
"confirm_emp"                                              type str,
"issettled"                                                type double,
"deptto"                                                   type str,
"trans_type"                                               type str,
"jfsendflag"                                               type double,
"jyzxflag"                                                 type double,
"username"                                                 type str,
"billlock"                                                 type str
	    )
SCHEMA DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER t_zy_ck_outbill_parser
TYPE rcd
SCHEMA t_zy_ck_outbill_schema;

<file_sep>/complete/JINSHANG-110/add_1.sql
create job add_1_job(2)
begin

dataset file T_GG_SJ_GOODS_dataset_11
(
	schema: T_GG_SJ_GOODS_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select union_select
(   
	inputs: "T_GG_SJ_GOODS_dataset_11",
	 fields: 
	 (
       (fname:"netweight",alias:"store_amount",type:"double"),
       (fname:"0",alias:"store_in_amount",type:"double"),
       (fname:"0",alias:"store_out_amount",type:"double"),
       (fname:"0",alias:"store_process_amount",type:"double")
	 ),
	 distinct: true,
	 cache:true,
	 conditions:" goodsstateno = '110'
		AND deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
);

  dataproc statistics T_GG_SJ_GOOS_statistics
(
	inputs:"union_select",
	table:union_all
);

end;

run job add_1_job (threads:8);
<file_sep>/complete/JINSHANG-102/2_init.sql
create job job0(1)
begin
dataset file T_ZY_CK_CLEAR_1_dataset
(
	schema: "T_ZY_CK_CLEAR_schema",
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_CK_CLEAR.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_CK_CLEAR_syncher
(
    inputs: T_ZY_CK_CLEAR_1_dataset,
    database:db,
    operator:add, 
    table:T_ZY_CK_CLEAR
);
end;
run job job0(threads:8);

create job 1_job(1)
begin
dataset file T_ZY_JG_PROCESS_1_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_JG_PROCESS.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCESS_syncher
(
    inputs: T_ZY_JG_PROCESS_1_dataset,
    database:db,
    operator:add, 
    table:T_ZY_JG_PROCESS
);
end;
run job 1_job (threads:8);


create service service_1(3)
begin
dataset file T_GG_SJ_GOODS_dataset
(
	schema: "T_GG_SJ_GOODS_schema",
    filename: "/home/natt/Data/jinshang_Data_New/T_GG_SJ_GOODS.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_RK_INBILLDETAIL_dataset
(
	schema: T_ZY_RK_INBILLDETAIL_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_RK_INBILLDETAIL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_JG_PROCARTICLEDTL_dataset
(
	schema: T_ZY_JG_PROCARTICLEDTL_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_JG_PROCARTICLEDTL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_GH_CHANGEOWNERLIST_dataset
(
	schema: T_ZY_GH_CHANGEOWNERLIST_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_GH_CHANGEOWNERLIST.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_GH_CHANGEOWNERDETAIL_dataset
(
	schema: T_ZY_GH_CHANGEOWNERDETAIL_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_GH_CHANGEOWNERDETAIL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_CK_OUTPACK_dataset
(
	schema: T_ZY_CK_OUTPACK_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_CK_OUTPACK.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_JG_PROCMATERIALDTL_dataset
(
	schema: T_ZY_JG_PROCMATERIALDTL_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_JG_PROCMATERIALDTL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_select
(
	fields: 
	 (
       (fname:"DEPTID"),
       (fname:"CHANGEOWNERID"),
       (fname:"NEWOWNERNO"),
       (fname:"NEWOWNERNAME"),
	   (fname:"PREOWNERNO"),
	   (fname:"PROOWNERNAME"),
	   (fname:"CHANGEDATE")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_dataset",
	 order_by:("DEPTID","CHANGEOWNERID"),
	 conditions:"DEPTID = '101'
	AND CHANGEDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	cache : "true",
	into: "T_ZY_GH_CHANGEOWNERLIST"
);

dataproc select T_ZY_GH_CHANGEOWNERDETAIL_select
(
	fields: 
	 (
		(fname:"PREMANAGENUM"),
		(fname:"CASE WHEN ( MANAGENUM IS NULL OR MANAGENUM = '') THEN PREMANAGENUM ELSE MANAGENUM END ",alias:"MANAGENUM",type:"string"),
		(fname:"SHOPSIGNID"),
		(fname:"SHOPSIGNNAME"),
		(fname:"PRODAREAID"),
		(fname:"PRODAREANAME"),
		(fname:"GRADENUM"),
		(fname:"NETWEIGHT"),
		(fname:"GROSSWEIGHT"),
		(fname:"SHEETNUM"),
		(fname:"FIRSTINDATE"),
		(fname:"KINDNAME"),
		(fname:"GOODSLOCID"),
		(fname:"PACKNUM"),
		(fname:"CHANGEOWNERNO"),
		(fname:"DEPTID",alias:"DEPTID_1",type:"string"),
		(fname:"GRADENUMXH"),
		(fname:"SINGLESHEETNUM"),
		(fname:"OWNERNAME"),
		(fname:"GOODSOWNERMANAGENUM",alias:"GOODSOWNERMANAGENO",type:"string")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERDETAIL_dataset",
	 order_by:("DEPTID_1","CHANGEOWNERNO"),
	cache : "true",
	into: "T_ZY_GH_CHANGEOWNERDETAIL"
);

dataproc join T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join
(
	inputs:
		(left_input:T_ZY_GH_CHANGEOWNERLIST_select,right_input:T_ZY_GH_CHANGEOWNERDETAIL_select),
	join_keys:
	(
		("left_input.DEPTID","right_input.DEPTID_1"),
		("left_input.CHANGEOWNERID","right_input.CHANGEOWNERNO")
	),
	into: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL"
);



dataproc select T_GG_SJ_GOODS_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_GG_SJ_GOODS_dataset",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	 conditions:"GOODSSTATENO = '110'
		AND R_RECORD_IS_DELETED = 0
		AND DEPTID = '101'",
	 cache : "true",
	 into: "T_GG_SJ_GOODS"
);

dataproc select A_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_RK_INBILLDETAIL_dataset",
	 conditions:"DEPTID = '101'
		AND GOODSSTATENO = '20'
		AND FIRSTINDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	 into: "T_ZY_RK_INBILLDETAIL"
);

dataproc select T_ZY_RK_INBILLDETAIL_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0-GRADENUMXH",alias:"GRADENUMXH",type:"double"),
	   (fname:"0-SINGLESHEETNUM",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"0-NETWEIGHT",alias:"NETWEIGHT",type:"double"),
       (fname:"0-GROSSWEIGHT",alias:"GROSSWEIGHT",type:"double"),
       (fname:"0-SHEETNUM",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "A_select",
	cache : "true",
	into: "T_ZY_RK_INBILLDETAIL"
);
 
 dataproc select B_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_JG_PROCARTICLEDTL_dataset",
	 conditions:"DEPTID = '101'
		AND FIRSTINDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')
		AND GOODSSTATENO = '130'",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	 into: "T_ZY_JG_PROCARTICLEDTL"
);

 dataproc select T_ZY_JG_PROCARTICLEDTL_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"0-NETWEIGHT",alias:"NETWEIGHT",type:"double"),
       (fname:"0-GROSSWEIGHT",alias:"GROSSWEIGHT",type:"double"),
       (fname:"0-SHEETNUM",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "B_select",
	 cache : "true",
	 into: "T_ZY_JG_PROCARTICLEDTL"
);

dataproc select C_select
(
	 fields: 
	 (
       (fname:"NEWOWNERNO",alias:"OWNERID"),
       (fname:"NEWOWNERNAME",alias:"OWNERNAME"),
       (fname:"MANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	into: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL"
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_select
(
	 fields: 
	 (
       (fname:"NEWOWNERNO",alias:"OWNERID"),
       (fname:"NEWOWNERNAME",alias:"OWNERNAME"),
       (fname:"MANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"0-NETWEIGHT",alias:"NETWEIGHT",type:"double"),
       (fname:"0-GROSSWEIGHT",alias:"GROSSWEIGHT",type:"double"),
       (fname:"0-SHEETNUM",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "C_select",
	cache : "true",
	into: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL"
);

dataproc select T_ZY_CK_OUTPACK_select
(
	 fields: 
	 (
       (fname:"OWNERNO"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENUM",alias:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_CK_OUTPACK_dataset",
	 conditions:"DEPTID = '101'
		AND OUTCUSTTIME >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	group_by:(OWNERNO,OWNERNAME,MANAGENUM,GOODSOWNERMANAGENUM,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "T_ZY_CK_OUTPACK"
);

dataproc select T_GG_SJ_GOODS_2_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
	   (fname:"PACKNUM"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_GG_SJ_GOODS_dataset",
	 conditions:"CREATDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "T_GG_SJ_GOODS"
);

dataproc select T_ZY_JG_PROCMATERIALDTL_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_JG_PROCMATERIALDTL_dataset",
	 conditions:"vf_PROCESSID = '1'
	   and DEPTID = '101' ",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "T_ZY_JG_PROCMATERIALDTL"
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_1_select
(
	 fields: 
	 (
       (fname:"PREOWNERNO",alias:"OWNERID"),
       (fname:"PROOWNERNAME",alias:"OWNERNAME"),
       (fname:"PREMANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_join",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL"
);
 
dataproc union 1_union
(
    inputs:("T_GG_SJ_GOODS_select","T_ZY_RK_INBILLDETAIL_select","T_ZY_JG_PROCARTICLEDTL_select","T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_select","T_ZY_CK_OUTPACK_select","T_GG_SJ_GOODS_2_select","T_ZY_JG_PROCMATERIALDTL_select","T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_1_select"),
	into:"union_all"
);

dataproc select union_select
(
	fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "1_union",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "union_all"
);
 
  dataproc statistics union_all_statistics
(
  inputs:union_select,
  table:union_all
);

end;

start service service_1 {                      
	  "running_name"   :   "idx_job",
	  "interval"	:	0,
	  "volume"	: 	1000000000,
	  "threads"	: 4
};


create service service_2(3)
begin
dataset file T_GG_SJ_GOODS_del_dataset
(
	schema: "T_GG_SJ_GOODS_schema",
    filename: "/home/natt/Data/jinshang_Data_New/T_GG_SJ_GOODS.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_RK_INBILLDETAIL_del_dataset
(
	schema: T_ZY_RK_INBILLDETAIL_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_RK_INBILLDETAIL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_JG_PROCARTICLEDTL_del_dataset
(
	schema: T_ZY_JG_PROCARTICLEDTL_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_JG_PROCARTICLEDTL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_GH_CHANGEOWNERLIST_del_dataset
(
	schema: T_ZY_GH_CHANGEOWNERLIST_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_GH_CHANGEOWNERLIST.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_GH_CHANGEOWNERDETAIL_del_dataset
(
	schema: T_ZY_GH_CHANGEOWNERDETAIL_schema,
    filename: "/home/natt/Data/jinshang_Data_New/T_ZY_GH_CHANGEOWNERDETAIL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_CK_OUTPACK_del_dataset
(
	schema: T_ZY_CK_OUTPACK_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_CK_OUTPACK.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataset file T_ZY_JG_PROCMATERIALDTL_del_dataset
(
	schema: T_ZY_JG_PROCMATERIALDTL_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_ZY_JG_PROCMATERIALDTL.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_del_select
(
	fields: 
	 (
       (fname:"DEPTID"),
       (fname:"CHANGEOWNERID"),
       (fname:"NEWOWNERNO"),
       (fname:"NEWOWNERNAME"),
	   (fname:"PREOWNERNO"),
	   (fname:"PROOWNERNAME"),
	   (fname:"CHANGEDATE")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_del_dataset",
	 order_by:("DEPTID","CHANGEOWNERID"),
	 conditions:"DEPTID = '101'
	AND CHANGEDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	cache : "true",
	into: "T_ZY_GH_CHANGEOWNERLIST"
);

dataproc select T_ZY_GH_CHANGEOWNERDETAIL_del_select
(
	fields: 
	 (
		(fname:"PREMANAGENUM"),
		(fname:"CASE WHEN ( MANAGENUM IS NULL OR MANAGENUM = '') THEN PREMANAGENUM ELSE MANAGENUM END ",alias:"MANAGENUM",type:"string"),
		(fname:"SHOPSIGNID"),
		(fname:"SHOPSIGNNAME"),
		(fname:"PRODAREAID"),
		(fname:"PRODAREANAME"),
		(fname:"GRADENUM"),
		(fname:"NETWEIGHT"),
		(fname:"GROSSWEIGHT"),
		(fname:"SHEETNUM"),
		(fname:"FIRSTINDATE"),
		(fname:"KINDNAME"),
		(fname:"GOODSLOCID"),
		(fname:"PACKNUM"),
		(fname:"CHANGEOWNERNO"),
		(fname:"DEPTID",alias:"DEPTID_1",type:"string"),
		(fname:"GRADENUMXH"),
		(fname:"SINGLESHEETNUM"),
		(fname:"OWNERNAME"),
		(fname:"GOODSOWNERMANAGENUM",alias:"GOODSOWNERMANAGENO",type:"string")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERDETAIL_del_dataset",
	 order_by:("DEPTID_1","CHANGEOWNERNO"),
	cache : "true",
	into: "T_ZY_GH_CHANGEOWNERDETAIL"
);

dataproc join T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_del_join
(
	inputs:
		(left_input:T_ZY_GH_CHANGEOWNERLIST_del_select,right_input:T_ZY_GH_CHANGEOWNERDETAIL_del_select),
	join_keys:
	(
		("left_input.DEPTID","right_input.DEPTID_1"),
		("left_input.CHANGEOWNERID","right_input.CHANGEOWNERNO")
	),
	into: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL"
);



dataproc select T_GG_SJ_GOODS_del_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_GG_SJ_GOODS_del_dataset",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	 conditions:"GOODSSTATENO = '110'
		AND R_RECORD_IS_DELETED = 0
		AND DEPTID = '101'",
	 cache : "true",
	 into: "T_GG_SJ_GOODS"
);

dataproc select A_del_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_RK_INBILLDETAIL_del_dataset",
	 conditions:"DEPTID = '101'
		AND GOODSSTATENO = '20'
		AND FIRSTINDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	 into: "T_ZY_RK_INBILLDETAIL"
);

dataproc select T_ZY_RK_INBILLDETAIL_del_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0-GRADENUMXH",alias:"GRADENUMXH",type:"double"),
	   (fname:"0-SINGLESHEETNUM",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"0-NETWEIGHT",alias:"NETWEIGHT",type:"double"),
       (fname:"0-GROSSWEIGHT",alias:"GROSSWEIGHT",type:"double"),
       (fname:"0-SHEETNUM",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "A_del_select",
	cache : "true",
	into: "T_ZY_RK_INBILLDETAIL"
);
 
 dataproc select B_del_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_JG_PROCARTICLEDTL_del_dataset",
	 conditions:"DEPTID = '101'
		AND FIRSTINDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')
		AND GOODSSTATENO = '130'",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	 into: "T_ZY_JG_PROCARTICLEDTL"
);

 dataproc select T_ZY_JG_PROCARTICLEDTL_del_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"0-NETWEIGHT",alias:"NETWEIGHT",type:"double"),
       (fname:"0-GROSSWEIGHT",alias:"GROSSWEIGHT",type:"double"),
       (fname:"0-SHEETNUM",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "B_del_select",
	 cache : "true",
	 into: "T_ZY_JG_PROCARTICLEDTL"
);

dataproc select C_del_select
(
	 fields: 
	 (
       (fname:"NEWOWNERNO",alias:"OWNERID"),
       (fname:"NEWOWNERNAME",alias:"OWNERNAME"),
       (fname:"MANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_del_join",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	into: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL"
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_del_select
(
	 fields: 
	 (
       (fname:"NEWOWNERNO",alias:"OWNERID"),
       (fname:"NEWOWNERNAME",alias:"OWNERNAME"),
       (fname:"MANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"0-NETWEIGHT",alias:"NETWEIGHT",type:"double"),
       (fname:"0-GROSSWEIGHT",alias:"GROSSWEIGHT",type:"double"),
       (fname:"0-SHEETNUM",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "C_del_select",
	cache : "true",
	into: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL"
);

dataproc select T_ZY_CK_OUTPACK_del_select
(
	 fields: 
	 (
       (fname:"OWNERNO"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENUM",alias:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_CK_OUTPACK_del_dataset",
	 conditions:"DEPTID = '101'
		AND OUTCUSTTIME >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	group_by:(OWNERNO,OWNERNAME,MANAGENUM,GOODSOWNERMANAGENUM,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "T_ZY_CK_OUTPACK"
);

dataproc select T_GG_SJ_GOODS_del_2_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
	   (fname:"PACKNUM"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_GG_SJ_GOODS_del_dataset",
	 conditions:"CREATDATE >= TO_DATE ('2012-07-02', '%Y-%m-%d')",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "T_GG_SJ_GOODS"
);

dataproc select T_ZY_JG_PROCMATERIALDTL_del_select
(
	 fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_JG_PROCMATERIALDTL_del_dataset",
	 conditions:"vf_PROCESSID = '1'
	   and DEPTID = '101' ",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "T_ZY_JG_PROCMATERIALDTL"
);

dataproc select T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_del_1_select
(
	 fields: 
	 (
       (fname:"PREOWNERNO",alias:"OWNERID"),
       (fname:"PROOWNERNAME",alias:"OWNERNAME"),
       (fname:"PREMANAGENUM",alias:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"0",alias:"GRADENUMXH",type:"double"),
	   (fname:"0",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_del_join",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL"
);
 
dataproc union 1_del_union
(
    inputs:("T_GG_SJ_GOODS_del_select","T_ZY_RK_INBILLDETAIL_del_select","T_ZY_JG_PROCARTICLEDTL_del_select","T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_del_select","T_ZY_CK_OUTPACK_del_select","T_GG_SJ_GOODS_del_2_select","T_ZY_JG_PROCMATERIALDTL_del_select","T_ZY_GH_CHANGEOWNERLIST_T_ZY_GH_CHANGEOWNERDETAIL_del_1_select"),
	into:"union_all"
);

dataproc select union_del_select
(
	fields: 
	 (
       (fname:"OWNERID"),
       (fname:"OWNERNAME"),
       (fname:"MANAGENO"),
       (fname:"GOODSOWNERMANAGENO"),
	   (fname:"PACKNUM"),
       (fname:"GRADENUM"),
       (fname:"GOODSLOCID"),
       (fname:"KINDNAME"),
	   (fname:"SHOPSIGNNAME"),
       (fname:"PRODAREANAME"),
       (fname:"FIRSTINDATE"),
       (fname:"sum(GRADENUMXH)",alias:"GRADENUMXH",type:"double"),
	   (fname:"sum(SINGLESHEETNUM)",alias:"SINGLESHEETNUM",type:"double"),
       (fname:"sum(NETWEIGHT)",alias:"NETWEIGHT",type:"double"),
       (fname:"sum(GROSSWEIGHT)",alias:"GROSSWEIGHT",type:"double"),
       (fname:"sum(SHEETNUM)",alias:"SHEETNUM",type:"double")
	 ),
	 inputs: "1_del_union",
	 group_by:(OWNERID,OWNERNAME,MANAGENO,GOODSOWNERMANAGENO,PACKNUM,GRADENUM,GOODSLOCID,KINDNAME,SHOPSIGNNAME,PRODAREANAME,FIRSTINDATE),
	cache : "true",
	into: "union_all"
);
 
  dataproc statistics union_all_del_statistics
(
  inputs:union_del_select,
  table:union_all,
  data_opr:delete
);

end;

start service service_2 {                      
	  "running_name"   :   "idx_job1",
	  "interval"	:	0,
	  "volume"	: 	1000000000,
	  "threads"	: 4
};
<file_sep>/complete/JINSHANG-102/job2.sql
create job 2_job(8)
begin

dataset file T_GG_SJ_GOODS_dataset
(
	schema: "T_GG_SJ_GOODS_schema",
    filename: "/home/natt/Data/jinshang_Data_New/T_GG_SJ_GOODS.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_GG_SJ_GOODS_syncher
(
    inputs: T_GG_SJ_GOODS_dataset,
    database:db,
    operation:add, 
    table:T_GG_SJ_GOODS,
	stream:true,
	services : 
	(
		(dataprocname : T_GG_SJ_GOODS_dataset,
		serviceid: idx_job)
	)
);
end;

run job 2_job (threads:8);
<file_sep>/processing/JINSHANG-75/init.sql
create job t_common_dept_job(t_common)
begin
dataset file t_common_dept_dataset
(
	schema:t_common_dept_schema,
	filename: "/home/zhaoshun/Data/jingshang_data/T_COMMON_DEPT.txt",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);

dataproc index t_common_dept_index
(
		inputs: t_common_dept_dataset,
		table: t_common_dept
);	
  dataproc doc t_common_dept_doc
(  
   inputs:t_common_dept_dataset,
   table:t_common_dept
);

dataproc map t_common_dept_map
(  
   inputs:t_common_dept_dataset,
   table:t_common_dept
);

end;

run job t_common_dept_job(threads:8);


create job t_gg_sj_goods_job(t_gg_sj)
begin
dataset file t_gg_sj_goods_dataset
(
	schema:t_gg_sj_goods_schema,
	filename:"/home/zhaoshun/Data/jingshang_data/T_GG_SJ_GOODS.txt",
	serverid: 0,
	splitter:(block_size: 10000000)		  
);

dataproc index tt_1_index
(
	inputs: t_gg_sj_goods_dataset,
	table: t_1
);	

  dataproc doc t_1_doc   
(  
   inputs:t_gg_sj_goods_dataset,
   table:t_1,
   format:t_1_parser
);

end;

run job t_gg_sj_goods_job (threads:8);
<file_sep>/schema/T_SI_LOGISTICS_READY_D.sql
CREATE SCHEMA T_SI_LOGISTICS_READY_D_schema
SOURCE TYPE CSV
FIELDS(                                                          
"seg_no"                                                   type str,
"pack_num"                                                 type str,
"weight_active"                                            type double,
"weight_theo"                                              type double,
"length_product"                                           type double,
"length_product_max"                                       type double,
"width_product"                                            type double,
"thick_product"                                            type double,
"type_product"                                             type str,
"n_pack"                                                   type double,
"ready_num"                                                type str,
"order_num"                                                type str,
"heat_num"                                                 type str,
"shopsign"                                                 type str,
"proc_mark"                                                type str,
"time_receive"                                             type datetime,
"aaa"                                                      type datetime,
"provider_id"                                              type str,
"provider_name"                                            type str
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM"; 

CREATE PARSER T_SI_LOGISTICS_READY_D_parser
TYPE rcd
SCHEMA T_SI_LOGISTICS_READY_D_schema;

CREATE TABLE T_SI_LOGISTICS_READY_D using T_SI_LOGISTICS_READY_D_parser;

CREATE INDEX T_SI_LOGISTICS_READY_D_index ON TABLE T_SI_LOGISTICS_READY_D (seg_no); 


<file_sep>/schema/T_ZY_RK_INBILLDETAIL.sql
create schema T_ZY_RK_INBILLDETAIL_schema
SOURCE TYPE CSV
FIELDS(
"goodsid" type str,
"deptid" type str,
"packnum" type str,
"barcode" type str,
"goodslocid" type str,
"stocktype" type str,
"ownerid" type str,
"ownername" type str,
"goodsownermanageno" type str,
"inbillid" type str,
"goodsownerpackno" type str,
"manageno" type str,
"feebegindate" type DATETIME,
"contractid" type str,
"goodsstateno" type str,
"goodsstatename" type str,
"changeownertimes" type double,
"goodstype" type str,
"goodstypename" type str,
"kindno" type str,
"kindname" type str,
"shopsignid" type str,
"shopsignname" type str,
"prodareaid" type str,
"prodareaname" type str,
"goodsbatchno" type str,
"prodstoveno" type str,
"gradenum" type str,
"gradenumthick" type double,
"gradenumwidth" type double,
"gradenumlength" type double,
"grossweight" type double,
"netweight" type double,
"poundweight" type double,
"checkweight" type double,
"sheetnum" type double,
"unit" type str,
"stockareaid" type str,
"qualitymemo" type str,
"firstinownerid" type str,
"firstindate" type DATETIME,
"outbillid" type str,
"ldglistid" type str,
"materialgoodsid" type str,
"intype" type str,
"outtype" type str,
"billstate" type double,
"outbilltime" type DATETIME,
"memo" type str,
"extsysplanobjectid" type str,
"extsyskindid" type str,
"extsysshopsignid" type str,
"extsysprodareaid" type str,
"sendflag" type double,
"r_record_create_date" type DATETIME,
"r_record_create_user" type str,
"r_record_update_date" type DATETIME,
"r_record_update_user" type str,
"r_record_is_deleted" type double,
"incusttime" type DATETIME,
"foreignlistno" type str,
"sidemark" type str,
"length_product_max" type double,
"r_record_change_flag" type double,
"sdprice" type str,
"inbillempname" type str,
"extsysgradenum" type str,
"heat_num" type str,
"errormessage" type str,
"check_type" type str,
"outdate" type DATETIME,
"yfweight" type double,
"yfsheet" type double,
"pregoodsid" type str,
"singlesheetnum" type double,
"gradenumhz" type str,
"gradenumthickhz" type double,
"singlesheet" type double,
"gradenumxh" type double,
"shipno" type str,
"shipname" type str,
"shipcd" type str,
"shiplevel" type str,
"sort_emp" type str,
"dbrkflag" type double,
"dbckflag" type double,
"dbowner" type str,
"dbgoodsid" type str,
"dispersesheet" type double,
"ply" type double,
"out_package_status" type str,
"out_package_desc" type str,
"gmpacktype" type str,
"handno" type str,
"saveno" type str,
"dangerouslevel" type str,
"acceptancecriteria" type str,
"shippingmark" type str,
"gradenumwhdw" type str,
"loclv2" type str,
"packtype" type str,
"payedflag" type str,
"collectionmanname" type str,
"loclv1" type str
)
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_RK_INBILLDETAIL_parser
TYPE rcd
SCHEMA T_ZY_RK_INBILLDETAIL_schema;

CREATE TABLE T_ZY_RK_INBILLDETAIL using T_ZY_RK_INBILLDETAIL_parser; 

create index T_ZY_RK_INBILLDETAIL_index on table T_ZY_RK_INBILLDETAIL(goodsid);<file_sep>/complete/JINSHANG-102/102_oracl.sql
SELECT
	OWNERID,
	OWNERNAME,
	MANAGENO,
	GOODSOWNERMANAGENO,
	PACKNUM,
	GRADENUM,
	GOODSLOCID,
	KINDNAME,
	SHOPSIGNNAME,
	PRODAREANAME,
	FIRSTINDATE,
	SUM (GRADENUMXH) GRADENUMXH,
	SUM (SINGLESHEETNUM) SINGLESHEETNUM,
	SUM (NETWEIGHT) NETWEIGHT,
	SUM (GROSSWEIGHT) GROSSWEIGHT,
	SUM (SHEETNUM) SHEETNUM
FROM
	(
		SELECT
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE,
			SUM (GRADENUMXH) GRADENUMXH,
			SUM (SINGLESHEETNUM) SINGLESHEETNUM,
			SUM (NETWEIGHT) NETWEIGHT,
			SUM (GROSSWEIGHT) GROSSWEIGHT,
			SUM (SHEETNUM) SHEETNUM
		FROM
			T_GG_SJ_GOODS
		WHERE
			GOODSSTATENO = '110'
		AND R_RECORD_IS_DELETED = 0
		AND DEPTID = '101'
		GROUP BY
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE
		
	UNION ALL
	
		SELECT
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE,
			SUM (GRADENUMXH) GRADENUMXH,
			SUM (SINGLESHEETNUM) SINGLESHEETNUM,
			- SUM (NETWEIGHT) NETWEIGHT ,
			- SUM (GROSSWEIGHT) GROSSWEIGHT ,
			- SUM (SHEETNUM) SHEETNUM
		FROM
			T_ZY_RK_INBILLDETAIL
		WHERE
			DEPTID = '101'
		AND GOODSSTATENO = '20'
		AND FIRSTINDATE >= TO_DATE ('2011/7/2', 'YYYY-MM-DD')
		GROUP BY
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE
			
	UNION ALL
	
		SELECT
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE,
			0 GRADENUMXH,
			0 SINGLESHEETNUM,
			- SUM (NETWEIGHT) NETWEIGHT ,
			- SUM (GROSSWEIGHT) GROSSWEIGHT ,
			- SUM (SHEETNUM) SHEETNUM
		FROM
			T_ZY_JG_PROCARTICLEDTL
		WHERE
			DEPTID = '101'
		AND FIRSTINDATE >= TO_DATE ('2011/7/2', 'YYYY-MM-DD')
		AND GOODSSTATENO = '130'
		GROUP BY
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE
			
	UNION ALL
	
		SELECT
			NEWOWNERNO OWNERID,
			NEWOWNERNAME OWNERNAME,
			MANAGENUM MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE,
			0 GRADENUMXH,
			0 SINGLESHEETNUM,
			- SUM (NETWEIGHT) NETWEIGHT ,
			- SUM (GROSSWEIGHT) GROSSWEIGHT ,
			- SUM (SHEETNUM) SHEETNUM
		FROM
			(
				SELECT
					A .NEWOWNERNO,
					A .NEWOWNERNAME,
					(CASE WHEN ( MANAGENUM IS NULL OR MANAGENUM = '') THEN	PREMANAGENUM ELSE MANAGENUM	END	) MANAGENUM,
					B.SHOPSIGNID,
					B.SHOPSIGNNAME,
					B.PRODAREAID,
					B.PRODAREANAME,
					B.GRADENUM,
					B.NETWEIGHT,
					B.GROSSWEIGHT,
					B.SHEETNUM,
					B.FIRSTINDATE,
					B.KINDNAME,
					B.GOODSLOCID,
					B.PACKNUM,
					B.GOODSOWNERMANAGENUM GOODSOWNERMANAGENO
				FROM
					(
						SELECT
							DEPTID,
							CHANGEOWNERID,
							NEWOWNERNO,
							NEWOWNERNAME
						FROM
							T_ZY_GH_CHANGEOWNERLIST
						WHERE
							DEPTID = '101'
						AND CHANGEDATE >= TO_DATE ('2012/7/2', 'YYYY-MM-DD')
					) A,
					T_ZY_GH_CHANGEOWNERDETAIL B
				WHERE
					A .CHANGEOWNERID = B.CHANGEOWNERNO
				AND A .DEPTID = B.DEPTID
			) TB1
		GROUP BY
			NEWOWNERNO,
			NEWOWNERNAME,
			MANAGENUM,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE
			
	UNION ALL
	
		SELECT
			OWNERNO,
			OWNERNAME,
			MANAGENUM MANAGENO,
			GOODSOWNERMANAGENUM GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE,
			SUM (GRADENUMXH) GRADENUMXH,
			SUM (SINGLESHEETNUM) SINGLESHEETNUM,
			SUM (NETWEIGHT) NETWEIGHT,
			SUM (GROSSWEIGHT) GROSSWEIGHT,
			SUM (SHEETNUM) SHEETNUM
		FROM
			T_ZY_CK_OUTPACK
		WHERE
			DEPTID = '101'
		AND OUTCUSTTIME >= TO_DATE ('2012/7/2', 'YYYY-MM-DD')
		GROUP BY
			OWNERNO,
			OWNERNAME,
			MANAGENUM,
			GOODSOWNERMANAGENUM,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE
			
	UNION ALL
	
		SELECT											
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			A .PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE,
			SUM (GRADENUMXH) GRADENUMXH,
			SUM (SINGLESHEETNUM) SINGLESHEETNUM,
			SUM (NETWEIGHT) NETWEIGHT,
			SUM (GROSSWEIGHT) GROSSWEIGHT,
			SUM (SHEETNUM) SHEETNUM
		FROM
			T_GG_SJ_GOODS A,
			T_ZY_CK_CLEAR B
		WHERE
			A .GOODSID = B.GOODSID
		AND A .DEPTID = '101'
		AND CREATDATE >= TO_DATE ('2012/7/2', 'YYYY-MM-DD')
		GROUP BY
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			A .PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE
			
	UNION ALL
	
		SELECT
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE,
			0 GRADENUMXH,
			0 SINGLESHEETNUM,
			SUM (NETWEIGHT) NETWEIGHT,
			SUM (GROSSWEIGHT) GROSSWEIGHT,
			SUM (SHEETNUM) SHEETNUM
		FROM
			T_ZY_JG_PROCMATERIALDTL
		WHERE
			DEPTID = '101'
		AND EXISTS (
			SELECT
				1
			FROM
				T_ZY_JG_PROCESS
			WHERE
				PROCESSID = T_ZY_JG_PROCMATERIALDTL.PROCESSID
			AND DEPTID = T_ZY_JG_PROCMATERIALDTL.DEPTID
			AND OUTCARBILLTIME >= TO_DATE ('2012/7/2', 'YYYY-MM-DD')
		)
		GROUP BY
			OWNERID,
			OWNERNAME,
			MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE
			
	UNION ALL
	
		SELECT
			PREOWNERNO OWNERID,
			PROOWNERNAME OWNERNAME,
			PREMANAGENUM MANAGENO,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE,
			0 GRADENUMXH,
			0 SINGLESHEETNUM,
			SUM (NETWEIGHT) NETWEIGHT,
			SUM (GROSSWEIGHT) GROSSWEIGHT,
			SUM (SHEETNUM) SHEETNUM
		FROM
			(
				SELECT
					A .PREOWNERNO,
					A .PROOWNERNAME,
					B.PREMANAGENUM,
					B.NETWEIGHT,
					B.GROSSWEIGHT,
					B.SHEETNUM,
					B.SHOPSIGNID,
					B.SHOPSIGNNAME,
					B.PRODAREAID,
					B.PRODAREANAME,
					B.GRADENUM,
					B.FIRSTINDATE,
					B.KINDNAME,
					B.GOODSLOCID,
					B.PACKNUM,
					B.PREGOODSOWNERMANAGENUM GOODSOWNERMANAGENO
				FROM
					(
						SELECT
							DEPTID,
							CHANGEOWNERID,
							PREOWNERNO,
							PROOWNERNAME
						FROM
							T_ZY_GH_CHANGEOWNERLIST
						WHERE
							DEPTID = '101'
						AND CHANGEDATE >= TO_DATE ('2012/7/2', 'YYYY-MM-DD')
					) A,
					T_ZY_GH_CHANGEOWNERDETAIL B
				WHERE
					A .CHANGEOWNERID = B.CHANGEOWNERNO  
				AND A .DEPTID = B.DEPTID
			) TB1
		GROUP BY
			PREOWNERNO,
			PROOWNERNAME,
			PREMANAGENUM,
			GOODSOWNERMANAGENO,
			PACKNUM,
			GRADENUM,
			GOODSLOCID,
			KINDNAME,
			SHOPSIGNNAME,
			PRODAREANAME,
			FIRSTINDATE
	) TBX
WHERE
	OWNERID = 'KH05821'
AND NETWEIGHT <> 0
GROUP BY
	OWNERID,
	OWNERNAME,
	MANAGENO,
	GOODSOWNERMANAGENO,
	PACKNUM,
	GRADENUM,
	GOODSLOCID,
	KINDNAME,
	SHOPSIGNNAME,
	PRODAREANAME,
	FIRSTINDATE
	
<file_sep>/uncomplete/JINSHANG-97/schema/T_ZY_GH_CHANGEOWNERLIST.sql
create database db;
use db;
create schema t_zy_gh_changeownerlist_schema
source type CSV
fields(
 "changeownerid"   type str,
 "deptid"   type str,
 "proownername"   type str,
 "preownerno"   type str,
 "contractno"   type str,
 "premanagenum"   type str,
 "newownername"   type str,
 "newownerno"   type str,
 "newmanagenum"   type str,
 "changedate"   type datetime format '%Y/%m/%d %H:%M:%S',
 "getbiilldate"   type datetime format '%Y/%m/%d %H:%M:%S',
 "foreignlistno" type str,
 "orderlistno"   type str,
 "outcarbilltime"   type datetime format '%Y/%m/%d %H:%M:%S',
 "outcarbillempno"   type str,
 "outcarbillempname"   type str,
 "outcarbillmemo"   type str,
 "r_record_create_date" type datetime format '%Y/%m/%d %H:%M:%S',
 "r_record_create_user" type str,
 "r_record_update_date" type datetime format '%Y/%m/%d %H:%M:%S',
 "r_record_update_user" type str,
 "r_record_is_deleted" type double,
 "netweightsum"        type double,
 "grossweightsum"      type double,
 "sheetnumsum"         type double,
 "originsettle"        type double,
 "r_record_change_flag" type double,
 "issplit"             type double,
 "outpassword"          type str,
 "invoicekindid"        type str,
 "invoicekindname"      type str,
 "sortemp"              type str,
 "sortemptele"          type str,
 "settlestatus"         type str,
 "confirm_date"         type datetime format '%Y/%m/%d %H:%M:%S',
 "confirm_emp"          type str,
 "confirm_flag"         type str default value '0',
 "dtlcount"           type double,
 "issettled"           type double,
 "jfsendflag"          type double,
 "jyzxflag"         type double,
 "sendmessage"       type str,
 "jyzxcheckdate"       type datetime format '%Y/%m/%d %H:%M:%S',
 "jyzxcheckflag"       type double,
 "idcode"               type str,
 "username"           type str
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";
CREATE PARSER t_zy_gh_changeownerlist_parser
TYPE rcd
SCHEMA t_zy_gh_changeownerlist_schema;
<file_sep>/complete/JINSHANG-110/jinshang-110.sql

FOR dtl in
  (SELECT sum(STORE_AMOUNT) STORE_AMOUNT,sum(STORE_IN_AMOUNT) STORE_IN_AMOUNT, sum(STORE_OUT_AMOUNT) STORE_OUT_AMOUNT,sum(STORE_PROCESS_AMOUNT) STORE_PROCESS_AMOUNT
   FROM
     ( SELECT /+index(t T_GG_SJ_GOODS_INDX05)/sum(t.netweight) STORE_AMOUNT,0 STORE_IN_AMOUNT,0 STORE_OUT_AMOUNT,0 STORE_PROCESS_AMOUNT
      FROM wmsdba.t_gg_sj_goods@wms t
      WHERE goodsstateno = '20'
        AND (deptid NOT LIKE '03%'
             AND deptid NOT LIKE 'ZZ%'
             AND deptid NOT LIKE 'MG%')
      UNION ALL --RK
 SELECT 0 STORE_AMOUNT,sum(t.netweightsum) STORE_IN_AMOUNT,0 STORE_OUT_AMOUNT,0 STORE_PROCESS_AMOUNT
      FROM wmsdba.t_zy_rk_inbill@wms t
      WHERE r_record_create_date >= trunc(sysdate - 1) + 14 / 24
        AND r_record_create_date < trunc(sysdate) + 14 / 24
        AND (deptid NOT LIKE '03%'
             AND deptid NOT LIKE 'ZZ%'
             AND deptid NOT LIKE 'MG%')
      UNION ALL --CK
 SELECT 0 STORE_AMOUNT,0 STORE_IN_AMOUNT,sum(t.netweightsum) STORE_OUT_AMOUNT,0 STORE_PROCESS_AMOUNT
      FROM wmsdba.t_zy_ck_outbill@wms t
      WHERE r_record_create_date >= trunc(sysdate - 1) + 14 / 24
        AND r_record_create_date < trunc(sysdate) + 14 / 24
        AND (deptid NOT LIKE '03%'
             AND deptid NOT LIKE 'ZZ%'
             AND deptid NOT LIKE 'MG%')
      UNION ALL --JG
 SELECT 0 STORE_AMOUNT,0 STORE_IN_AMOUNT,0 STORE_OUT_AMOUNT,sum(t.preweightsum) STORE_PROCESS_AMOUNT
      FROM wmsdba.t_zy_jg_process@wms t
      WHERE r_record_create_date >= trunc(sysdate - 1) + 14 / 24
        AND r_record_create_date < trunc(sysdate) + 14 / 24
        AND (deptid NOT LIKE '03%'
             AND deptid NOT LIKE 'ZZ%'
             AND deptid NOT LIKE 'MG%'))) LOOP
INSERT INTO t_statistics_warehouse(STORE_AMOUNT,STORE_IN_AMOUNT,STORE_OUT_AMOUNT,STORE_PROCESS_AMOUNT)
VALUES (dtl.STORE_AMOUNT,
        dtl.STORE_IN_AMOUNT,
        dtl.STORE_OUT_AMOUNT,
        dtl.STORE_PROCESS_AMOUNT) ;

 COMMIT;

 END LOOP;

<file_sep>/schema/T_BM_UI_CONFIGURE.sql
create schema T_BM_UI_CONFIGURE_schema
source type CSV
fields(
  "manage_no"            type str,
  "deptid"               type str,
  "configure_no"         type str,
  "configure_desc"       type str,
  "configure_grade"      type str,
  "configure_node_no"    type str,
  "cf_value1"            type str,
  "cf_value2"            type str,
  "cf_value3"            type double,
  "cf_value4"            type double,
  "configure_remark"     type str,
  "r_record_create_date" type DATETIME,
  "r_record_create_user" type str,
  "r_record_update_date" type DATETIME,
  "r_record_update_user" type str,
  "r_record_is_deleted"  type double,
  "r_record_change_flag" type double,
  "cf_value5"            type DATETIME
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "NULL";

CREATE PARSER T_BM_UI_CONFIGURE_parser
TYPE rcd
SCHEMA T_BM_UI_CONFIGURE_schema;

CREATE TABLE T_BM_UI_CONFIGURE using T_BM_UI_CONFIGURE_parser; 

CREATE INDEX T_BM_UI_CONFIGURE_index ON TABLE T_BM_UI_CONFIGURE (manage_no);<file_sep>/uncomplete/JINSHANG-99/jinshang-99.sql

SELECT pp.STOCKFLAG,
       INWeight,
       OUTWeight,
       ChangeOwnerWeight,
       KCWeight,
       KCSheetnum,
       js
FROM
  (SELECT STOCKFLAG,
          SUM(INWeight) INWeight,
          SUM(OUTWeight) OUTWeight,
          SUM(KCWeight) KCWeight,
          SUM(KCSheetnum) KCSheetnum,
          SUM(js) js
   FROM
     (SELECT tb1.*,
             tb2.netweight INWeight,
             tb3.netweight OUTWeight,
             tb5.netweight KCWeight,
             tb5.sheetnum KCSheetnum,
             tb5.js js
      FROM
        (SELECT goodsid,
                substr(goodslocid,1,1) stockflag
         FROM t_gg_sj_goods
         WHERE deptid='0301') tb1
      LEFT JOIN
        (SELECT goodsid,
                netweight
         FROM t_zy_rk_inbilldetail
         WHERE deptid='0301'
           AND goodsstateno='20'
           AND firstindate<TO_DATE('2015/8/4','yyyy-mm-dd')
           AND firstindate>=to_date('2015/7/3','yyyy-mm-dd') )tb2 ON tb1.goodsid=tb2.goodsid
      LEFT JOIN
        (SELECT goodsid,
                netweight
         FROM t_zy_ck_outpack
         WHERE deptid='0301'
           AND OutCustTime<to_date('2015/8/4','yyyy-mm-dd')
           AND OutCustTime>=to_date('2015/7/3','yyyy-mm-dd') )tb3 ON tb1.goodsid=tb3.goodsid
      LEFT JOIN
        ( SELECT goodsid,
                 sum(netweight) AS netweight,
                 sum(js) js,
                 sum(sheetnum) sheetnum
         FROM
           (SELECT goodsid,
                   netweight,
                   sheetnum,
                   1 js
            FROM t_gg_sj_goods
            WHERE deptid='0301'
              AND goodsstateno='20'
              AND R_RECORD_IS_DELETED=0
            UNION ALL SELECT goodsid,-netweight,-sheetnum,
                                                 -1 js
            FROM t_zy_rk_inbilldetail
            WHERE deptid='0301'
              AND (intype='20'
                   OR intype IS NULL)
              AND firstindate>=to_date('2015/8/4','yyyy-mm-dd')
              AND goodsstateno='20'
            UNION ALL SELECT goodsid,-netweight,-sheetnum,
                                                 -1 js
            FROM T_GG_SJ_Goods
            WHERE deptid='0301'
              AND intype='60'
              AND firstindate>=to_date('2015/8/4','yyyy-mm-dd')
            UNION ALL SELECT goodsid,
                             netweight,
                             sheetnum,
                             1 js
            FROM t_zy_ck_outpack
            WHERE deptid='0301'
              AND goodsstateno IN ('40',
                                   '30')
              AND OutCustTime>=to_date('2015/8/4','yyyy-mm-dd')
            UNION ALL SELECT PROCMATERIALDTLID,
                             netweight,
                             sheetnum,
                             1 js
            FROM T_ZY_JG_ProcMaterialDtl
            WHERE deptid='0301'
              AND r_record_create_date>=to_date('2015/8/4','yyyy-mm-dd')) tbx
         GROUP BY goodsid) tb5 ON tb1.goodsid=tb5.goodsid ) ttt
   WHERE NOT (INWeight IS NULL
              AND OUTWeight IS NULL
              AND KCWeight = 0
              AND KCSheetnum = 0
              AND js = 0)
   GROUP BY STOCKFLAG) pp
LEFT JOIN
  ( SELECT substr(goodslocid,1,1)STOCKFLAG ,
           sum(netweight) ChangeOwnerWeight
   FROM t_zy_gh_changeownerdetail
   WHERE deptid='0301'
     AND r_record_create_date<TO_DATE('2015/8/4','yyyy-mm-dd')
     AND r_record_create_date>=to_date('2015/7/3','yyyy-mm-dd')
   GROUP BY substr(goodslocid,1,1)) GH ON pp.STOCKFLAG=GH.STOCKFLAG;

<file_sep>/schema/T_GU_GUB.sql
create schema T_GU_GUB_schema
source type CSV
fields(
 "gubillid"             type str,
 "deptid"               type str,
 "ownerid"              type str,
 "lenderid"             type str,
 "gutype"               type str,
 "sysbillid"            type str,
 "extbillid"            type str,
 "preenddate"           type DATETIME,
 "gubillstate"          type str,
 "weightsum"            type double,
 "sheetnumsum"          type double,
 "gubillmemo"           type str,
 "r_record_is_deleted"  type double,
 "r_record_create_user" type str,
 "r_record_create_date" type DATETIME,
 "r_record_update_user" type str,
 "r_record_update_date" type DATETIME,
 "r_record_change_flag" type double,
 "createdman"           type str,
 "ownername"            type str,
 "importfrom"           type str,
 "lendername"           type str,
 "releaseweight"        type double,
 "releasesheetnum"      type double
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "NULL";

CREATE PARSER T_GU_GUB_parser
TYPE rcd
SCHEMA T_GU_GUB_schema;

CREATE TABLE T_GU_GUB using T_GU_GUB_parser; 

CREATE INDEX T_GU_GUB_index ON TABLE T_GU_GUB (gubillid);<file_sep>/complete/JINSHANG-75/jinshang-75.sql

		SELECT
			NVL (GOODSID, 'null') AS GOODSID,
			NVL (DEPTID, 'null') AS DEPTID,
			(
				SELECT
					deptname
				FROM
					t_common_dept D
				WHERE
					D .deptid = G .deptid
			) AS DEPTNAME,
			NVL (BARCODE, 'null') AS BARCODE,
			NVL (GOODSLOCID, 'null') AS GOODSLOCID,
			NVL (
				DECODE (
					STOCKTYPE,
					'004001',
					'室内库',
					'004002',
					'室外库',
					NULL,
					'室内库'
				),
				'null'
			) AS STOCKTYPE,
			NVL (OWNERID, 'null') AS OWNERID,
			NVL (OWNERNAME, 'null') AS OWNERNAME,
			NVL (GOODSOWNERMANAGENO, 'null') AS GOODSOWNERMANAGENO,
			NVL (INBILLID, 'null') AS INBILLID,
			NVL (PACKNUM, 'null') AS PACKNUM,
			NVL (GOODSOWNERPACKNO, 'null') AS GOODSOWNERPACKNO,
			NVL (MANAGENO, 'null') AS MANAGENO,
			NVL (
				TO_CHAR (
					FEEBEGINDATE,
					'YYYY-MM-DD hh24:mi:ss'
				),
				'null'
			) AS FEEBEGINDATE,
			NVL (CONTRACTID, 'null') AS CONTRACTID,
			NVL (GOODSSTATENO, 'null') AS GOODSSTATENO,
			NVL (GOODSSTATENAME, 'null') AS GOODSSTATENAME,
			NVL (
				TO_CHAR (CHANGEOWNERTIMES),
				'null'
			) AS CHANGEOWNERTIMES,
			NVL (GOODSTYPE, 'null') AS GOODSTYPE,
			NVL (GOODSTYPENAME, 'null') AS GOODSTYPENAME,
			NVL (KINDNO, 'null') AS KINDNO,
			NVL (KINDNAME, 'null') AS KINDNAME,
			NVL (SHOPSIGNID, 'null') AS SHOPSIGNID,
			NVL (SHOPSIGNNAME, 'null') AS SHOPSIGNNAME,
			NVL (PRODAREAID, 'null') AS PRODAREAID,
			NVL (PRODAREANAME, 'null') AS PRODAREANAME,
			NVL (GOODSBATCHNO, 'null') AS GOODSBATCHNO,
			NVL (PRODSTOVENO, 'null') AS PRODSTOVENO,
			NVL (GRADENUM, 'null') AS GRADENUM,
			NVL (GRADENUMTHICK, 0) AS GRADENUMTHICK,
			NVL (
				TO_CHAR (GRADENUMWIDTH),
				'null'
			) AS GRADENUMWIDTH,
			NVL (
				TO_CHAR (GRADENUMLENGTH),
				'null'
			) AS GRADENUMLENGTH,
			NVL (GROSSWEIGHT, 0) AS GROSSWEIGHT,
			NVL (NETWEIGHT, 0) AS NETWEIGHT,
			NVL (POUNDWEIGHT, 0) AS POUNDWEIGHT,
			NVL (CHECKWEIGHT, 0) AS CHECKWEIGHT,
			NVL (SHEETNUM, 0) AS SHEETNUM,
			NVL (UNIT, 'null') AS UNIT,
			NVL (PACKTYPE, 'null') AS PACKTYPE,
			NVL (STOCKAREAID, 'null') AS STOCKAREAID,
			NVL (QUALITYMEMO, 'null') AS QUALITYMEMO,
			NVL (FIRSTINOWNERID, 'null') AS FIRSTINOWNERID,
			NVL (
				TO_CHAR (
					FIRSTINDATE,
					'YYYY-MM-DD hh24:mi:ss'
				),
				'null'
			) AS FIRSTINDATE,
			NVL (OUTBILLID, 'null') AS OUTBILLID,
			NVL (LDGLISTID, 'null') AS LDGLISTID,
			NVL (MATERIALGOODSID, 'null') AS MATERIALGOODSID,
			NVL (
				DECODE (
					INTYPE,
					'20',
					'正常入库',
					'50',
					'退货入库',
					'99',
					'其它'
				),
				'null'
			) AS INTYPE,
			NVL (OUTTYPE, 'null') AS OUTTYPE,
			NVL (TO_CHAR(BILLSTATE), 'null') AS BILLSTATE,
			NVL (
				TO_CHAR (
					OUTBILLTIME,
					'YYYY-MM-DD hh24:mi:ss'
				),
				'null'
			) AS OUTBILLTIME,
			NVL (MEMO, 'null') AS MEMO,
			NVL (SDPRICE, 'null') AS SDPRICE,
			NVL (SIDEMARK, 'null') AS TRUCKNO,
			NVL (
				TO_CHAR (
					OUTBILLTIME,
					'YYYY-MM-DD hh24:mi:ss'
				),
				'null'
			) AS OUTCUSTTIME,
			NVL (
				TO_CHAR (ROUND(SYSDATE - FIRSTINDATE)),
				'null'
			) AS STORAGEDAY,
			NVL (
				TO_CHAR (LENGTH_PRODUCT_MAX),
				'null'
			) AS LENGTHMAX
		FROM
			t_gg_sj_goods G
		WHERE
			1 = 1
		AND GOODSID = 'ww'
		AND PACKNUM = 'ww'
		AND deptId = 'ww'
<file_sep>/complete/JINSHANG-89&90/jinshang-90.sql
SELECT prodareaname,
       sum(netweightsum)
FROM t_gg_sj_goods
WHERE goodsstateno=20
  AND (deptid NOT LIKE '03%'
       AND deptid NOT LIKE 'ZZ%'
       AND deptid NOT LIKE 'MG%')
GROUP BY prodareaname;
<file_sep>/uncomplete/JINSHANG-104&106/jinshang-104.sql
SELECT kindname,
       sum(netweight) netweight,
       round(avg(sysdate-firstindate),0) avgday
FROM t_gg_sj_goods t
WHERE deptid='0106'
  AND goodsstateno=20
  AND EXISTS
    (SELECT 1
     FROM WL.T_OWNER W
     WHERE SEG_NO='00103'
       AND T.DEPTID=W.DEPTID
       AND t.ownerid=w.owner_id)
GROUP BY kindname;
<file_sep>/uncomplete/JINSHANG-79/jinshang-79.sql
SELECT to_char(sysdate,'yyyy-mm-dd hh24')||':00',
                                           sum(a),
                                           sum(b),
                                           sum(c)
FROM
  ( SELECT sum(netweightsum) a,
           0 b,
             0 c
   FROM t_zy_rk_inbill
   WHERE r_record_create_date>sysdate-1/24
   UNION ALL SELECT 0 a,
                      sum(netweightsum) b,
                      0 c
   FROM t_zy_ck_outbill
   WHERE r_record_create_date>sysdate-1/24
   UNION ALL SELECT 0 a,
                      0 b,
                        sum(netweightsum) c
   FROM t_zy_gh_changeownerlist
   WHERE r_record_create_date>sysdate-1/24);

<file_sep>/complete/JINSHANG-75/jql查询语句.sql
   SELECT Nvl(GOODSID, 'null')              AS GOODSID,
          Nvl(DEPTID, 'null')               AS DEPTID,
          VF_DEPTNAME                       AS DEPTNAME,
          Nvl(BARCODE, 'null')              AS BARCODE,
          Nvl(GOODSLOCID, 'null')           AS GOODSLOCID,
          Nvl(case INTYPE when '20' then '正常入库' when '50' then '退货入库' when '99' then '其它' end,'null')  			AS STOCKTYPE,
          Nvl(OWNERID, 'null')              AS OWNERID,
          Nvl(OWNERNAME, 'null')            AS OWNERNAME,
          Nvl(GOODSOWNERMANAGENO, 'null')   AS GOODSOWNERMANAGENO,
          Nvl(INBILLID, 'null')             AS INBILLID,
          Nvl(PACKNUM, 'null')              AS PACKNUM,
          Nvl(GOODSOWNERPACKNO, 'null')     AS GOODSOWNERPACKNO,
          Nvl(MANAGENO, 'null')             AS MANAGENO,
          Nvl(CONTRACTID, 'null')           AS CONTRACTID,
          Nvl(GOODSSTATENO, 'null')         AS GOODSSTATENO,
          Nvl(GOODSSTATENAME, 'null')       AS GOODSSTATENAME,
          CHANGEOWNERTIMES	         		AS CHANGEOWNERTIMES,
          Nvl(GOODSTYPE, 'null')            AS GOODSTYPE,
          Nvl(GOODSTYPENAME, 'null')        AS GOODSTYPENAME,
          Nvl(KINDNO, 'null')               AS KINDNO,
          Nvl(KINDNAME, 'null')             AS KINDNAME,
          Nvl(SHOPSIGNID, 'null')           AS SHOPSIGNID,
          Nvl(SHOPSIGNNAME, 'null')         AS SHOPSIGNNAME,
          Nvl(PRODAREAID, 'null')           AS PRODAREAID,
          Nvl(PRODAREANAME, 'null')         AS PRODAREANAME,
          Nvl(GOODSBATCHNO, 'null')         AS GOODSBATCHNO,
          Nvl(PRODSTOVENO, 'null')          AS PRODSTOVENO,
          Nvl(GRADENUM, 'null')             AS GRADENUM,
          Nvl(GRADENUMTHICK, 0)             AS GRADENUMTHICK,
          Nvl(GROSSWEIGHT, 0)               AS GROSSWEIGHT,
          Nvl(NETWEIGHT, 0)                 AS NETWEIGHT,
          Nvl(POUNDWEIGHT, 0)               AS POUNDWEIGHT,
          Nvl(CHECKWEIGHT, 0)               AS CHECKWEIGHT,
          Nvl(SHEETNUM, 0)                  AS SHEETNUM,
          Nvl(UNIT, 'null')                 AS UNIT,
          Nvl(PACKTYPE, 'null')             AS PACKTYPE,
          Nvl(STOCKAREAID, 'null')          AS STOCKAREAID,
          Nvl(QUALITYMEMO, 'null')          AS QUALITYMEMO,
          Nvl(FIRSTINOWNERID, 'null')       AS FIRSTINOWNERID,
          Nvl(OUTBILLID, 'null')            AS OUTBILLID,
          Nvl(LDGLISTID, 'null')            AS LDGLISTID,
          Nvl(MATERIALGOODSID, 'null')      AS MATERIALGOODSID,
          Nvl(case STOCKTYPE when '004001' then '室内库' when '004002' then '室外库' when 'NULL' then '室内库' end, 'null')          		AS INTYPE,
          Nvl(OUTTYPE, 'null')              AS OUTTYPE,
          Nvl(BILLSTATE, 'null')   			AS BILLSTATE,
          Nvl(MEMO, 'null')                 AS MEMO,
          Nvl(SDPRICE, 'null')              AS SDPRICE,
          Nvl(SIDEMARK, 'null')             AS TRUCKNO
   FROM   t_gg_sj_goods;

<file_sep>/schema/T_ZY_JS_SETTLEMENTDETAIL.sql
create schema T_ZY_JS_SETTLEMENTDETAIL_schema
SOURCE TYPE CSV
FIELDS(
"manageno" type str,
"deptid" type str,
"settleno" type str,
"settlecd" type str,
"goodsid" type str,
"packnum" type str,
"node" type str,
"nodename" type str,
"businesstype" type str,
"businesstypename" type str,
"businessno" type str,
"feetype" type str,
"feetypename" type str,
"settleformula" type str,
"countunit" type double,
"settlenum" type double,
"settlesum" type double,
"unit" type str,
"weight" type double,
"grossweight" type double,
"generatedate" type DATETIME,
"priceno" type str,
"state" type double,
"deptno" type str,
"deptname" type str,
"ownerno" type str,
"ownername" type str,
"resourceno" type str,
"pregoodsid" type str,
"memo" type str,
"sendflag" type double,
"r_record_create_date" type DATETIME,
"r_record_create_user" type str,
"r_record_update_date" type DATETIME,
"r_record_update_user" type str,
"r_record_is_deleted" type double,
"invoicekindid" type str,
"invoicekindname" type str,
"r_record_change_flag" type double,
"settle_contract_id" type str,
"settle_contract_no" type str,
"sub_biz_type_id" type str,
"sub_biz_type_name" type str,
"first_in_date" type DATETIME,
"out_store_date" type DATETIME,
"free_days" type double,
"receive_fee" type double,
"jgbusinessno" type str,
"paytype" type str,
"billempname" type str,
"firstcountunit" type double,
"addfeelink" type str,
"settlelock" type str,
"jyzxflag" type double,
"foreignlistno" type str,
"yts" type double,
"mts" type double,
"direction" type str,
"settlesumused" type double,
"settledeptname" type str,
"kpamount" type double,
"username" type str,
"settlesumtax" type double,
"settlesumnotax" type double,
"cbcountunit" type double,
"cbsettlesum" type double,
"dtlinvoiceno" type str,
"invoicenodate" type str,
"dtlinvoicetypename" type str
)
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_JS_SETTLEMENTDETAIL_parser
TYPE rcd
SCHEMA T_ZY_JS_SETTLEMENTDETAIL_schema;

CREATE TABLE T_ZY_JS_SETTLEMENTDETAIL using T_ZY_JS_SETTLEMENTDETAIL_parser; 

create index T_ZY_JS_SETTLEMENTDETAIL_index on table T_ZY_JS_SETTLEMENTDETAIL(manageno);<file_sep>/complete/JINSHANG-84/jinshang-84.sql
SELECT cl.lock_flag,sum(net_weight),COUNT *
FROM wmsdba.t_tm_check_goods_log cl
WHERE sys_id = 'STM06'
  AND CREATE_DATE>to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
GROUP BY cl.lock_flag;

<file_sep>/schema/T_ZY_JG_PROCMATERIALDTL.sql
create schema T_ZY_JG_PROCMATERIALDTL_schema
SOURCE TYPE CSV
FIELDS(
"procmaterialdtlid" type str,
"deptid" type str,
"processid" type str,
"packnum" type str,
"goodsid" type str,
"barcode" type str,
"goodslocid" type str,
"ownerid" type str,
"ownername" type str,
"goodsownermanageno" type str,
"goodsownerpackno" type str,
"manageno" type str,
"feebegindate" type datetime,
"contractid" type str,
"goodsstateno" type str,
"goodsstatename" type str,
"changeownertimes" type double,
"goodstype" type str,
"goodstypename" type str,
"kindno" type str,
"kindname" type str,
"shopsignid" type str,
"shopsignname" type str,
"prodareaid" type str,
"prodareaname" type str,
"goodsbatchno" type str,
"prodstoveno" type str,
"gradenum" type str,
"gradenumthick" type double,
"gradenumwidth" type double,
"gradenumlength" type double,
"grossweight" type double,
"netweight" type double,
"poundweight" type double,
"checkweight" type double,
"sheetnum" type double,
"packtype" type str,
"packtypename" type str,
"unit" type str,
"qualitymemo" type str,
"firstinownerid" type str,
"firstindate" type datetime,
"inbillid" type str,
"intype" type str,
"r_record_create_date" type datetime,
"r_record_create_user" type str,
"r_record_update_date" type datetime,
"r_record_update_user" type str,
"r_record_is_deleted" type double,
"orderby" type double,
"r_record_change_flag" type double,
"shopsigncd" type str,
"customerid" type str,
"chanxian" type str,
"ply" type double,
"memo" type str,
"jyzxflag" type double,
"loclv1" type str,
"loclv2" type str,
"specialmemo" type str
)
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_JG_PROCMATERIALDTL_parser
TYPE rcd
SCHEMA T_ZY_JG_PROCMATERIALDTL_schema;

CREATE TABLE T_ZY_JG_PROCMATERIALDTL using T_ZY_JG_PROCMATERIALDTL_parser;

create index T_ZY_JG_PROCMATERIALDTL_index on table T_ZY_JG_PROCMATERIALDTL(procmaterialdtlid);
<file_sep>/schema/T_ZY_RK_INBILL.sql
create schema T_ZY_RK_INBILL_schema
SOURCE TYPE CSV
FIELDS(
"inbillid" type str,
"deptid" type str,
"foreignlistno" type str,
"goodsbatchno" type str,
"intype" type str,
"feebegindate" type DATETIME,
"incusttime" type DATETIME,
"inbillownername" type str,
"inbillownerno" type str,
"inbillempno" type str,
"inbillempname" type str,
"inbilltime" type DATETIME,
"inbillmemo" type str,
"kindno" type str,
"kindname" type str,
"shopsignname" type str,
"prodareaname" type str,
"prodareaid" type str,
"remanageno" type str,
"shopsignid" type str,
"truckgroupname" type str,
"truckgroupno" type str,
"planno" type str,
"manageno" type str,
"sheetnumsum" type double,
"grossweightsum" type double,
"netweightsum" type double,
"goodsownermanageno" type str,
"firstindate" type DATETIME,
"gradenum" type str,
"r_record_create_date" type DATETIME,
"r_record_create_user" type str,
"r_record_update_date" type DATETIME,
"r_record_update_user" type str,
"r_record_is_deleted" type double,
"stocktype" type str,
"r_record_change_flag" type double,
"rktype" type str,
"trans_type" type str,
"finish_date" type DATETIME,
"check_date" type DATETIME,
"check_type" type str,
"sort_emp" type str,
"check_emp" type str,
"loclv1" type str,
"loclv2" type str,
"dcemp" type str,
"qzemp" type str,
"dcemp2" type str,
"sendmessage" type str,
"dtlcount" type double,
"sidemark" type str,
"ischecked" type double,
"sheetsumsum" type double,
"issettled" type double,
"handno" type str,
"saveno" type str,
"deptfrom" type str,
"jfsendflag" type double,
"checkdtlcount" type double
)
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_ZY_RK_INBILL_parser
TYPE rcd
SCHEMA T_ZY_RK_INBILL_schema;

CREATE TABLE T_ZY_RK_INBILL using T_ZY_RK_INBILL_parser; 

create index T_ZY_RK_INBILL_index on table T_ZY_RK_INBILL(inbillid);<file_sep>/schema/T_TM_CHECK_GOODS_LOG.sql
CREATE SCHEMA T_TM_CHECK_GOODS_LOG_schema
SOURCE TYPE CSV
FIELDS(                                                          
"request_sn"                                               type str,
"sys_id"                                                   type str,
"dept_id"                                                  type str,
"owner_id"                                                 type str,
"resource_num"                                             type str,
"pack_num"                                                 type str,
"goods_id"                                                 type str,
"act_type"                                                 type str,
"net_weight"                                               type double,
"gross_weight"                                             type double,
"create_date"                                              type datetime,
"business_type"                                            type str,
"stm_good_id"                                              type str,
"spec"                                                     type str,
"wprovider_id"                                             type str,
"wprovider_name"                                           type str,
"owner_name"                                               type str,
"provider_id"                                              type str,
"provider_name"                                            type str,
"kindname"                                                 type str,
"shopsignname"                                             type str,
"prodareaname"                                             type str,
"gradenumthick"                                            type double,
"gradenumwidth"                                            type double,
"gradenumlength"                                           type double,
"lock_flag"                                                type str,
"result_message"                                           type str,
"matching_rules"                                           type str,
"used_time"                                                type double,
"wms_resource_num"                                         type str,
"wms_pack_num"                                             type str,
"goodslocid"                                               type str,
"barcode"                                                  type str,
"wms_goods_id"                                             type str,
"modi_date"                                                type datetime,
"remark"                                                   type str,
"access_plat"                                              type str,
"goods_owner_id"                                           type str,
"vas_member_id"                                            type str,
"kind_no"                                                  type str,
"plan_qty"                                                 type double,
"rule_type"                                                type str,
"check_rules"                                              type str,
"wms_net_weight"                                           type double,
"wms_qty"                                                  type double,
"pack_flag"                                                type str
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_TM_CHECK_GOODS_LOG_parser
TYPE rcd
SCHEMA T_TM_CHECK_GOODS_LOG_schema;

CREATE TABLE T_TM_CHECK_GOODS_LOG using T_TM_CHECK_GOODS_LOG_parser;

CREATE INDEX T_TM_CHECK_GOODS_LOG_index ON TABLE T_TM_CHECK_GOODS_LOG (request_sn); 

<file_sep>/processing/JINSHANG-76/jinshang-76.sql
SELECT *
FROM
  ( SELECT rownum AS rownum_,
           aa.*
   FROM
     ( SELECT /*+ index(g,T_GG_SJ_GOODS_INDX02) */ nvl (DEPTID, 'null') AS DEPTID,

        ( SELECT deptname
         FROM wmsdba.t_common_dept d
         WHERE d.deptid = g.deptid ) AS DEPTNAME,
                                                   nvl (GRADENUM, 'null') AS GRADENUM,
                                                   nvl (SHOPSIGNID, 'null') AS SHOPSIGNID,
                                                   nvl (SHOPSIGNNAME, 'null') AS SHOPSIGNNAME,
                                                   nvl (PRODAREAID, 'null') AS PRODAREAID,
                                                   nvl (PRODAREANAME, 'null') AS PRODAREANAME,
                                                   nvl (KINDNO, 'null') AS KINDNO,
                                                   nvl (KINDNAME, 'null') AS KINDNAME,
                                                   nvl (ownername, 'null') AS OWNERSHORT,
                                                   nvl (GOODSOWNERPACKNO, 'null') AS GOODSOWNERPACKNO,
                                                   nvl (SUM(NETWEIGHT), 0) AS NETWEIGHT,
                                                   nvl (SUM(GROSSWEIGHT), 0) AS GROSSWEIGHT,
                                                   nvl (SUM(SHEETNUM), 0) AS SHEETNUM
      FROM wmsdba.t_gg_sj_goods g
      WHERE 1 = 1
        AND ( DEPTID LIKE DECODE (
                                    ( SELECT COUNT(1)
                                     FROM wmsdba.t_bm_ui_configure c
                                     WHERE c.configure_no = 'COMM'
                                       AND DEPTID = '0301' ), 0, substr('0301', 0, 2) || '%','0301' ) )
        AND goodsstateno = '20'
        AND KINDNAME LIKE '%' || '²»Ðâ¸ÖÏß²Ä' || '%'
        AND SHOPSIGNNAME LIKE '%' || 'MR T-2.5BA' || '%'
        AND GRADENUM LIKE '%' || '11' || '%'
        AND PRODAREANAME LIKE '%' || 'ºª¸Ö' || '%'
      GROUP BY g.deptid,
               GRADENUM,
               SHOPSIGNID,
               SHOPSIGNNAME,
               PRODAREAID,
               PRODAREANAME,
               KINDNO,
               KINDNAME,
               ownername,
               GOODSOWNERPACKNO ) aa )
WHERE rownum_ > 0
  AND rownum_ <= 10<file_sep>/complete/JINSHANG-102/zidonghua.sql
t_zy_ck_clear_insert_q1=begin
dataset file T_ZY_CK_CLEAR1_1_dataset
(
	schema: "T_ZY_CK_CLEAR_schema",
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_ck_clear/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_CK_CLEAR_syncher
(
    inputs: T_ZY_CK_CLEAR1_1_dataset,
    database:db,
    operator:add, 
    table:T_ZY_CK_CLEAR
);
end

t_zy_jg_process_insert_q1=begin
dataset file T_ZY_JG_PROCESS1_1_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_process/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCESS_syncher
(
    inputs: T_ZY_JG_PROCESS1_1_dataset,
    database:db,
    operator:add, 
    table:T_ZY_JG_PROCESS
);
end

t_gg_sj_goods_insert_q1=begin
dataset file T_GG_SJ_GOODS2_dataset
(
	schema: "T_GG_SJ_GOODS_schema",
    filename: "/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);
dataproc syncher T_GG_SJ_GOODS_syncher
(
    inputs: T_GG_SJ_GOODS2_dataset,
    database:db,
    operation:add, 
    table:T_GG_SJ_GOODS,
	stream:true,
	services : 
	(
		(dataprocname : T_GG_SJ_GOODS_dataset,
		serviceid: idx_job)
	)
);
end

t_zy_rk_inbilldetail_insert_q1=begin
dataset file T_ZY_RK_INBILLDETAIL2_dataset
(
	schema: T_ZY_RK_INBILLDETAIL_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_rk_inbilldetail/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_RK_INBILLDETAIL_syncher
(
    inputs: T_ZY_RK_INBILLDETAIL2_dataset,
    database:db,
    operation:add, 
    table:T_ZY_RK_INBILLDETAIL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_RK_INBILLDETAIL_dataset,
		serviceid: idx_job)
	)
);
end

t_zy_jg_procarticledtl_insert_q1=begin
dataset file T_ZY_JG_PROCARTICLEDTL2_dataset
(
	schema: T_ZY_JG_PROCARTICLEDTL_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_procarticledtl/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCARTICLEDTL_syncher
(
    inputs: T_ZY_JG_PROCARTICLEDTL2_dataset,
    database:db,
    operation:add, 
    table:T_ZY_JG_PROCARTICLEDTL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_JG_PROCARTICLEDTL_dataset,
		serviceid: idx_job)
	)
);
end

t_zy_gh_changeownerlist_insert_q1=begin
dataset file T_ZY_GH_CHANGEOWNERLIST2_dataset
(
	schema: T_ZY_GH_CHANGEOWNERLIST_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_gh_changeownerlist/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_GH_CHANGEOWNERLIST_syncher
(
    inputs: T_ZY_GH_CHANGEOWNERLIST2_dataset,
    database:db,
    operation:add, 
    table:T_ZY_GH_CHANGEOWNERLIST,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_GH_CHANGEOWNERLIST_dataset,
		serviceid: idx_job)
	)
);
end

t_zy_jg_procmaterialdtl_insert_q1=begin
dataset file T_ZY_JG_PROCMATERIALDTL2_dataset
(
	schema: T_ZY_JG_PROCMATERIALDTL_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_procmaterialdtl/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCMATERIALDTL_syncher
(
    inputs: T_ZY_JG_PROCMATERIALDTL2_dataset,
    database:db,
    operation:add, 
    table:T_ZY_JG_PROCMATERIALDTL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_JG_PROCMATERIALDTL_dataset,
		serviceid: idx_job)
	)
);
end

t_zy_gh_changeownerdetail_insert_q1=begin
dataset file T_ZY_GH_CHANGEOWNERDETAIL2_dataset
(
	schema: T_ZY_GH_CHANGEOWNERDETAIL_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_gh_changeownerdetail/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_GH_CHANGEOWNERDETAIL_syncher
(
    inputs: T_ZY_GH_CHANGEOWNERDETAIL2_dataset,
    database:db,
    operation:add, 
    table:T_ZY_GH_CHANGEOWNERDETAIL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_GH_CHANGEOWNERDETAIL_dataset,
		serviceid: idx_job)
	)
);
end

t_zy_ck_outpack_insert_q1=begin
dataset file T_ZY_CK_OUTPACK2_dataset
(
	schema: T_ZY_CK_OUTPACK_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_ck_outpack/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_CK_OUTPACK_syncher
(
    inputs: T_ZY_CK_OUTPACK2_dataset,
    database:db,
    operation:add, 
    table:T_ZY_CK_OUTPACK,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_CK_OUTPACK_dataset,
		serviceid: idx_job)
	)
);
end



t_zy_ck_clear_delete_q1=begin
dataset file T_ZY_CK_CLEAR2_1_dataset
(
	schema: "T_ZY_CK_CLEAR_schema",
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_ck_clear/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_CK_CLEAR_syncher
(
    inputs: T_ZY_CK_CLEAR2_1_dataset,
    database:db,
    operator:delete, 
    table:T_ZY_CK_CLEAR
);
end

t_zy_jg_process_delete_q1=begin
dataset file T_ZY_JG_PROCESS2_1_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_process/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCESS_syncher
(
    inputs: T_ZY_JG_PROCESS2_1_dataset,
    database:db,
    operator:delete, 
    table:T_ZY_JG_PROCESS
);
end

t_gg_sj_goods_delete_q1=begin
dataset file T_GG_SJ_GOODS3_dataset
(
	schema: "T_GG_SJ_GOODS_schema",
    filename: "/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);
dataproc syncher T_GG_SJ_GOODS_syncher
(
    inputs: T_GG_SJ_GOODS3_dataset,
    database:db,
    operation:delete, 
    table:T_GG_SJ_GOODS,
	stream:true,
	services : 
	(
		(dataprocname : T_GG_SJ_GOODS_del_dataset,
		serviceid: idx_job1)
	)
);
end

t_zy_rk_inbilldetail_delete_q1=begin
dataset file T_ZY_RK_INBILLDETAIL3_dataset
(
	schema: T_ZY_RK_INBILLDETAIL_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_rk_inbilldetail/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_RK_INBILLDETAIL_syncher
(
    inputs: T_ZY_RK_INBILLDETAIL3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_RK_INBILLDETAIL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_RK_INBILLDETAIL_del_dataset,
		serviceid: idx_job1)
	)
);
end

t_zy_jg_procarticledtl_delete_q1=begin
dataset file T_ZY_JG_PROCARTICLEDTL3_dataset
(
	schema: T_ZY_JG_PROCARTICLEDTL_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_procarticledtl/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCARTICLEDTL_syncher
(
    inputs: T_ZY_JG_PROCARTICLEDTL3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_JG_PROCARTICLEDTL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_JG_PROCARTICLEDTL_del_dataset,
		serviceid: idx_job1)
	)
);
end

t_zy_gh_changeownerlist_delete_q1=begin
dataset file T_ZY_GH_CHANGEOWNERLIST3_dataset
(
	schema: T_ZY_GH_CHANGEOWNERLIST_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_gh_changeownerlist/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_GH_CHANGEOWNERLIST_syncher
(
    inputs: T_ZY_GH_CHANGEOWNERLIST3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_GH_CHANGEOWNERLIST,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_GH_CHANGEOWNERLIST_del_dataset,
		serviceid: idx_job1)
	)
);
end

t_zy_jg_procmaterialdtl_delete_q1=begin
dataset file T_ZY_JG_PROCMATERIALDTL3_dataset
(
	schema: T_ZY_JG_PROCMATERIALDTL_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_procmaterialdtl/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCMATERIALDTL_syncher
(
    inputs: T_ZY_JG_PROCMATERIALDTL3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_JG_PROCMATERIALDTL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_JG_PROCMATERIALDTL_del_dataset,
		serviceid: idx_job1)
	)
);
end

t_zy_gh_changeownerdetail_delete_q1=begin
dataset file T_ZY_GH_CHANGEOWNERDETAIL3_dataset
(
	schema: T_ZY_GH_CHANGEOWNERDETAIL_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_gh_changeownerdetail/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_GH_CHANGEOWNERDETAIL_syncher
(
    inputs: T_ZY_GH_CHANGEOWNERDETAIL3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_GH_CHANGEOWNERDETAIL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_GH_CHANGEOWNERDETAIL_del_dataset,
		serviceid: idx_job1)
	)
);
end

t_zy_ck_outpack_delete_q1=begin
dataset file T_ZY_CK_OUTPACK3_dataset
(
	schema: T_ZY_CK_OUTPACK_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_ck_outpack/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_CK_OUTPACK_syncher
(
    inputs: T_ZY_CK_OUTPACK3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_CK_OUTPACK,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_CK_OUTPACK_del_dataset,
		serviceid: idx_job1)
	)
);
end

<file_sep>/schema/T_OWNER.sql
CREATE SCHEMA T_OWNER_schema
SOURCE TYPE CSV
FIELDS(                                                          
"seg_no"                                                   type str,
"owner_num"                                                type str,
"dept_id"                                                  type str,
"wprovider_id"                                             type str,
"owner_id"                                                 type str,
"dept_subid"                                               type str,
"use_flag"                                                 type str default value '0',
"wprovider_desc"                                           type str,
"memberid"                                                 type str,
"wprovider_id_n"                                           type str,
"deptid"                                                   type str,
"wprovider_address"                                        type str,
"if_branch"                                                type str
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM"; 
                                                       
CREATE PARSER T_OWNER_parser
TYPE rcd
SCHEMA T_OWNER_schema;

CREATE TABLE T_OWNER using T_OWNER_parser;

CREATE INDEX T_OWNER_index ON TABLE T_OWNER (seg_no); 

<file_sep>/complete/JINSHANG-76/1_schema_jinshang76.sql
CREATE DATABASE db;
USE db;

create schema T_COMMON_DEPT_schema
source type CSV
fields(
 "deptid"                type str,
 "deptcd"                type str,
 "deptname"              type str,
 "deptlevel"             type double,
 "deptdesc"              type str,
 "deptorder"             type double,
 "parentdeptid"          type str,
 "level1deptid"          type str,
 "level1deptcd"          type str,
 "level1deptname"        type str,
 "level2deptid"          type str,
 "level2deptcd"          type str,
 "level2deptname"        type str,
 "level3deptid"          type str,
 "level3deptcd"          type str,
 "level3deptname"        type str,
 "level4deptid"          type str,
 "level4deptcd"          type str,
 "level4deptname"        type str,
 "r_record_create_date"  type DATETIME,
 "r_record_create_user"  type str,
 "r_record_update_date"  type DATETIME,
 "r_record_update_user"  type str,
 "r_record_is_deleted"   type double,
 "r_record_change_flag"  type double,
 "deptaddress"           type str,
 "depttype"              type str default value  '22',
 "districtid"            type str,
 "districtname"          type str,
 "belongarea"            type str,
 "firstdis"              type str,
 "opselected"            type str default value '0',
 "opupload"              type str,
 "limittime"             type DATETIME,
 "contractno"            type str,
 "baosaas_customer_name" type str
)
RECORD DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_COMMON_DEPT_parser
TYPE rcd
SCHEMA T_COMMON_DEPT_schema;

CREATE TABLE T_COMMON_DEPT using T_COMMON_DEPT_parser; 

CREATE INDEX T_COMMON_DEPT_index ON TABLE T_COMMON_DEPT PRIMARY KEY(deptid);

CREATE MAP T_COMMON_DEPT_map ON table T_COMMON_DEPT
KEY (deptid) 
VALUE (deptname)
TYPE string;

create schema T_BM_UI_CONFIGURE_schema
source type CSV
fields(
  "manage_no"            type str,
  "deptid"               type str,
  "configure_no"         type str,
  "configure_desc"       type str,
  "configure_grade"      type str,
  "configure_node_no"    type str,
  "cf_value1"            type str,
  "cf_value2"            type str,
  "cf_value3"            type double,
  "cf_value4"            type double,
  "configure_remark"     type str,
  "r_record_create_date" type DATETIME,
  "r_record_create_user" type str,
  "r_record_update_date" type DATETIME,
  "r_record_update_user" type str,
  "r_record_is_deleted"  type double,
  "r_record_change_flag" type double,
  "cf_value5"            type DATETIME
)
RECORD DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_BM_UI_CONFIGURE_parser
TYPE rcd
SCHEMA T_BM_UI_CONFIGURE_schema;

CREATE TABLE T_BM_UI_CONFIGURE using T_BM_UI_CONFIGURE_parser; 

CREATE INDEX T_BM_UI_CONFIGURE_index ON TABLE T_BM_UI_CONFIGURE PRIMARY KEY(manage_no);

CREATE MAP T_BM_UI_CONFIGURE_map ON table T_BM_UI_CONFIGURE
KEY (1) 
VALUE (count(1))
TYPE u64
where configure_no = 'RPCONFIG' and deptid = '101';


create schema T_GG_SJ_GOODS_schema
source type CSV
fields(
 "goodsid"              type str,
 "deptid"               type str,
 "packnum"              type str,
 "barcode"              type str,
 "goodslocid"           type str,
 "stocktype"            type str,
 "ownerid"              type str,
 "ownername"            type str,
 "goodsownermanageno"   type str,
 "inbillid"             type str,
 "goodsownerpackno"     type str,
 "manageno"             type str,
 "feebegindate"         type DATETIME,
 "contractid"           type str,
 "goodsstateno"         type str,
 "goodsstatename"       type str,
 "changeownertimes"     type double default value '0',
 "goodstype"            type str,
 "goodstypename"        type str,
 "kindno"               type str,
 "kindname"             type str,
 "shopsignid"           type str,
 "shopsignname"         type str,
 "prodareaid"           type str,
 "prodareaname"         type str,
 "goodsbatchno"         type str,
 "prodstoveno"          type str,
 "gradenum"             type str,
 "gradenumthick"        type double,
 "gradenumwidth"        type double,
 "gradenumlength"       type double,
 "grossweight"          type double,
 "netweight"            type double,
 "poundweight"          type double,
 "checkweight"          type double,
 "sheetnum"             type double default value '1',
 "unit"                 type str,
 "packtype"             type str,
 "stockareaid"          type str,
 "qualitymemo"          type str,
 "firstinownerid"       type str,
 "firstindate"          type DATETIME,
 "outbillid"            type str,
 "ldglistid"            type str,
 "materialgoodsid"      type str,
 "intype"               type str,
 "outtype"              type str,
 "billstate"            type double,
 "outbilltime"          type DATETIME,
 "memo"                 type str,
 "extsysplanobjectid"   type str,
 "extsyskindid"         type str,
 "extsysshopsignid"     type str,
 "extsysprodareaid"     type str,
 "foreignlistno"        type str,
 "sendflag"             type double,
 "r_record_create_date" type DATETIME,
 "r_record_create_user" type str,
 "r_record_update_date" type DATETIME,
 "r_record_update_user" type str,
 "r_record_is_deleted"  type double,
 "incusttime"           type DATETIME,
 "sidemark"             type str,
 "temp"                 type str,
 "length_product_max"   type double,
 "heat_num"             type str,
 "test_lot_num"         type str,
 "r_record_change_flag" type double,
 "sdprice"              type str,
 "extsysgradenum"       type str,
 "collectionmanname"    type str,
 "lockflag"             type str,
 "check_type"           type str,
 "outdate"              type DATETIME,
 "yfweight"             type double,
 "yfsheet"              type double,
 "pregoodsid"           type str,
 "issplit"              type double,
 "gradenumxh"           type double,
 "gradenumwhdw"         type str,
 "splittime"            type double,
 "isclear"              type double,
 "singlesheetnum"       type double,
 "gradenumhz"           type str,
 "gradenumthickhz"      type double,
 "singlesheet"          type double,
 "loclv1"               type str,
 "singlesheetunit"      type str,
 "dcemp"                type str,
 "qzemp"                type str,
 "dcemp2"               type str,
 "shipno"               type str,
 "shipname"             type str,
 "shipcd"               type str,
 "shiplevel"            type str,
 "cmmemo"               type str,
 "cmmemock"             type str,
 "shopsigncd"           type str,
 "processtypename"      type str,
 "packtypename"         type str,
 "sort_emp"             type str,
 "customerid"           type str,
 "lvgoodsid"            type str,
 "dispersesheet"        type double,
 "dbdeptid"             type str,
 "dbcustomer"           type str,
 "dbgulender"           type str,
 "locked_object"        type str,
 "locked_date"          type DATETIME,
 "unlocked_date"        type DATETIME,
 "preownername"         type str,
 "ply"                  type double default value '0',
 "tdstate"              type str default value '1',
 "opselected"           type str,
 "oplock"               type str,
 "opinupload"           type str,
 "opchangeupload"       type str,
 "opinbatchid"          type str,
 "opchangebatchid"      type str,
 "opinupload_date"      type DATETIME,
 "out_package_status"   type str,
 "out_package_desc"     type str,
 "gmpacktype"           type str,
 "handno"               type str,
 "saveno"               type str,
 "drawno"               type str,
 "dangerouslevel"       type str,
 "acceptancecriteria"   type str,
 "shippingmark"         type str,
 "loclv2"               type str,
 "payedflag"            type str,
 "ordergoodsownerid"    type str,
 "ordergoodsownername"  type str,
 "vf_deptname" type `expr` data type string value  iilmap("T_COMMON_DEPT_map",deptid),
 "vf_count" type `expr` data type string value iilmap("T_BM_UI_CONFIGURE_map",1)
)
RECORD DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM";

CREATE PARSER T_GG_SJ_GOODS_parser
TYPE rcd
SCHEMA T_GG_SJ_GOODS_schema;

CREATE TABLE T_GG_SJ_GOODS using T_GG_SJ_GOODS_parser;

create schema T_GG_SJ_GOODS1_schema
source type CSV
fields(
 "deptid"              type str,
 "vf_deptname"         type str,
 "gradenum"            type str,
 "shopsignid"          type str,
 "shopsignname"        type str,
 "prodareaid"          type str,
 "prodareaname"        type str,
 "kindno"              type str,
 "kindname"            type str,
 "ownername"           type str,
 "goodsownerpackno"    type str,
 "sumnetweight"        type str,
 "sumgrossweight"      type str,
 "sumsheetnum"         type str,
 "vf_count"            type str,
 "vf_countcase"        type str
  )
RECORD DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM"; 

CREATE PARSER T_GG_SJ_GOODS1_parser
TYPE rcd
SCHEMA T_GG_SJ_GOODS1_schema; 
  
CREATE TABLE T_GG_SJ_GOODS1 using T_GG_SJ_GOODS1_parser;

CREATE INDEX T_GG_SJ_GOODS1_index ON TABLE T_GG_SJ_GOODS1 PRIMARY KEY(goodsownerpackno);
<file_sep>/complete/JINSHANG-88/jinshang-88.sql
SELECT sum(t.netweightsum),	COUNT (*)
FROM t_zy_gh_changeownerlist t
WHERE R_RECORD_CREATE_DATE>to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')
  AND t.jyzxflag=1;

<file_sep>/complete/JINSHANG-102/del.sql
create job t_zy_ck_clear_delete_q1(zykie)
begin
dataset file T_ZY_CK_CLEAR2_1_dataset
(
	schema: "T_ZY_CK_CLEAR_schema",
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_ck_clear/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_CK_CLEAR_syncher
(
    inputs: T_ZY_CK_CLEAR2_1_dataset,
    database:db,
    operator:delete, 
    table:T_ZY_CK_CLEAR
);
end;
run job t_zy_ck_clear_delete_q1(threads:8);

create job t_zy_jg_process_delete_q1(zykie)
begin
dataset file T_ZY_JG_PROCESS2_1_dataset
(
	schema: T_ZY_JG_PROCESS_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_process/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCESS_syncher
(
    inputs: T_ZY_JG_PROCESS2_1_dataset,
    database:db,
    operator:delete, 
    table:T_ZY_JG_PROCESS
);
end;
run job t_zy_jg_process_delete_q1(threads:8);

create job t_gg_sj_goods_delete_q1(zykie)
begin
dataset file T_GG_SJ_GOODS3_dataset
(
	schema: "T_GG_SJ_GOODS_schema",
    filename: "/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);
dataproc syncher T_GG_SJ_GOODS_syncher
(
    inputs: T_GG_SJ_GOODS3_dataset,
    database:db,
    operation:delete, 
    table:T_GG_SJ_GOODS,
	stream:true,
	services : 
	(
		(dataprocname : T_GG_SJ_GOODS_del_dataset,
		serviceid: idx_job1)
	)
);
end;
run job t_gg_sj_goods_delete_q1(threads:8);

create job t_zy_rk_inbilldetail_delete_q1(zykie)
begin
dataset file T_ZY_RK_INBILLDETAIL3_dataset
(
	schema: T_ZY_RK_INBILLDETAIL_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_rk_inbilldetail/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_RK_INBILLDETAIL_syncher
(
    inputs: T_ZY_RK_INBILLDETAIL3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_RK_INBILLDETAIL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_RK_INBILLDETAIL_del_dataset,
		serviceid: idx_job1)
	)
);
end;
run job t_zy_rk_inbilldetail_delete_q1(threads:8);

create job t_zy_jg_procarticledtl_delete_q1(zykie)
begin
dataset file T_ZY_JG_PROCARTICLEDTL3_dataset
(
	schema: T_ZY_JG_PROCARTICLEDTL_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_procarticledtl/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCARTICLEDTL_syncher
(
    inputs: T_ZY_JG_PROCARTICLEDTL3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_JG_PROCARTICLEDTL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_JG_PROCARTICLEDTL_del_dataset,
		serviceid: idx_job1)
	)
);
end;
run job t_zy_jg_procarticledtl_delete_q1(threads:8);

create job t_zy_gh_changeownerlist_delete_q1(zykie)
begin
dataset file T_ZY_GH_CHANGEOWNERLIST3_dataset
(
	schema: T_ZY_GH_CHANGEOWNERLIST_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_gh_changeownerlist/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_GH_CHANGEOWNERLIST_syncher
(
    inputs: T_ZY_GH_CHANGEOWNERLIST3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_GH_CHANGEOWNERLIST,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_GH_CHANGEOWNERLIST_del_dataset,
		serviceid: idx_job1)
	)
);
end;
run job t_zy_gh_changeownerlist_delete_q1(threads:8);

create job t_zy_jg_procmaterialdtl_delete_q1(zykie)
begin
dataset file T_ZY_JG_PROCMATERIALDTL3_dataset
(
	schema: T_ZY_JG_PROCMATERIALDTL_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_jg_procmaterialdtl/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_JG_PROCMATERIALDTL_syncher
(
    inputs: T_ZY_JG_PROCMATERIALDTL3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_JG_PROCMATERIALDTL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_JG_PROCMATERIALDTL_del_dataset,
		serviceid: idx_job1)
	)
);
end;
run job t_zy_jg_procmaterialdtl_delete_q1(threads:8);

create job t_zy_gh_changeownerdetail_delete_q1(zykie)
begin
dataset file T_ZY_GH_CHANGEOWNERDETAIL3_dataset
(
	schema: T_ZY_GH_CHANGEOWNERDETAIL_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_zy_gh_changeownerdetail/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_GH_CHANGEOWNERDETAIL_syncher
(
    inputs: T_ZY_GH_CHANGEOWNERDETAIL3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_GH_CHANGEOWNERDETAIL,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_GH_CHANGEOWNERDETAIL_del_dataset,
		serviceid: idx_job1)
	)
);
end;
run job t_zy_gh_changeownerdetail_delete_q1(threads:8);

create job t_zy_ck_outpack_delete_q1(zykie)
begin
dataset file T_ZY_CK_OUTPACK3_dataset
(
	schema: T_ZY_CK_OUTPACK_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_ck_outpack/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000)
);

dataproc syncher T_ZY_CK_OUTPACK_syncher
(
    inputs: T_ZY_CK_OUTPACK3_dataset,
    database:db,
    operation:delete, 
    table:T_ZY_CK_OUTPACK,
	stream:true,
	services : 
	(
		(dataprocname : T_ZY_CK_OUTPACK_del_dataset,
		serviceid: idx_job1)
	)
);
end;
run job t_zy_ck_outpack_delete_q1(threads:8);

<file_sep>/uncomplete/JINSHANG-101/jinshang-101.sql

SELECT *
FROM
  (SELECT ownerid,
          '' ownername,
             manageno,
             packnum,
             max(gradenum) gradenum,
             max(goodslocid) goodslocid,
             kindname,
             shopsignname,
             GOODSOWNERPACKNO,
             prodareaname,
             firstindate,
             sum(gradenumxh) gradenumxh,
             sum(singlesheetnum) singlesheetnum,
             max(SideMark) SideMark,
             max(ShipName) ShipName,
             sum(netweight) netweight,
             sum(grossweight) grossweight,
             sum(sheetnum) sheetnum
   FROM
     ( SELECT ownerid,
              manageno,
              packnum,
              max(gradenum) gradenum,
              max(goodslocid) goodslocid,
              kindname,
              shopsignname,
              GOODSOWNERPACKNO,
              prodareaname,
              firstindate,
              sum(gradenumxh) gradenumxh,
              sum(singlesheetnum) singlesheetnum,
              max(SideMark) SideMark,
              max(ShipName) ShipName,
              sum(netweight) netweight,
              sum(grossweight) grossweight,
              sum(sheetnum) sheetnum
      FROM T_GG_SJ_Goods
      WHERE goodsstateno='20'
        AND r_record_is_deleted=0
        AND deptid='0301'
      GROUP BY ownerid,
               manageno,
               packnum,
               kindname,
               shopsignname,
               GOODSOWNERPACKNO,
               prodareaname,
               firstindate
      UNION ALL SELECT ownerid,manageno,packnum,max(gradenum) gradenum,max(goodslocid) goodslocid,kindname,shopsignname,GOODSOWNERPACKNO, prodareaname,firstindate,sum(gradenumxh) gradenumxh,sum(singlesheetnum) singlesheetnum,max(SideMark) SideMark,max(ShipName) ShipName, -sum(netweight) netweight,-sum(grossweight) grossweight,-sum(sheetnum) sheetnum
      FROM T_ZY_RK_InBillDetail
      WHERE deptid='0301'
        AND goodsstateno='20'
        AND firstindate>=to_date('2015/7/2','yyyy-mm-dd')
      GROUP BY ownerid,
               manageno,
               packnum,
               kindname,
               shopsignname,
               GOODSOWNERPACKNO,
               prodareaname,
               firstindate
      UNION ALL SELECT ownerid,
                       manageno,
                       packnum,
                       max(gradenum) gradenum,
                       max(goodslocid) goodslocid,
                       kindname,
                       shopsignname,
                       GOODSOWNERPACKNO,
                       prodareaname,
                       firstindate,
                       0 gradenumxh,
                         0 singlesheetnum,NULL,NULL, -sum(netweight) netweight,-sum(grossweight) grossweight,-sum(sheetnum) sheetnum
      FROM T_ZY_JG_ProcArticleDtl
      WHERE deptid='0301'
        AND firstindate>=to_date('2015/7/2','yyyy-mm-dd')
        AND goodsstateno='130'
      GROUP BY ownerid,
               manageno,
               packnum,
               kindname,
               shopsignname,
               GOODSOWNERPACKNO,
               prodareaname,
               firstindate
      UNION ALL SELECT newownerno aownerid,
                       managenum manageno,
                       packnum,
                       max(gradenum) gradenum,
                       max(goodslocid) goodslocid ,
                       kindname,
                       shopsignname,
                       GOODSOWNERPACKNUM,
                       prodareaname,
                       firstindate,
                       0 gradenumxh,
                         0 singlesheetnum,NULL,NULL, -sum(netweight) netweight,-sum(grossweight) grossweight,-sum(sheetnum) sheetnum
      FROM
        (SELECT a.newownerno,a.newownername,(CASE WHEN (managenum IS NULL
                                                        OR managenum = '') THEN premanagenum ELSE managenum END) managenum,
                                                                                                                 b.shopsignid,
                                                                                                                 b.shopsignname,
                                                                                                                 GOODSOWNERPACKNUM,
                                                                                                                 b.prodareaid,
                                                                                                                 b.prodareaname,
                                                                                                                 b.gradenum,
                                                                                                                 b.netweight,
                                                                                                                 b.grossweight,
                                                                                                                 b.sheetnum,
                                                                                                                 b.firstindate,
                                                                                                                 b.kindname,
                                                                                                                 b.goodslocid,
                                                                                                                 b.packnum,
                                                                                                                 b.goodsownermanagenum goodsownermanageno
         FROM
           (SELECT deptid,
                   ChangeOwnerID,
                   newownerno,
                   newownername
            FROM T_ZY_GH_ChangeOwnerList
            WHERE DeptID='0301'
              AND changedate>=to_date('2015/7/2','yyyy-mm-dd')) a ,
                                                                T_ZY_GH_ChangeOwnerDetail b
         WHERE a.changeownerid=b.changeownerno
           AND a.deptid=b.deptid ) tb1
      GROUP BY newownerno,
               managenum,
               packnum,
               kindname,
               shopsignname,
               GOODSOWNERPACKNUM,
               prodareaname,
               firstindate
      UNION ALL SELECT ownerno,
                       managenum manageno,
                       packnum,
                       max(gradenum) gradenum,
                       max(goodslocid) goodslocid,
                       kindname,
                       shopsignname,
                       GOODSOWNERPACKNUM,
                       prodareaname,
                       firstindate,
                       sum(gradenumxh) gradenumxh,
                       sum(singlesheetnum) singlesheetnum,
                       max(SideMark) SideMark,
                       max(ShipName) ShipName,
                       sum(netweight) netweight,
                       sum(grossweight) grossweight,
                       sum(sheetnum) sheetnum
      FROM T_ZY_CK_OutPack
      WHERE deptid='0301'
        AND OutCustTime>=to_date('2015/7/2','yyyy-mm-dd')
      GROUP BY ownerno,
               managenum,
               packnum,
               kindname,
               shopsignname,
               GOODSOWNERPACKNUM,
               prodareaname,
               firstindate
      UNION ALL SELECT ownerid,
                       manageno,
                       a.packnum,
                       max(gradenum) gradenum,
                       max(goodslocid) goodslocid,
                       kindname,
                       shopsignname,
                       GOODSOWNERPACKNO,
                       prodareaname,
                       firstindate,
                       sum(gradenumxh) gradenumxh,
                       sum(singlesheetnum) singlesheetnum,
                       max(SideMark) SideMark,
                       max(ShipName) ShipName,
                       sum(netweight) netweight,
                       sum(grossweight) grossweight,
                       sum(sheetnum) sheetnum
      FROM T_GG_SJ_Goods a,
           T_ZY_CK_CLEAR b
      WHERE a.goodsid=b.goodsid
        AND a.deptid='0301'
        AND CREATDATE>=to_date('2015/7/2','yyyy-mm-dd')
      GROUP BY ownerid,
               manageno,
               a.packnum,
               kindname,
               shopsignname,
               GOODSOWNERPACKNO,
               prodareaname,
               firstindate
      UNION ALL SELECT ownerid,
                       manageno,
                       packnum,
                       max(gradenum) gradenum,
                       max(goodslocid) goodslocid,
                       kindname,
                       shopsignname,
                       GOODSOWNERPACKNO,
                       prodareaname,
                       firstindate,
                       0 gradenumxh,
                         0 singlesheetnum,
                           NULL,
                           NULL,
                           sum(netweight) netweight,
                           sum(grossweight) grossweight,
                           sum(sheetnum) sheetnum
      FROM T_ZY_JG_ProcMaterialDtl
      WHERE deptid='0301'
        AND EXISTS
          (SELECT 1
           FROM T_ZY_JG_PROCESS
           WHERE ProcessID=T_ZY_JG_ProcMaterialDtl.ProcessID
             AND deptid=T_ZY_JG_ProcMaterialDtl.deptid
             AND OutCarBillTime>=to_date('2015/7/2','yyyy-mm-dd'))
      GROUP BY ownerid,
               manageno,
               packnum,
               kindname,
               shopsignname,
               GOODSOWNERPACKNO,
               prodareaname,
               firstindate
      UNION ALL SELECT preownerno ownerid,
                       premanagenum manageno,
                       packnum,
                       max(gradenum) gradenum,
                       max(goodslocid) goodslocid,
                       kindname,
                       shopsignname,
                       GOODSOWNERPACKNUM,
                       prodareaname,
                       firstindate,
                       0 gradenumxh,
                         0 singlesheetnum,
                           NULL,
                           NULL,
                           sum(netweight) netweight,
                           sum(grossweight) grossweight,
                           sum(sheetnum) sheetnum
      FROM
        (SELECT a.preownerno,
                a.proownername,
                b.premanagenum,
                b.netweight,
                b.grossweight,
                b.sheetnum,
                b.shopsignid,
                b.shopsignname,
                b.prodareaid,
                b.prodareaname,
                GOODSOWNERPACKNUM,
                b.gradenum,
                b.firstindate,
                b.kindname,
                b.goodslocid,
                b.packnum
         FROM
           (SELECT deptid,
                   ChangeOwnerID,
                   preownerno,
                   proownername
            FROM T_ZY_GH_ChangeOwnerList
            WHERE DeptID='0301'
              AND changedate>=to_date('2015/7/2','yyyy-mm-dd')) a ,
                                                                T_ZY_GH_ChangeOwnerDetail b
         WHERE a.changeownerid=b.changeownerno
           AND a.deptid=b.deptid) tb1
      GROUP BY preownerno,
               premanagenum,
               packnum,
               kindname,
               shopsignname,
               GOODSOWNERPACKNUM,
               prodareaname,
               firstindate ) tbx
   WHERE ownerid = 'KH00001'
     AND netweight <> 0
   GROUP BY ownerid,
            manageno,
            packnum,
            kindname,
            shopsignname,
            GOODSOWNERPACKNO,
            prodareaname,
            firstindate)
WHERE netweight <> 0;

<file_sep>/uncomplete/JINSHANG-97/jinshang-97.sql

SELECT rptdate,
       Sum(nt)        nt,
       Sum(injs)      injs,
       Sum(OUTWEIGHT) OUTWEIGHT,
       Sum(outjs)     outjs
FROM   (SELECT To_char(FIRSTINDATE, 'yyyy-mm-dd') AS RPTDATE,
               Sum(NETWEIGHT)                     AS NT,
               Count(*)                           AS injs,
               0                                  OUTWEIGHT,
               0                                  outjs
        FROM   T_ZY_RK_InBillDetail
        WHERE  ( GOODSSTATENO = '20' )
               AND ( DEPTID = '0301' )
               AND ( FirstInDate >= To_date('2015/7/1', 'yyyy-mm-dd') )
               AND ( FirstInDate < To_date('2015/9/1', 'yyyy-mm-dd') )
               AND OWNERID = 'KH00001'
               AND ( 1 = 2
                      OR MANAGENO LIKE 'M%' )
        GROUP  BY To_char(FIRSTINDATE, 'yyyy-mm-dd')
        UNION ALL
        SELECT To_char(b.CHANGEDATE, 'yyyy-mm-dd') AS rptdate,
               Sum(NETWEIGHT)                      AS nt,
               Count(*)                            AS injs,
               0                                   OUTWEIGHT,
               0                                   outjs
        FROM   T_ZY_GH_ChangeOwnerDetail a,
               T_ZY_GH_ChangeOwnerlist b
        WHERE  a.DEPTID = b.deptid
               AND a.CHANGEOWNERNO = b.CHANGEOWNERID
               AND a.DeptID = '0301'
               AND NEWOWNERNO = 'KH00001'
               AND ( 1 = 2
                      OR a.PREMANAGENUM LIKE 'M%' )
               AND changedate >= To_date('2015/7/1', 'yyyy-mm-dd')
               AND changedate < To_date('2015/9/1', 'yyyy-mm-dd')
        GROUP  BY To_char(b.CHANGEDATE, 'yyyy-mm-dd')
        UNION ALL
        SELECT To_char(b.OUTCUSTTIME, 'yyyy-mm-dd') AS rptdate,
               0                                    nt,
               0                                    injs,
               Sum(a.NETWEIGHT)                     AS OUTWEIGHT,
               COUNT                                AS outjs
        FROM   t_zy_ck_outPack a,
               t_zy_ck_outbill b
        WHERE  a.deptid = b.deptid
               AND a.OUTBILLNO = b.OUTBILLID
               AND a.DEPTID = '0301'
               AND a.OWNERNO = 'KH00001'
               AND ( 1 = 2
                      OR MANAGENUM LIKE 'M%' )
               AND a.GOODSSTATENO = '40'
               AND b.outcusttime >= To_date('2015/7/1', 'yyyy-mm-dd')
               AND b.outcusttime < To_date('2015/9/1', 'yyyy-mm-dd')
        GROUP  BY To_char(b.outcusttime, 'yyyy-mm-dd')
        UNION ALL
        SELECT To_char(b.changedate, 'yyyy-mm-dd') AS rptdate,
               0                                   nt,
               0                                   injs,
               Sum(netweight)                      AS OUTWEIGHT,
               Count(*)                            AS outjs
        FROM   T_ZY_GH_ChangeOwnerDetail a,
               T_ZY_GH_ChangeOwnerlist b
        WHERE  a.deptid = b.deptid
               AND a.changeownerno = b.changeownerid
               AND a.DeptID = '0301'
               AND preownerno = 'KH00001'
               AND ( 1 = 2
                      OR b.newmanagenum LIKE 'M%' )
               AND changedate >= To_date('2015/7/1', 'yyyy-mm-dd')
               AND changedate < To_date('2015/9/1', 'yyyy-mm-dd')
        GROUP  BY To_char(b.changedate, 'yyyy-mm-dd'))
GROUP BY rptdate;
<file_sep>/complete/JINSHANG-110/del_1.sql
create job del_1_job(2)
begin

dataset file T_GG_SJ_GOODS_dataset_22
(
	schema: T_GG_SJ_GOODS_schema,
    filename: "/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select union_select
(   
	inputs: "T_GG_SJ_GOODS_dataset_22",
	fields: 
	 (
       (fname:"netweight",alias:"store_amount",type:"double"),
       (fname:"0",alias:"store_in_amount",type:"double"),
       (fname:"0",alias:"store_out_amount",type:"double"),
       (fname:"0",alias:"store_process_amount",type:"double")
	 ),
	distinct: true,
	data_opr:delete,
	cache:true,
	conditions:" goodsstateno = '110'
		AND deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
); 

  dataproc statistics T_GG_SJ_GOODS_statistics_del
(
	inputs:union_select,
	table:union_all,
	data_opr:delete
);

end;

run job del_1_job (threads:8);
<file_sep>/schema/T_GG_SJ_CUSTOMER.sql
create schema T_GG_SJ_CUSTOMER_schema
source type CSV
fields(
 "ownerno"              type str,
 "deptid"               type str,
 "ownername"            type str,
 "ownernamecut"         type str,
 "ownershort"           type str,
 "ownertypeno"          type str,
 "sysno"                type str,
 "email"                type str,
 "tel"                  type str,
 "linkman"              type str,
 "fax"                  type str,
 "postalcode"           type str,
 "netaddress"           type str,
 "address"              type str,
 "bankname"             type str,
 "bankaccounts"         type str,
 "taxpayerno"           type str,
 "flag"                 type str,
 "remark"               type str,
 "minstorage"           type double,
 "accountreceivable"    type double,
 "r_record_create_date" type DATETIME,
 "r_record_create_user" type str,
 "r_record_update_date" type DATETIME,
 "r_record_update_user" type str,
 "r_record_is_deleted"  type double,
 "r_record_change_flag" type double,
 "memberid"             type str,
 "isbaosteel"           type str,
 "tellink"              type double,
 "invoicekindid"        type str,
 "invoicekindname"      type str,
 "jgfeeflag"            type str,
 "minweight"            type double,
 "ccfeeflag"            type str,
 "townerno"             type str,
 "saveimage"            type str,
 "bwlno"                type str,
 "username"             type str,
 "sendemail"            type str
)
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "NULL";

CREATE PARSER T_GG_SJ_CUSTOMER_parser
TYPE rcd
SCHEMA T_GG_SJ_CUSTOMER_schema;

CREATE TABLE T_GG_SJ_CUSTOMER using T_GG_SJ_CUSTOMER_parser; 

CREATE INDEX T_GG_SJ_CUSTOMER_index ON TABLE T_GG_SJ_CUSTOMER (ownerno);<file_sep>/schema/T_ZY_JG_PROCARTICLEDTL.sql
use db;
create schema T_ZY_JG_PROCARTICLEDTL_schema
source type CSV
fields(
 "procarticledtlid" type str,
 "deptid" type str,
 "processid" type str,
 "packnum" type str,
 "barcode" type str,
 "goodslocid" type str,
 "ownerid" type str,
 "ownername" type str,
 "goodsownermanageno" type str,
 "goodsownerpackno" type str,
 "manageno" type str default value "0" ,
 "feebegindate" type DATETIME,
 "contractid" type str,
 "goodsstateno" type str,
 "goodsstatename" type str,
 "changeownertimes"  type double,
 "goodstype"          type str,
 "goodstypename"    type str,
 "kindno"    type str,
 "kindname"    type str,
 "shopsignid"    type str,
 "shopsignname"    type str,
 "prodareaid"    type str,
 "prodareaname"    type str,
 "goodsbatchno"    type str,
 "prodstoveno"    type str,
 "gradenum"    type str,
 "gradenumthick"     type double,
 "gradenumwidth"     type double,
 "gradenumlength"     type double,
 "grossweight"     type double,
 "netweight"     type double,
 "poundweight"     type double,
 "checkweight"     type double,
 "sheetnum"     type double,
 "packtype"     type str,
 "packtypename"    type str,
 "unit"    type str,
 "qualitymemo"    type str,
 "firstinownerid"    type str,
 "firstindate"     type DATETIME,
 "printflag"     type str,
 "quality"    type str,
 "qamember"    type str,
 "qaflag"     type str,
 "processqualityid"    type str,
 "r_record_create_date" type DATETIME,
 "r_record_create_user" type str,
 "r_record_update_date" type DATETIME,
 "r_record_update_user" type str,
 "r_record_is_deleted"  type double,
 "orderby"              type double,
 "r_record_change_flag" type double,
 "instruction_id"      type str,
 "sendflag"             type double,
 "acceptance_times"     type double,
 "acceptancer"         type str,
 "acceptance_time"      type DATETIME,
 "skinweight"      type double,
 "cyyweight"      type double,
 "goodsid"     type str,
 "articlememo1"     type str,
 "articlememo2"     type str,
 "articlememo3"      type str,
 "articlememo4"     type str,
 "articlememo5"     type str,
 "articlememo6"     type str,
 "articlememo7"     type str,
 "articlememo8"     type str,
 "articlememo9"     type str,
 "articlememo10"     type str,
 "articleys"     type str,
 "customerid"     type str,
 "cbxjgtype"     type str,
 "wallwidth"      type double,
 "woodtype"     type str,
 "woodtypename"     type str,
 "chanxian"     type str,
 "drawno"     type str,
 "zcflag"     type str default value "0",
 "classgroup"     type str,
 "loclv1"     type str,
 "loclv2"     type str
)          
RECORD DELIMITER "CRLF"
FIELD DELIMITER ","
TEXT QUALIFIER "NULL";
CREATE PARSER T_ZY_JG_PROCARTICLEDTL_parser
TYPE rcd
SCHEMA T_ZY_JG_PROCARTICLEDTL_schema;
CREATE TABLE T_ZY_JG_PROCARTICLEDTL using T_ZY_JG_PROCARTICLEDTL_parser;
CREATE INDEX T_ZY_JG_PROCARTICLEDTL_index ON TABLE T_ZY_JG_PROCARTICLEDTL(customerid);    <file_sep>/processing/JINSHANG-75/jinshang-75.sql
SELECT *
FROM
  (SELECT nvl(GOODSID, 'null') AS GOODSID,
          nvl(DEPTID, 'null') AS DEPTID,

     (SELECT deptname
      FROM wmsdba.t_common_dept d
      WHERE d.deptid = g.deptid) AS DEPTNAME,
          nvl(BARCODE, 'null') AS BARCODE,
          nvl(GOODSLOCID, 'null') AS GOODSLOCID,
          nvl(decode(STOCKTYPE, '004001', '室内库', '004002', '室外库', NULL, '室内库'), 'null') AS STOCKTYPE,
          nvl(OWNERID, 'null') AS OWNERID,
          nvl(OWNERNAME, 'null') AS OWNERNAME,
          nvl(GOODSOWNERMANAGENO, 'null') AS GOODSOWNERMANAGENO,
          nvl(INBILLID, 'null') AS INBILLID,
          nvl(PACKNUM, 'null') AS PACKNUM,
          nvl(GOODSOWNERPACKNO, 'null') AS GOODSOWNERPACKNO,
          nvl(MANAGENO, 'null') AS MANAGENO,
          nvl(to_char(FEEBEGINDATE, 'YYYY-MM-DD hh24:mi:ss'), 'null') AS FEEBEGINDATE,
          nvl(CONTRACTID, 'null') AS CONTRACTID,
          nvl(GOODSSTATENO, 'null') AS GOODSSTATENO,
          nvl(GOODSSTATENAME, 'null') AS GOODSSTATENAME,
          nvl(to_char(CHANGEOWNERTIMES), 'null') AS CHANGEOWNERTIMES,
          nvl(GOODSTYPE, 'null') AS GOODSTYPE,
          nvl(GOODSTYPENAME, 'null') AS GOODSTYPENAME,
          nvl(KINDNO, 'null') AS KINDNO,
          nvl(KINDNAME, 'null') AS KINDNAME,
          nvl(SHOPSIGNID, 'null') AS SHOPSIGNID,
          nvl(SHOPSIGNNAME, 'null') AS SHOPSIGNNAME,
          nvl(PRODAREAID, 'null') AS PRODAREAID,
          nvl(PRODAREANAME, 'null') AS PRODAREANAME,
          nvl(GOODSBATCHNO, 'null') AS GOODSBATCHNO,
          nvl(PRODSTOVENO, 'null') AS PRODSTOVENO,
          nvl(GRADENUM, 'null') AS GRADENUM,
          nvl(GRADENUMTHICK, 0) AS GRADENUMTHICK,
          nvl(to_char(GRADENUMWIDTH), 'null') AS GRADENUMWIDTH,
          nvl(to_char(GRADENUMLENGTH), 'null') AS GRADENUMLENGTH,
          nvl(GROSSWEIGHT, 0) AS GROSSWEIGHT,
          nvl(NETWEIGHT, 0) AS NETWEIGHT,
          nvl(POUNDWEIGHT, 0) AS POUNDWEIGHT,
          nvl(CHECKWEIGHT, 0) AS CHECKWEIGHT,
          nvl(SHEETNUM, 0) AS SHEETNUM,
          nvl(UNIT, 'null') AS UNIT,
          nvl(PACKTYPE, 'null') AS PACKTYPE,
          nvl(STOCKAREAID, 'null') AS STOCKAREAID,
          nvl(QUALITYMEMO, 'null') AS QUALITYMEMO,
          nvl(FIRSTINOWNERID, 'null') AS FIRSTINOWNERID,
          nvl(to_char(FIRSTINDATE, 'YYYY-MM-DD hh24:mi:ss'), 'null') AS FIRSTINDATE,
          nvl(OUTBILLID, 'null') AS OUTBILLID,
          nvl(LDGLISTID, 'null') AS LDGLISTID,
          nvl(MATERIALGOODSID, 'null') AS MATERIALGOODSID,
          nvl(decode(INTYPE, '20', '正常入库', '50', '退货入库', '99', '其它'), 'null') AS INTYPE,
          nvl(OUTTYPE, 'null') AS OUTTYPE,
          nvl(to_char(BILLSTATE), 'null') AS BILLSTATE,
          nvl(to_char(OUTBILLTIME, 'YYYY-MM-DD hh24:mi:ss'), 'null') AS OUTBILLTIME,
          nvl(MEMO, 'null') AS MEMO,
          nvl(SDPRICE, 'null') AS SDPRICE,
          nvl(SIDEMARK, 'null') AS TRUCKNO,
          nvl(to_char(OUTBILLTIME, 'YYYY-MM-DD hh24:mi:ss'), 'null') AS OUTCUSTTIME,
          nvl(to_char(round(sysdate - FIRSTINDATE)), 'null') AS STORAGEDAY,
          nvl(to_char(LENGTH_PRODUCT_MAX), 'null') AS LENGTHMAX
   FROM wmsdba.t_gg_sj_goods g
   WHERE 1 = 1
     AND GOODSID = 'ww'
     AND PACKNUM = 'ww'
     AND deptId = 'ww')
WHERE rownum <= 20<file_sep>/schema/T_WL_STORE.sql
CREATE SCHEMA T_WL_STORE_schema
SOURCE TYPE CSV
FIELDS(                                                          
"dept_id"                                                  type str,
"store_short_name"                                         type str,
"lng"                                                      type double,
"lat"                                                      type double,
"hasvideo"                                                 type double default value "0",
"storelimit"                                               type double
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM"; 

CREATE PARSER T_WL_STORE_parser
TYPE rcd
SCHEMA T_WL_STORE_schema;

CREATE TABLE T_WL_STORE using T_WL_STORE_parser;

CREATE INDEX T_WL_STORE_index ON TABLE T_WL_STORE (dept_id); 

<file_sep>/complete/JINSHANG-76/2_init_jinsahng76.sql

create job T_COMMON_DEPT_job(2)
begin
dataset file T_COMMON_DEPT_dataset
(
	schema: "T_COMMON_DEPT_schema",
	filename: "/home/natt/Data/jinshang_Data_New/T_COMMON_DEPT.csv",
	serverid: "0",
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher T_COMMON_DEPT_syncher
(
    inputs: T_COMMON_DEPT_dataset,
    database:db,
    operator:add, 
    table:T_COMMON_DEPT
);
end;
run job T_COMMON_DEPT_job(threads:8);


create job T_BM_UI_CONFIGURE_job(2)
begin
dataset file T_BM_UI_CONFIGURE_dataset
(
	schema: "T_BM_UI_CONFIGURE_schema",
	filename: "/home/natt/Data/jinshang_Data_New/T_BM_UI_CONFIGURE.csv",
	serverid: "0",
	splitter: (block_size: 10000000)			  		  
);
dataproc syncher T_BM_UI_CONFIGURE2_syncher
(
    inputs: T_BM_UI_CONFIGURE_dataset,
    database:db,
    operator:add, 
    table:T_BM_UI_CONFIGURE
);
end;
run job T_BM_UI_CONFIGURE_job(threads:8);


create job T_GG_SJ_GOODS_job(2)
begin
dataset file T_GG_SJ_GOODS_dataset
(
	schema:T_GG_SJ_GOODS_schema,
	filename:"/home/natt/Data/jinshang_Data_New/T_GG_SJ_GOODS.csv",
	serverid:0,
	splitter:(block_size: 10000000)		  
);
dataproc select T_GG_SJ_GOODS_select
(
	fields: 
	(
     (fname:"nvl (deptid,'NULL')",alias:"deptid",type:"str"),	  
     (fname:"iilmap('T_COMMON_DEPT_map')",alias:"vf_deptname",type:"str"),
     (fname:"nvl (gradenum, 'NULL')",alias:"gradenum",type:"str"),
	 (fname:"nvl (shopsignid, 'NULL')",alias:"shopsignid",type:"str"),
	 (fname:"nvl (shopsignname, 'NULL')",alias:"shopsignname",type:"str"),
     (fname:"nvl (prodareaid, 'NULL')",alias:"prodareaid",type:"str"),
     (fname:"nvl (prodareaname, 'NULL')",alias:"prodareaname",type:"str"),
	 (fname:"nvl (kindno, 'NULL')",alias:"kindno",type:"str"),
	 (fname:"nvl (kindname, 'NULL')",alias:"kindname",type:"str"),
	 (fname:"nvl (ownername, 'NULL')",alias:"ownername",type:"str"),
	 (fname:"nvl (goodsownerpackno, 'NULL')",alias:"goodsownerpackno",type:"str"),
	 (fname:"nvl (netweight, 0)",alias:"netweight",type:"str"),
	 (fname:"nvl (grossweight, 0)",alias:"grossweight",type:"str"),
	 (fname:"nvl (sheetnum,  0)",alias:"sheetnum",type:"str"),
	 (fname:"iilmap('T_BM_UI_CONFIGURE_map',1)",alias:"vf_count",type:"str")
	),
	 inputs: "T_GG_SJ_GOODS_dataset"
);

dataproc select T_GG_SJ_GOODS1_select
(
	fields: 
	(
     (fname:"deptid",type:"str"), 
     (fname:"vf_deptname",type:"str"),
     (fname:"gradenum",type:"str"),
	 (fname:"shopsignid",type:"str"),
	 (fname:"shopsignname",type:"str"),
     (fname:"prodareaid",type:"str"),
     (fname:"prodareaname",type:"str"),
	 (fname:"kindno",type:"str"),
	 (fname:"kindname",type:"str"),
	 (fname:"ownername",type:"str"),
	 (fname:"goodsownerpackno",type:"str"),
	 (fname:"sum(netweight)",alias:"sumnetweight",type:"str"),
	 (fname:"sum(grossweight)",alias:"sumgrossweight",type:"str"),
	 (fname:"sum(sheetnum)",alias:"sumsheetnum",type:"str"),
	 (fname:"vf_count",type:"str"),
	 (fname:"case vf_count when '0' then '101%'  else '101' end",alias:"vf_countcase",type:"str") 
	),
	 inputs: "T_GG_SJ_GOODS_select",
	 group_by:(deptid,vf_deptname,gradenum,shopsignid,shopsignname,prodareaid,prodareaname,kindno,kindname,ownername,goodsownerpackno,vf_count,vf_countcase)
);
dataproc syncher T_GG_SJ_GOODS1_syncher
(
    inputs: T_GG_SJ_GOODS1_select,
    database:db,
    operator:add, 
    table:T_GG_SJ_GOODS1
);
end;
run job T_GG_SJ_GOODS_job (threads:8);
<file_sep>/uncomplete/JINSHANG-91/jinshang-91.sql
SELECT to_char(b.bill_date,'yyyy-mm-dd') A,
       b.resource_num B,
       b.bill_num C,
       sum(b.unit_weight) D,
       sum(c.netweight) E,
       count(b.pack_num) F,
       count(c.packnum) G,
       b.out_settle_type H
FROM t_gg_tx_dl_bil_d b
LEFT JOIN v_t_gg_sj_goods_out c ON (c.packnum=b.pack_num
                                    AND c.deptid=b.deptid)
WHERE b.deptid LIKE '03%'
  AND b.owner_num LIKE '%GM0%'
  AND to_char(b.bill_date,'yyyy-mm-dd')>='2015-07-01'
  AND to_char(b.bill_date,'yyyy-mm-dd')<'2015-08-01'
GROUP BY to_char(b.bill_date,'yyyy-mm-dd'),
         b.resource_num,
         b.bill_num,
         b.out_settle_type;

<file_sep>/processing/JINSHANG-76/del_3.sql
create job del_1_job(2)
begin

dataset file t_gg_sj_goods_dataset_22
(
	schema: t_gg_sj_goods_schema,
    filename: "/home/zhaoshun/Data/jingshang_data/T_GG_SJ_GOODS_del.txt",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select t_gg_sj_goods_select
(   
	fields:
	(
		(fname:"GOODSID",type:"string"),
		(fname:"DEPTID",type:"string"),
		(fname:"GRADENUM",type:"string"),
		(fname:"SHOPSIGNID",type:"string"),
		(fname:"SHOPSIGNNAME",type:"string"),
		(fname:"PRODAREAID",type:"string"),
		(fname:"PRODAREANAME",type:"string"),
		(fname:"KINDNO",type:"string"),
		(fname:"KINDNAME",type:"string"),
		(fname:"OWNERNAME",type:"string"),
		(fname:"GOODSOWNERPACKNO",type:"string"),
		(fname:"NETWEIGHT",type:"double"),
		(fname:"GROSSWEIGHT",type:"double"),
		(fname:"SHEETNUM",type:"double")
	),
	inputs: "t_gg_sj_goods_dataset_22",
	distinct: true,
	data_opr:delete,
	cache:true
); 

  dataproc statistics T_GG_SJ_GOODS_statistics_del
(
	inputs:t_gg_sj_goods_select,
	table:t_gg_sj_goods,
	data_opr:delete
);

end;

run job del_1_job (threads:8);
<file_sep>/schema/T_ZY_JS_SETTLEMENT.sql
create schema T_ZY_JS_SETTLEMENT_schema
SOURCE TYPE CSV
FIELDS(
"manageno" type str,
"settlecd" type str,
"deptid" type str,
"invoicekindid" type str,
"invoicekindname" type str,
"deptno" type str,
"deptname" type str,
"settledate" type datetime,
"invoicetypeid" type str,
"invoicetypename" type str,
"invoiceno" type str,
"chequeno" type str,
"chequesum" type double,
"chequeunit" type str,
"creditno" type str,
"creditamount" type double,
"cash" type double,
"earnest" type double,
"factsum" type double,
"borrow" type double,
"remit" type double,
"editor" type str,
"editorname" type str,
"creatdate" type datetime,
"flag" type double,
"memo" type str,
"resourceno" type str,
"invoiceflag" type double,
"r_record_create_date" type datetime,
"r_record_create_user" type str,
"r_record_update_date" type datetime,
"r_record_update_user" type str,
"r_record_is_deleted" type double,
"r_record_change_flag" type double,
"biz_id" type str,
"biz_type_id" type str,
"biz_type_name" type str,
"custom_id" type str,
"custom_name" type str,
"settle_data" type str,
"settle_weight" type str,
"should_sum" type double,
"sub_biz_type_id" type str,
"sub_biz_type_name" type str,
"weightsum" type double,
"grossweightsum" type double,
"ispay" type double,
"billempname" type str,
"foreignlistno" type str,
"jgbusinessno" type str,
"settledeptno" type str,
"settledeptname" type str,
"feekk" type double,
"kpusername" type str,
"kpamount" type double,
"kpdate" type datetime,
"settlelock" type str,
"jyzxflag" type double,
"jyzxsendflag" type double,
"jyzxfpsendflag" type double,
"jyzxispayfee" type double,
"sendmessage" type str,
"invoicebillno" type str,
"direction" type str,
"settletaxsum" type double,
"settlenotaxsum" type double
)
SCHEMA DELIMITER"LF"
FIELD DELIMITER","
TEXT QUALIFIER"DQM";

CREATE PARSER T_ZY_JS_SETTLEMENT_parser
TYPE rcd
SCHEMA T_ZY_JS_SETTLEMENT_schema;

CREATE TABLE T_ZY_JS_SETTLEMENT using T_ZY_JS_SETTLEMENT_parser; 

create index T_ZY_JS_SETTLEMENT_index on table T_ZY_JS_SETTLEMENT(manageno);<file_sep>/schema/T_S_BILL_D.sql
CREATE SCHEMA T_S_BILL_D_schema
SOURCE TYPE CSV
FIELDS(                                                          
"seg_no"                                                   type str,
"bill_id"                                                  type str,
"bill_subid"                                               type str,
"contract_id"                                              type str,
"contract_subid"                                           type str,
"s_resource_id"                                            type str,
"good_seg_no"                                              type str,
"good_id"                                                  type str,
"product_id"                                               type str,
"factory_product_id"                                       type str,
"plan_weight"                                              type double,
"plan_qty"                                                 type double,
"weight_unit"                                              type str,
"quantity_unit"                                            type str,
"unit_conversion"                                          type double,
"act_weight"                                               type double,
"act_qty"                                                  type double,
"settle_weight"                                            type double,
"settle_qty"                                               type double,
"sale_price_notax"                                         type double,
"settle_price_notax"                                       type double,
"tax_rate"                                                 type double,
"freight_price"                                            type double,
"out_price"                                                type double,
"other_amount"                                             type double,
"trans_charge_code"                                        type str,
"store_charge_code"                                        type str,
"ws_flag"                                                  type str default value '0',
"ws_date"                                                  type datetime,
"pack_id"                                                  type str,
"proc_mark"                                                type str,
"insert_time"                                              type datetime,
"spec"                                                     type str,
"wprovider_id"                                             type str,
"downloadflag"                                             type str default value '0',
"optflag"                                                  type str default value '0'
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM"; 

CREATE PARSER T_S_BILL_D_parser
TYPE rcd
SCHEMA T_S_BILL_D_schema;

CREATE TABLE T_S_BILL_D using T_S_BILL_D_parser;

CREATE INDEX T_S_BILL_D_index ON TABLE T_S_BILL_D (seg_no); 


<file_sep>/uncomplete/JINSHANG-104&106/jinshang-106.sql
SELECT kindname,
       round(avg(sysdate-firstindate),0) avgday
FROM t_gg_sj_goods t
WHERE goodsstateno=20
  AND EXISTS
    (SELECT 1
     FROM WL.T_OWNER W
     WHERE SEG_NO='00103'
       AND T.DEPTID=W.DEPTID
       AND t.ownerid=w.owner_id
       AND deptid NOT LIKE 'A%'
       AND deptid!='0301'
       AND deptid!='4501')
GROUP BY kindname;<file_sep>/complete/JINSHANG-110/add_2.sql
create job add_2_job(2)
begin

dataset file T_ZY_RK_INBILL_dataset_11
(
	schema: T_ZY_RK_INBILL_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_zy_rk_inbill/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000000)
);

dataproc select union_select
(   
	inputs: "T_ZY_RK_INBILL_dataset_11",
	fields: 
	 (
       (fname:"0",alias:"store_amount",type:"double"),
       (fname:"netweightsum",alias:"store_in_amount",type:"double"),
       (fname:"0",alias:"store_out_amount",type:"double"),
       (fname:"0",alias:"store_process_amount",type:"double")
	 ),
	distinct: true,
	cache:true,
	conditions:" deptid NOT LIKE '03%'
		AND deptid NOT LIKE 'ZZ%'
		AND deptid NOT LIKE 'MG%' "
); 

  dataproc statistics T_ZY_RK_INBILL_add_statistics
(
	inputs:union_select,
	table:union_all
);

end;

run job add_2_job (threads:8);<file_sep>/complete/JINSHANG-107&108/jinshang-108.sql
SELECT sumdate,
       sum(sumweight)
FROM t_chart_detailstorage
WHERE owner_num='PD'
  AND sumdate>=to_char(sysdate-365,'yyyymmdd')
  AND sumdate LIKE '______15'
  AND deptid NOT LIKE 'A%'
  AND deptid!='0301'
  AND deptid!='4501'
GROUP BY sumdate
ORDER BY sumdate;<file_sep>/complete/JINSHANG-75/2_init.sql
create job t_common_dept_job(t_common)
begin
dataset file t_common_dept_dataset
(
	schema:t_common_dept_schema,
	filename: "/home/natt/Data/jinshang_Data_New/T_COMMON_DEPT.csv",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher t_common_dept_syncher 
( 
inputs:t_common_dept_dataset, 
database:db, 
operator:add, 
table:t_common_dept
); 
end;
run job t_common_dept_job(threads:8);


create job t_gg_sj_goods_job(t_gg_sj)
begin
dataset file t_gg_sj_goods_dataset
(
	schema:t_gg_sj_goods_schema,
	filename:"/home/natt/Data/jinshang_Data_New/T_GG_SJ_GOODS.csv",
	serverid: 0,
	splitter:(block_size: 10000000)		  
);
dataproc syncher t_gg_sj_goods_syncher 
( 
inputs:t_gg_sj_goods_dataset, 
database:db, 
operator:add, 
table:t_gg_sj_goods
); 
end;
run job t_gg_sj_goods_job (threads:8);
<file_sep>/complete/JINSHANG-75/zidonghua.sql
t_common_dept_insert_q1=begin
dataset file t_common_dept1_dataset
(
	schema:t_common_dept_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_common_dept/insert/insert.csv",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher t_common_dept_syncher 
( 
inputs:t_common_dept1_dataset, 
database:db, 
operator:add, 
table:t_common_dept
); 
end

t_common_dept_delete_q1=begin
dataset file t_common_dept2_dataset
(
	schema:t_common_dept_schema,
	filename: "/home/natt/syncdata/oraclesyncdata/t_common_dept/delete/delete.csv",
	serverid: 0,
	splitter: (block_size: 10000000)		  		  
);
dataproc syncher t_common_dept_syncher 
( 
inputs:t_common_dept2_dataset, 
database:db, 
operator:delete, 
table:t_common_dept
); 
end

t_gg_sj_goods_insert_q1=begin
dataset file t_gg_sj_goods1_dataset
(
	schema:t_gg_sj_goods_schema,
	filename:"/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/insert/insert.csv",
	serverid: 0,
	splitter:(block_size: 10000000)		  
);
dataproc syncher t_gg_sj_goods_syncher 
( 
inputs:t_gg_sj_goods1_dataset, 
database:db, 
operator:add, 
table:t_gg_sj_goods
); 
end

t_gg_sj_goods_delete_q1=begin
dataset file t_gg_sj_goods2_dataset
(
	schema:t_gg_sj_goods_schema,
	filename:"/home/natt/syncdata/oraclesyncdata/t_gg_sj_goods/delete/delete.csv",
	serverid: 0,
	splitter:(block_size: 10000000)		  
);
dataproc syncher t_gg_sj_goods_syncher 
( 
inputs:t_gg_sj_goods2_dataset, 
database:db, 
operator:delete, 
table:t_gg_sj_goods
); 
end<file_sep>/uncomplete/JINSHANG-93/T_SI_LOGISTICS_READY_M.sql
CREATE SCHEMA T_SI_LOGISTICS_READY_M_schema
SOURCE TYPE CSV
FIELDS(                                                          
"seg_no"                                                   type str,
"ready_num"                                                type str,
"order_num"                                                type str,
"ready_date_chr"                                           type str,
"ready_t"                                                  type str,
"weight_ready_tot"                                         type double,
"n_ready_tot"                                              type double,
"trnp_mode_code"                                           type str,
"trnp_mode_name"                                           type str,
"dlv_spot_code"                                            type str,
"dlv_spot_name"                                            type str,
"private_route_code"                                       type str,
"private_route_name"                                       type str,
"proc_mark"                                                type str,
"time_receive"                                             type datetime,
"provider_id"                                              type str,
"provider_name"                                            type str
	    )
SCHEMA DELIMITER "LF"
FIELD DELIMITER ","
TEXT QUALIFIER "DQM"; 

CREATE PARSER T_SI_LOGISTICS_READY_M_parser
TYPE rcd
SCHEMA T_SI_LOGISTICS_READY_M_schema;

CREATE TABLE T_SI_LOGISTICS_READY_M using T_SI_LOGISTICS_READY_M_parser;

CREATE INDEX T_SI_LOGISTICS_READY_M_index ON TABLE T_SI_LOGISTICS_READY_M (seg_no); 


