1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
| CREATE PROCEDURE Insert_Oracle_SP
-- Add the parameters for the stored procedure here
@tradCode varchar(15),
@tradLib1 varchar(40),
@ART_CODE varchar(15) ,
@ART_SITE varchar(3) ,
@ART_RUB1 varchar(5) ,
@ART_RUB2 varchar(5) ,
@ART_RUB3 varchar(5) ,
@ART_RUB4 varchar(5) ,
@ART_RUB5 varchar(5) ,
@ART_RUB6 varchar(5) ,
@ART_STAT1 varchar(10) ,
@ART_STAT2 varchar(10) ,
@ART_STAT3 varchar(10) ,
@ART_STAT4 varchar(10) ,
@ART_ACTIF varchar(1) ,
@ART_UNIT_ACH varchar(1) ,
@ART_UNIT_VEN varchar(1) ,
@ART_UNIT_CDE varchar(1) ,
@ART_UNIT_STK varchar(1) ,
@ART_FAM_VEN varchar(3) ,
@ART_FAM_ACH varchar(3) ,
@ART_FAM_TRSP varchar(3) ,
@ART_EXCLU_DEB varchar(1) ,
@ART_CODE_DEB varchar(15) ,
@ART_VENDEUR varchar(3) ,
@ART_ACHETEUR varchar(3) ,
@ART_PDS_VEN varchar(1) ,
@ART_PIE_VEN varchar(1) ,
@ART_STOCK varchar(1) ,
@ART_PDS_BRUT decimal(7, 3) ,
@ART_TARE_UNIT decimal(8, 3) ,
@ART_PDS_NET decimal(7, 3) ,
@ART_PIECE_COL numeric(4, 0) ,
@ART_PIECE_PDS decimal(7, 3) ,
@ART_LISTE_EMB varchar(3) ,
@ART_CODE_EMB varchar(8) ,
@ART_TOLERANCE decimal(5, 2) ,
@ART_CHAR_ETIQ varchar(20) ,
@ART_PICKING varchar(6) ,
@ART_STK_MINI decimal(5, 0) ,
@ART_STK_MAXI numeric(5, 0) ,
@ART_REAPPRO numeric(5, 0) ,
@ART_DEFAUT_FOUR varchar(8) ,
@ART_DESTOCK_ART varchar(15) ,
@ART_CODE_TVA numeric(2, 0) ,
@ART_CODE_TAXE numeric(2, 0) ,
@ART_FAM_CPTA varchar(3) ,
@ART_CAPITAL varchar(1) ,
@ART_FREINTE decimal(5, 2) ,
@ART_FICHE_PAL varchar(1) ,
@ART_PLANTATION varchar(3) ,
@ART_ESPECE varchar(3) ,
@ART_EAN varchar(13) ,
@ART_VL varchar(2) ,
@ART_VA varchar(2) ,
@ART_SPCB numeric(5, 0) ,
@ART_PCB numeric(5, 0) ,
@ART_TRAITEMENT varchar(1) ,
@ART_DLC numeric(4, 0) ,
@ART_DATE_CREAT datetime ,
@ART_USER_CREAT varchar(10) ,
@ART_DATE_MODIF datetime ,
@ART_USER_MODIF varchar(10) ,
@ART_SIGNALETIQUE varchar(1000) ,
@ART_ARRONDI varchar(1) ,
@ART_TARE_UNIT_VTE decimal(8, 3) ,
@ART_COLIS_PAL numeric(3, 0) ,
@ART_FABRIQ decimal(8, 2) ,
@ART_FOURNI_FABRIQ varchar(8) ,
@ART_FAMARR varchar(7) ,
@ART_ACTIF_ACH varchar(1) ,
@ART_ACTIF_APP varchar(1) ,
@ART_PR_TOLERANCE decimal(5, 2) ,
@ART_DLUO numeric(4, 0) ,
@ART_MARGE_MINI decimal(6, 2) ,
@ART_MARGE_MAXI decimal(6, 2) ,
@ART_TYPE_EMB varchar(1) ,
@ART_PAYS varchar(3) ,
@ART_MULTI_COND varchar(1) ,
@ART_GESTION_PB varchar(1) ,
@ART_UNIT_CDE_ACH varchar(1) ,
@ART_TRA_COMP1 varchar(1) ,
@ART_TRA_COMP2 varchar(1) ,
@ART_TRA_COMP3 varchar(1) ,
@ART_TRA_COMP4 varchar(1) ,
@ART_TRA_COMP5 varchar(1) ,
@ART_TRA_COMP6 varchar(1) ,
@ART_TRA_COMP7 varchar(1) ,
@ART_TRA_COMP8 varchar(1) ,
@ART_TRA_COMP9 varchar(1) ,
@ART_HEXA_CODE varchar(3) ,
@ART_HEXA_LIB varchar(24) ,
@ART_HEXA_FAM varchar(3) ,
@ART_HEXA_ORIG varchar(2) ,
@ART_HEXA_COND varchar(4) ,
@ART_HEXA_DLC varchar(1) ,
@ART_TYPE varchar(5) ,
@ART_FABRIQ_PDS_NET decimal(10, 4) ,
@ART_FABRIQ_QUANTITE numeric(6, 0) ,
@ART_UNIT_REF varchar(1) ,
@ART_IMAGE image ,
@ART_COM_FABRICATION varchar(1000) ,
@ART_ALERTE_STOCK varchar(1) ,
@ART_POIDS_VARIABLE varchar(1) ,
@ART_CALC_DLC_DLUO varchar(1) ,
@ART_RUB7 varchar(5) ,
@ART_RUB8 varchar(5) ,
@ART_RUB9 varchar(5) ,
@ART_RUB10 varchar(5) ,
@ART_VENTEDETAIL varchar(1) ,
@ART_DEPOT varchar(3) ,
@ART_TARE_UVC decimal(8, 4) ,
@ART_FILE_PREPA varchar(3) ,
@ART_REFERENCE varchar(15) ,
@ART_SITE_FAB varchar(3) ,
@ART_STATUT varchar(1) ,
@ART_MARCH_SERVICE varchar(1) ,
@ART_MODE_DLC varchar(1) ,
@ART_EAN_PALETTE varchar(14) ,
@ADN_CODE varchar(15),
@ART_FOND_PAGE varchar(20),
@ART_TEXTE1 varchar(60),
@ART_CODE_Prod varchar(15),
@SQL1 varchar(8000)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
begin try
insert openquery([ERP_PROD],'INSERT INTO GCTRADUCTION (TRAD_TYPE,TRAD_CODE,TRAD_LANGUE,TRAD_LIBELLE1_TRAD)')
VALUES('ARTICLE_LIB',@tradCode,'FR',@tradLib1);
insert openquery([ERP_PROD],'INSERT INTO GCARTICLE (ART_CODE,ART_SITE,ART_SITE_FAB,ART_ACTIF,ART_ACTIF_ACH,ART_UNIT_ACH,ART_UNIT_VEN,ART_UNIT_CDE_ACH,
ART_UNIT_CDE,ART_UNIT_STK,ART_POIDS_VARIABLE,ART_PDS_VEN,ART_PIE_VEN,ART_CODE_TVA,ART_CODE_TAXE,
ART_FAM_CPTA,ART_MARCH_SERVICE,ART_RUB1,ART_RUB2,ART_RUB3,ART_RUB4,ART_RUB5,ART_RUB6,ART_RUB7,
ART_RUB8,ART_STAT1,ART_STAT2,ART_STAT3,ART_STAT4,ART_ESPECE,ART_STOCK,ART_PDS_BRUT,ART_TARE_UNIT,ART_TARE_UNIT_VTE,
ART_PDS_NET,ART_PIECE_COL,ART_COLIS_PAL,ART_DESTOCK_ART,ART_EXCLU_DEB,ART_CODE_DEB,ART_DEFAUT_FOUR,ART_TOLERANCE,
ART_VENTEDETAIL,ART_CODE_EMB,ART_FREINTE,ART_PR_TOLERANCE,ART_TARE_UVC,ART_MODE_DLC,ART_CALC_DLC_DLUO,ART_DLC,ART_DLUO,ART_PIECE_PDS,ART_ARRONDI,ART_ACTIF_APP,
ART_MULTI_COND,ART_TRA_COMP1,ART_TRA_COMP2,ART_TRA_COMP3,ART_TRA_COMP4,ART_TRA_COMP5,ART_TRA_COMP6,ART_TRA_COMP7,ART_TRA_COMP8,ART_TRA_COMP9)')
values(@ART_CODE,
@ART_SITE,
@ART_SITE_FAB,
@ART_ACTIF,
@ART_ACTIF_ACH,
@ART_UNIT_ACH,
@ART_UNIT_VEN,
@ART_UNIT_CDE_ACH,
@ART_UNIT_CDE,
@ART_UNIT_STK,
@ART_POIDS_VARIABLE,
@ART_PDS_VEN,
@ART_PIE_VEN,
@ART_CODE_TVA,
@ART_CODE_TAXE,
@ART_FAM_CPTA,
@ART_MARCH_SERVICE,
@ART_RUB1,
@ART_RUB2,
@ART_RUB3,
@ART_RUB4,
@ART_RUB5,
@ART_RUB6,
@ART_RUB7,
@ART_RUB8,
@ART_STAT1,
@ART_STAT2,
@ART_STAT3,
@ART_STAT4,
@ART_ESPECE,
@ART_STOCK,
@ART_PDS_BRUT,
@ART_TARE_UNIT,
@ART_TARE_UNIT_VTE,
@ART_PDS_NET,
@ART_PIECE_COL,
@ART_COLIS_PAL,
@ART_DESTOCK_ART,
@ART_EXCLU_DEB,
@ART_CODE_DEB,
@ART_DEFAUT_FOUR,
@ART_TOLERANCE,
@ART_VENTEDETAIL,
@ART_CODE_EMB,
@ART_FREINTE,
@ART_PR_TOLERANCE,
@ART_TARE_UVC,
@ART_MODE_DLC,
@ART_CALC_DLC_DLUO,
@ART_DLC,
@ART_DLUO,
@ART_PIECE_PDS,
'N',
'O',
'N',
'N',
'N',
'N',
'N',
'N',
'N',
'N',
'N',
'N');
SELECT @SQL1 = 'UPDATE OPENQUERY([ERP_PROD], ''select ART_FOND_PAGE, ART_TEXTE1,ART_CHOIX_ETI,ART_CODE,ART_TEXTE_LIBRE FROM GCARTICLE_PROD WHERE ART_CODE = ' + CAST(@ART_CODE_Prod as varchar(15)) + ''')
SET ART_FOND_PAGE = ' + QUOTENAME(@ART_FOND_PAGE,'''') + ', ART_TEXTE1 = ' + quotename(@ART_TEXTE1,'''') + ', ART_CHOIX_ETI = ' + 'S' + ', ART_CODE = ' + QUOTENAME(@ART_CODE_Prod,'''') +
', ART_TEXTE_LIBRE = ' + 'O';
PRINT @SQL1;
insert openquery([ERP_PROD],'INSERT INTO GCART_DECLAR_NUTRITION (ADN_CODE,ADN_UNITE_MESURE)')
values(@ADN_CODE,'G');
end try
begin catch
if @@TRANCOUNT > 0
rollback transaction;
end catch
if @@TRANCOUNT > 0
commit transaction;
END
GO |
Partager