Exemplo n.º 1
0
        public void MappingPedidoDTOPedido(List <PedidoDTO> pedidoDTOList, Dictionary <string, tblPedido> dictionary, String emplazamiento, String cliente)
        {
            foreach (PedidoDTO pedidoDTO in pedidoDTOList)
            {
                tblPedido pedido   = null;
                String    compania = Utils.GetValueOrEmpty(FilePropertyUtils.Instance.GetValueString(Constants.INTERFACE_PEDIDOS + "." + Constants.COMPANIA, pedidoDTO.F4211_SRP1));

                dictionary.TryGetValue(pedidoDTO.F4201_DOCO, out pedido);
                if (pedido == null)
                {
                    String tipoPedido = Utils.GetValueOrEmpty(FilePropertyUtils.Instance.GetValueString(Constants.INTERFACE_PEDIDOS + "." + Constants.INTERFACE_PEDIDOS_TIPO_PEDIDO, pedidoDTO.F4201_DCTO));
                    String letra      = Utils.GetValueOrEmpty(FilePropertyUtils.Instance.GetValueString(Constants.INTERFACE_PEDIDOS + "." + Constants.INTERFACE_PEDIDOS_LETRA, pedidoDTO.F4201_DCTO));
                    String almacen    = Utils.GetValueOrEmpty(FilePropertyUtils.Instance.GetValueString(Constants.ALMACEN, pedidoDTO.F4201_MCU));
                    String sucursal   = Utils.GetValueOrEmpty(FilePropertyUtils.Instance.GetValueString(Constants.SUCURSAL, pedidoDTO.F4201_MCU));

                    /* CABEZERA */
                    pedido = fillCabezera(pedidoDTO, emplazamiento, letra, cliente, tipoPedido, almacen, sucursal);
                    /* DETALLE */
                    tblPedidoDetalle detalle = fillDetalle(pedidoDTO, compania);
                    pedido.tblPedidoDetalle.Add(detalle);
                    dictionary.Add(pedidoDTO.F4201_DOCO, pedido);
                }
                else
                {
                    /* DETALLE */
                    tblPedidoDetalle detalle = fillDetalle(pedidoDTO, compania);
                    pedido.tblPedidoDetalle.Add(detalle);
                }
            }
        }
Exemplo n.º 2
0
        private tblPedidoDetalle fillDetalle(PedidoDTO pedidoDTO, String compania)
        {
            tblPedidoDetalle detalle = new tblPedidoDetalle();

            detalle.pedd_linea    = !String.IsNullOrWhiteSpace(pedidoDTO.F4211_LNID) ? Convert.ToDecimal(pedidoDTO.F4211_LNID) : 0;
            detalle.pedd_compania = !String.IsNullOrWhiteSpace(compania) ? compania.Trim() : String.Empty;
            detalle.pedd_producto = !String.IsNullOrWhiteSpace(pedidoDTO.F4211_LITM) ? pedidoDTO.F4211_LITM : String.Empty;
            detalle.pedd_lote     = !String.IsNullOrWhiteSpace(pedidoDTO.F4211_LOTN) ? pedidoDTO.F4211_LOTN : String.Empty;
            detalle.pedd_cantidad = !String.IsNullOrWhiteSpace(pedidoDTO.F4211_UORG) ? Math.Abs(Convert.ToDecimal(pedidoDTO.F4211_UORG)) : 0;

            detalle.pedd_despachoParcial = false;
            detalle.pedd_epro_codigo     = String.Empty;
            detalle.pedd_loteUnico       = false;
            detalle.pedd_serie           = String.Empty;

            return(detalle);
        }