示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RetrieveInventoryAdjustmentResponse"/> class.
 /// </summary>
 /// <param name="errors">errors.</param>
 /// <param name="adjustment">adjustment.</param>
 public RetrieveInventoryAdjustmentResponse(
     IList <Models.Error> errors           = null,
     Models.InventoryAdjustment adjustment = null)
 {
     this.Errors     = errors;
     this.Adjustment = adjustment;
 }
示例#2
0
 public InventoryChange(string type = null,
                        Models.InventoryPhysicalCount physicalCount = null,
                        Models.InventoryAdjustment adjustment       = null,
                        Models.InventoryTransfer transfer           = null)
 {
     Type          = type;
     PhysicalCount = physicalCount;
     Adjustment    = adjustment;
     Transfer      = transfer;
 }
示例#3
0
        void ITransaccion.Execute()
        {
            // GenerateDocument();
            Models.InventoryAdjustment item = getFromFile(file);
            bool res = false;

            foreach (Models.ItemAvailability ia in item.Items)
            {
                if (ia.Codigoalmacen.Trim().ToUpper() == store.Trim().ToUpper())
                {
                    if (ItemExist(ia.Codigo))
                    {
                        Models.Item itm = GetItem(ia.Codigo.Trim());

                        itm.Qty_Inventory     = ia.Cantidad;
                        itm.PricewithoutVAT   = ia.Precio_neto;
                        itm.PriceincludingVAT = ia.Precio_con_itbms;
                        itm.VAT = ia.Porcentaje_itbms;

                        res = InsertItem(itm);

                        if (!res)
                        {
                            break;
                        }
                    }
                }
            }

            if (res)
            {
                try {
                    if (File.Exists(this.HistPathOut + "\\OK_" + fname))
                    {
                        File.Delete(this.HistPathOut + "\\OK_" + fname);
                    }

                    File.Move(file, this.HistPathOut + "\\OK_" + fname);
                } catch { }
            }
            else
            {
                try {
                    if (File.Exists(this.HistPathOut + "\\ERR_" + fname))
                    {
                        File.Delete(this.HistPathOut + "\\ERR_" + fname);
                    }

                    File.Move(file, this.HistPathOut + "\\ERR_" + fname);
                } catch { }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="InventoryChange"/> class.
 /// </summary>
 /// <param name="type">type.</param>
 /// <param name="physicalCount">physical_count.</param>
 /// <param name="adjustment">adjustment.</param>
 /// <param name="transfer">transfer.</param>
 /// <param name="measurementUnit">measurement_unit.</param>
 /// <param name="measurementUnitId">measurement_unit_id.</param>
 public InventoryChange(
     string type = null,
     Models.InventoryPhysicalCount physicalCount   = null,
     Models.InventoryAdjustment adjustment         = null,
     Models.InventoryTransfer transfer             = null,
     Models.CatalogMeasurementUnit measurementUnit = null,
     string measurementUnitId = null)
 {
     this.Type              = type;
     this.PhysicalCount     = physicalCount;
     this.Adjustment        = adjustment;
     this.Transfer          = transfer;
     this.MeasurementUnit   = measurementUnit;
     this.MeasurementUnitId = measurementUnitId;
 }
示例#5
0
 public Builder Adjustment(Models.InventoryAdjustment value)
 {
     adjustment = value;
     return(this);
 }
        void thread()
        {
            DataTable Transactions = getAllLocation();
            string    prevDoc      = "";
            int       total        = Transactions.Rows.Count;


            // esrcibo en el nowin porque van para premiumsoft
            foreach (DataRow row in Transactions.Rows)
            {
                if (prevDoc != row["LOCNCODE"].ToString().Trim())
                {
                    DataTable TransactionDetail = getInventorySnapshot(row["LOCNCODE"].ToString().Trim(), mItmbs);
                    string    ADJUST            = row["LOCNCODE"].ToString().Trim();

                    string FileName = "GP_INI_{0}.xml";

                    IEvent e = new InfoEvent("", "", "Iniciando la creación del archivo XML '" + String.Format(FileName, ADJUST) + "'.");
                    e.Publish();
                    // xml //
                    XmlDocument doc = new XmlDocument();

                    XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
                    XmlElement     root           = doc.DocumentElement;
                    doc.InsertBefore(xmlDeclaration, root);

                    /* Lines */
                    XmlElement Lines = doc.CreateElement(string.Empty, "lines", string.Empty);
                    /* Lines */
                    /////////
                    Models.InventoryAdjustment ia = new Models.InventoryAdjustment();

                    foreach (DataRow det in TransactionDetail.Rows)
                    {
                        string DOCNUMBR = det["LOCNCODE"].ToString().Trim();
                        string USERID   = "UNKNOWN";

                        string DOCDATE  = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + " 00:00";
                        string TIME     = DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":00";
                        string ITEMNMBR = det["ITEMNMBR"].ToString().Trim();

                        Models.ItemAvailability iav = new Models.ItemAvailability();
                        try
                        {
                            if (det["PRCLEVEL"].ToString().Trim() == "GALAPAGO")
                            {
                                XmlElement Item = doc.CreateElement(string.Empty, "articulo", string.Empty);

                                ///* document */
                                //XmlElement document = doc.CreateElement(string.Empty, "documento", string.Empty);
                                iav.Codigoalmacen = det["LOCNCODE"].ToString().Trim();//XmlText document_text = doc.CreateTextNode(det["LOCNCODE"].ToString().Trim());
                                //document.AppendChild(document_text);
                                //Item.AppendChild(document);
                                ///* document */

                                ///* realizador */
                                //XmlElement realizador = doc.CreateElement(string.Empty, "realizador", string.Empty);
                                iav.Realizador = USERID;//XmlText realizador_text = doc.CreateTextNode("UNKNOWN");
                                //realizador.AppendChild(realizador_text);
                                //Item.AppendChild(realizador);
                                ///* realizador */

                                ///* motivo */
                                //XmlElement motivo = doc.CreateElement(string.Empty, "motivo", string.Empty);
                                iav.Motivo = "ESTATUS ACTUAL DE INVENTARIO";//XmlText motivo_text = doc.CreateTextNode("ESTATUS ACTUAL DE INVENTARIO");
                                //motivo.AppendChild(motivo_text);
                                //Item.AppendChild(motivo);
                                ///* motivo */

                                ///* fecha */
                                //XmlElement fecha = doc.CreateElement(string.Empty, "fecha", string.Empty);
                                iav.Fecha = DOCDATE;//XmlText fecha_text = doc.CreateTextNode(DOCDATE);
                                //fecha.AppendChild(fecha_text);
                                //Item.AppendChild(fecha);
                                ///* fecha */

                                ///* hora */
                                //XmlElement hora = doc.CreateElement(string.Empty, "hora", string.Empty);
                                iav.Hora = TIME;//XmlText hora_text = doc.CreateTextNode(TIME);
                                //hora.AppendChild(hora_text);
                                //Item.AppendChild(hora);
                                ///* hora */

                                ///* codigo */
                                //XmlElement codigo = doc.CreateElement(string.Empty, "codigo", string.Empty);
                                iav.Codigo = ITEMNMBR;//XmlText codigo_text = doc.CreateTextNode(ITEMNMBR);
                                //codigo.AppendChild(codigo_text);
                                //Item.AppendChild(codigo);
                                ///* codigo */

                                ///* nombre */
                                //XmlElement nombre = doc.CreateElement(string.Empty, "nombre", string.Empty);
                                iav.Nombre = det["ITEMDESC"].ToString().Trim();//XmlText nombre_text = doc.CreateTextNode(det["ITEMDESC"].ToString().Trim());
                                //nombre.AppendChild(nombre_text);
                                //Item.AppendChild(nombre);
                                ///* nombre */

                                ///* grupo */
                                //XmlElement grupo = doc.CreateElement(string.Empty, "grupo", string.Empty);
                                iav.Grupo = det["ITMCLSCD"].ToString().Trim();//XmlText grupo_text = doc.CreateTextNode(det["ITMCLSCD"].ToString().Trim());
                                //grupo.AppendChild(grupo_text);
                                //Item.AppendChild(grupo);
                                ///* grupo */

                                ///* tipoproceso */
                                //XmlElement tipoproceso = doc.CreateElement(string.Empty, "tipoproceso", string.Empty);
                                iav.Tipoproceso = 1;//XmlText tipoproceso_text = doc.CreateTextNode("1");
                                //tipoproceso.AppendChild(tipoproceso_text);
                                //Item.AppendChild(tipoproceso);
                                ///* tipoproceso */

                                ///* codigoalmacen */
                                //XmlElement codigoalmacen = doc.CreateElement(string.Empty, "codigoalmacen", string.Empty);
                                iav.Codigoalmacen = det["LOCNCODE"].ToString().Trim();//XmlText codigoalmacen_text = doc.CreateTextNode(det["LOCNCODE"].ToString().Trim());
                                //codigoalmacen.AppendChild(codigoalmacen_text);
                                //Item.AppendChild(codigoalmacen);
                                ///* codigoalmacen */


                                ///* usuario */
                                //XmlElement usuario = doc.CreateElement(string.Empty, "descripcion", string.Empty);
                                iav.Descripcion = row["LOCNDSCR"].ToString().Trim();//XmlText usuario_text = doc.CreateTextNode(row["LOCNDSCR"].ToString().Trim());
                                //usuario.AppendChild(usuario_text);
                                //Item.AppendChild(usuario);
                                ///* usuario */

                                ///* ubicacion */
                                //XmlElement ubicacion = doc.CreateElement(string.Empty, "usuario", string.Empty);
                                iav.Usuario = "UNKNOWN"; //XmlText ubicacion_text = doc.CreateTextNode("UNKNOWN");
                                //ubicacion.AppendChild(ubicacion_text);
                                //Item.AppendChild(ubicacion);
                                ///* ubicacion */


                                ///* descripción */
                                //XmlElement descripcion = doc.CreateElement(string.Empty, "ubicacion", string.Empty);
                                iav.Ubicacion = row["ADDRESS1"].ToString().Trim();//XmlText descripcion_text = doc.CreateTextNode(row["ADDRESS1"].ToString().Trim());
                                //descripcion.AppendChild(descripcion_text);
                                //Item.AppendChild(descripcion);
                                ///* descripción */



                                ///* precio */
                                //XmlElement precio = doc.CreateElement(string.Empty, "precio_neto", string.Empty);
                                iav.Precio_neto = (decimal)Convert.ToDecimal(det["PRICE"].ToString().Trim().Replace(",", "."));//XmlText precio_text = doc.CreateTextNode(det["PRICE"].ToString().Trim().Replace(",", "."));
                                //precio.AppendChild(precio_text);
                                //Item.AppendChild(precio);
                                ///* precio */

                                ///* cost */
                                //XmlElement cost = doc.CreateElement(string.Empty, "precio_con_itbms", string.Empty);
                                iav.Precio_con_itbms = (decimal)Convert.ToDecimal(det["PRICEWITMBS"].ToString().Trim().Replace(",", ".")); //XmlText cost_text = doc.CreateTextNode(det["PRICEWITMBS"].ToString().Trim().Replace(",", "."));
                                //cost.AppendChild(cost_text);
                                //Item.AppendChild(cost);
                                ///* costo */

                                ///* costo */
                                //#region "COSTO NODE"
                                //XmlElement costo = doc.CreateElement(string.Empty, "costo", string.Empty);
                                iav.Costo = (decimal)Convert.ToDecimal(det["CURRCOST"].ToString().Trim().Replace(",", "."));//XmlText costo_text = doc.CreateTextNode(det["CURRCOST"].ToString().Trim().Replace(",", "."));
                                //costo.AppendChild(costo_text);
                                //Item.AppendChild(costo);
                                //#endregion
                                ///* costo */

                                //XmlElement element7 = doc.CreateElement(string.Empty, "porcentaje_itbms", string.Empty);
                                iav.Porcentaje_itbms = (decimal)Convert.ToDecimal(det["ITMBSPCT"].ToString().Trim().Replace(",", ".")); //XmlText text5 = doc.CreateTextNode(det["ITMBSPCT"].ToString().Trim().Replace(",", "."));
                                //element7.AppendChild(text5);
                                //Item.AppendChild(element7);

                                //XmlElement element8 = doc.CreateElement(string.Empty, "tipo", string.Empty);
                                iav.Tipo = (int)Convert.ToInt32(det["ITEMTYPE"].ToString().Trim());//XmlText text6 = doc.CreateTextNode(det["ITEMTYPE"].ToString().Trim());
                                //element8.AppendChild(text6);
                                //Item.AppendChild(element8);

                                //XmlElement element9 = doc.CreateElement(string.Empty, "cantidad", string.Empty);
                                iav.Cantidad = (decimal)Convert.ToDecimal(det["DISP"].ToString().Trim().Replace(",", "."));//XmlText text7 = doc.CreateTextNode(det["DISP"].ToString().Trim().Replace(",", "."));
                                //element9.AppendChild(text7);
                                //Item.AppendChild(element9);

                                //XmlElement element10 = doc.CreateElement(string.Empty, "unidad_de_medida", string.Empty);
                                iav.Unidad_de_medida = det["UOFM"].ToString().Trim();//XmlText text8 = doc.CreateTextNode(det["UOFM"].ToString().Trim());
                                //element10.AppendChild(text8);
                                //Item.AppendChild(element10);


                                ia.Add(iav);//Lines.AppendChild(Item);
                            }
                        }
                        catch (Exception ex)
                        {
                            IEvent err = new ErrorEvent("", "", "No pudo crear el archivo xml correctamente. Mensaje: " + ex.Message);
                            err.Publish();
                        }
                    }
                    doc.AppendChild(Lines);

                    if (this.NowPathIn.ToCharArray().Last() == '/' || this.NowPathIn.ToCharArray().Last() == '\\')
                    {
                        if (!System.IO.File.Exists(this.mNowPathOut + string.Format(FileName, ADJUST)))
                        {
                            Models.InventoryAdjustment.SaveAs(this.mNowPathOut + string.Format(FileName, ADJUST), ia);// doc.Save(this.mNowPathOut + string.Format(FileName, ADJUST));
                        }
                    }
                    else
                    {
                        if (!System.IO.File.Exists(this.mNowPathOut + "/" + string.Format(FileName, ADJUST)))
                        {
                            Models.InventoryAdjustment.SaveAs(this.mNowPathOut + "/" + string.Format(FileName, ADJUST), ia);// doc.Save(this.mNowPathOut + "/" + string.Format(FileName, ADJUST));
                        }
                    }
                    total--;

                    ObserverManager.Instance.addSubject(new ProgressSubject(total, Transactions.Rows.Count - total));

                    IEvent e2 = new InfoEvent("", "", "El archivo '" + String.Format(FileName, ADJUST) + "'. fue creado correctamente");
                    e2.Publish();
                }

                prevDoc = row["LOCNCODE"].ToString().Trim();
            }
            ObserverManager.Instance.addSubject(new ProgressSubject(0, 0));
        }
示例#7
0
 public Builder Adjustment(Models.InventoryAdjustment adjustment)
 {
     this.adjustment = adjustment;
     return(this);
 }