public void MappingReceptionDTORecepcion(List <ReceptionDTO> receptionDTOList, Dictionary <String, tblRecepcion> dictionary, String emplazamiento) { foreach (ReceptionDTO receptionDTO in receptionDTOList) { tblRecepcion recepcion = null; //dictionary.TryGetValue(receptionDTO.F4201_DOCO, out recepcion); JHV 28/06 se pasa a trabajar con la OT. dictionary.TryGetValue(receptionDTO.F4211_RORN, out recepcion); if (recepcion == null) { String tipo = FilePropertyUtils.Instance.GetValueString(Constants.INTERFACE_RECEPCION + "." + Constants.TIPO, receptionDTO.F4201_DCTO); /* CABEZERA */ recepcion = fillCabezera(receptionDTO, emplazamiento, tipo); /* DETALLE */ tblRecepcionDetalle detalle = fillDetalle(receptionDTO); recepcion.tblRecepcionDetalle.Add(detalle); //dictionary.Add(receptionDTO.F4201_DOCO, recepcion); dictionary.Add(receptionDTO.F4211_RORN, recepcion); } else { /* DETALLE */ tblRecepcionDetalle detalle = fillDetalle(receptionDTO); recepcion.tblRecepcionDetalle.Add(detalle); } } }
private tblRecepcionDetalle fillDetalle(PedidoDTO pedidoDTO) { tblRecepcionDetalle detalle = new tblRecepcionDetalle(); detalle.recd_serie = String.Empty; double linea = String.IsNullOrWhiteSpace(pedidoDTO.F4211_LNID) ? 0.0 : double.Parse(pedidoDTO.F4211_LNID, System.Globalization.CultureInfo.InvariantCulture) * 1000; detalle.recd_linea = Convert.ToInt64(linea); detalle.recd_lineaPedido = 0; detalle.recd_lote = !String.IsNullOrWhiteSpace(pedidoDTO.F4211_LOTN) ? pedidoDTO.F4211_LOTN.Trim() : String.Empty; detalle.recd_cantidad = !String.IsNullOrWhiteSpace(pedidoDTO.F4211_UORG) ? Math.Abs(Convert.ToInt64(Convert.ToDouble(pedidoDTO.F4211_UORG))) : 0; detalle.recd_compania = !String.IsNullOrWhiteSpace(pedidoDTO.F4211_SRP1) ? pedidoDTO.F4211_SRP1.Trim() : String.Empty; if (!String.IsNullOrWhiteSpace(pedidoDTO.F4211_LITM) && pedidoDTO.F4211_LITM.Length > 15) { // VERY HARDCODE detalle.recd_producto = "99999999999999"; } else { detalle.recd_producto = pedidoDTO.F4211_LITM; } detalle.recd_fechaVencimiento = Utils.ParseDate(Constants.FECHA_DEFAULT, "yyyy/MM/dd"); // VERY HARDCODE detalle.recd_numeroPedido = "0"; return(detalle); }
public void MappingReceptionDTORecepcion(List <ReceptionDTO> receptionDTOList, Dictionary <String, tblRecepcion> dictionary, String emplazamiento) { foreach (ReceptionDTO receptionDTO in receptionDTOList) { tblRecepcion recepcion = null; dictionary.TryGetValue(receptionDTO.F4201_DOCO, out recepcion); if (recepcion == null) { /* CABEZERA */ recepcion = fillCabezera(receptionDTO, emplazamiento); /* DETALLE */ tblRecepcionDetalle detalle = fillDetalle(receptionDTO); recepcion.tblRecepcionDetalle.Add(detalle); dictionary.Add(receptionDTO.F4201_DOCO, recepcion); } else { /* DETALLE */ tblRecepcionDetalle detalle = fillDetalle(receptionDTO); recepcion.tblRecepcionDetalle.Add(detalle); } } }
private tblRecepcionDetalle fillDetalle(ReceptionDTO receptionDTO) { tblRecepcionDetalle detalle = new tblRecepcionDetalle(); detalle.recd_serie = String.Empty; detalle.recd_linea = !String.IsNullOrWhiteSpace(receptionDTO.F4211_LNID) ? Convert.ToInt64(Convert.ToDouble(receptionDTO.F4211_LNID)) * 1000 : 0; detalle.recd_lineaPedido = 0; detalle.recd_lote = !String.IsNullOrWhiteSpace(receptionDTO.F4211_LOTN) ? receptionDTO.F4211_LOTN.Trim() : String.Empty; detalle.recd_cantidad = !String.IsNullOrWhiteSpace(receptionDTO.F4211_UORG) ? Convert.ToInt64(Convert.ToDouble(receptionDTO.F4211_UORG)) : 0; detalle.recd_compania = !String.IsNullOrWhiteSpace(receptionDTO.F4211_SRP1) ? receptionDTO.F4211_SRP1.Trim() : String.Empty; if (!String.IsNullOrWhiteSpace(receptionDTO.F4211_LITM) && receptionDTO.F4211_LITM.Length > 15) { // VERY HARDCODE detalle.recd_producto = "99999999999999"; } else { detalle.recd_producto = receptionDTO.F4211_LITM; } if (!String.IsNullOrWhiteSpace(receptionDTO.F4108_MMEJ)) { string result = DateTime.ParseExact(receptionDTO.F4108_MMEJ, "yyyyMMdd", CultureInfo.InvariantCulture).ToString("yyyy/MM/dd"); detalle.recd_fechaVencimiento = Utils.ParseDate(result, "yyyy/MM/dd"); } else { detalle.recd_fechaVencimiento = Utils.ParseDate(Constants.FECHA_DEFAULT, "yyyy/MM/dd"); } // VERY HARDCODE detalle.recd_numeroPedido = "0"; return(detalle); }