Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var WSClient = new WSReference.zws_sd_pedidos_mbusiness2Client();
- WSClient.ClientCredentials.UserName.UserName = WSUser;
- WSClient.ClientCredentials.UserName.Password = WSPassword;
- List<WSReference.ZsdRfcHeader> headers = new List<WSReference.ZsdRfcHeader>();
- var header = new WSReference.ZsdRfcHeader()
- {
- Mandt = drVenta["Mandante"].ToString(),
- Idpedidomdsoft = SecuenciaPedidoERP, // "BM4000"
- Clase = drVenta["Clase"].ToString(), //'"N"
- Solicitante = drVenta["CliCodigo"].ToString(), //'"400000"
- Destinatario = "",
- Vendedor = drVenta["RepVendedor"].ToString(), //' "5"
- Transportista = "",
- Condpago = "",
- Fpedido = DateTime.Parse(drVenta["VenFecha"].ToString()).Date.ToString("yyyy -MM-dd"), // ' "2018-02-14"
- Importe = decimal.Parse(drVenta["VenMontoTotal"].ToString()),
- Obs = "",
- Vpago = "",
- Flete = 0,
- Fagrup = "",
- Vbeln = "",
- Status = "",
- Tipo = "",
- Agrup = "",
- Div = "",
- Uname = ""
- };
- headers.Add(header);
- WriteLog("Cargando el detalle");
- var details = new List<WSReference.ZsdRfcDetail>();
- var DTDetalle = Ventas.ObtenerDetalleVenta(RepCodigo, VenSecuencia);
- foreach (DataRow row in DTDetalle.Rows)
- {
- // 'Writelog("Producto: " & "'" & drDetalle!ProCodigo & "'")
- var detail = new WSReference.ZsdRfcDetail()
- {
- Mandt = drVenta["Mandante"].ToString(), // '"620"
- Idpedidomdsoft = SecuenciaPedidoERP, //' PedSecuencia '"BM4000"
- Idlinea = row["VenPosicion"].ToString(), //' "1"
- Posicion = "",//' drDetalle!PedPosicion '"1"
- Material = row["ProCodigo"].ToString(),// ' "50000050000017"
- Cantidad = decimal.Parse(row["VenCantidad"].ToString()) // '34
- };
- details.Add(detail);
- }
- if (details.Count() == 0)
- {
- strMsg = $"Error al Carga Venta a SAP: { RepCodigo + "-" + VenSecuencia } este Venta no tiene detalle";
- WriteLog(strMsg);
- Funciones.CrearTransaccionesErrores(4, RepCodigo, VenSecuencia, strMsg);
- }
- WriteLog("Enviando pedido a SAP");
- //'FALTA OBTENER EL NUMERO ERP
- var sale = new WSReference.ZsdRfcPedidos();
- sale.Header = headers.ToArray();
- sale.Detalle = details.ToArray();
- var rafaga = new WSReference.ZmfSdPedidosMbRafaga()
- {
- Opcion = "1",
- Pedidos = sale,
- };
- var respond = WSClient.ZmfSdPedidosMbRafaga(rafaga);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement