public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     ScannedProductsDataSet ds = new ScannedProductsDataSet();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "ScannedBarcodesDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Ejemplo n.º 2
0
        //public ViewDocsForm(ProductsDataSet.ProductsTblRow productRow):this()
        //{
        //    this.panel2.SuspendLayout();
        //    this.SuspendLayout();
        //    _productRow = productRow;
        //    StringBuilder sb = new StringBuilder();
        //    sb.AppendFormat(System.Globalization.CultureInfo.CurrentCulture,
        //        "Код: {0} \nШтрихкод: {1} \nНазвание: {2}",
        //        _productRow.NavCode,
        //        _productRow.Barcode,
        //        _productRow.ProductName);
        //    this.label.Text = sb.ToString();

        //    Label l = new Label();
        //    l.Size = new System.Drawing.Size(231, 90);
        //    l.Name = string.Format("label{0}", 0);
        //    l.Left = 0;
        //    l.Top = 0;
        //    l.Text = "По данному товару \nнет никаких документов, \nнажмите желтую кнопку \nеще раз для выхода";
        //    l.BackColor = System.Drawing.Color.PaleGreen;
            
        //    this.panel2.Controls.Add(l);
        //    this.panel1.ResumeLayout(false);
        //    this.ResumeLayout();
        //}
        public ViewDocsForm(ProductsDataSet.ProductsTblRow productRow,
            ProductsDataSet.DocsTblRow[] docsRows,
            ScannedProductsDataSet scannedProducts):this()
        {
            this.panel2.SuspendLayout();
            this.SuspendLayout();

            _productRow = productRow;
            _scannedProducts = scannedProducts;
            _docsRows = docsRows;
            //this.listBox1.KeyDown += new KeyEventHandler(listBox1_KeyDown);
            this.Load += new EventHandler(ViewDocsForm_Load);
            int docCounter = 0;
            //this.Paint += new PaintEventHandler(ViewDocsForm_Paint);
            if (_productRow != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat(System.Globalization.CultureInfo.CurrentCulture,
                    "Код: {0} \nШтрихкод: {1} \nНазвание: {2}",
                    _productRow.NavCode,
                    _productRow.Barcode,
                    _productRow.ProductName);
                this.label.Text = sb.ToString();

                if (_docsRows != null && _docsRows.Length > 0)
                {
                    foreach (ProductsDataSet.DocsTblRow doc in _docsRows)
                    {

                        ScannedProductsDataSet.ScannedBarcodesRow srow =
                        _scannedProducts
                                .ScannedBarcodes
                                .FindByBarcodeDocTypeDocId(_productRow.Barcode,
                                                            doc.DocType,
                                                            doc.DocId);

                        DocumentClass d = new DocumentClass();
                        d.DocDate = doc.DocumentDate;
                        d.DocId = doc.DocId;
                        d.DocType = doc.DocType;
                        d.Text1 = doc.Text1;
                        d.Text2 = doc.Text2;
                        d.Text3 = doc.Text3;

                        d.PlanQuantity = doc.Quantity;
                        if (srow != null &&
                            srow["FactQuantity"] != System.DBNull.Value)
                            d.FactQuantity = srow.FactQuantity;
                        else
                            d.FactQuantity = 0;



                        Label l = new Label();
                        l.Size = new System.Drawing.Size(231, 60);
                        l.Name = string.Format("label{0}", documents.Count);
                        l.Left = 0;
                        l.Top = documents.Count * 60;
                        l.Text = d.ToString();
                        l.BackColor = System.Drawing.Color.PaleGreen;
                        l.TextAlign = ContentAlignment.TopCenter;
                        documents.Add(d);
                        this.panel2.Controls.Add(l);
                        selectedItem = 0;
                        docCounter++;

                    }
                }
               else
                {
                    Label l = new Label();
                    l.Size = new System.Drawing.Size(231, 60);
                    l.Name = string.Format("label{0}", 0);
                    l.Left = 0;
                    l.Top = 0;
                    l.Text = "По данному товару \nнет никаких документов";
                    l.BackColor = System.Drawing.Color.PaleGreen;
                    l.TextAlign = ContentAlignment.TopCenter;
                    this.panel2.Controls.Add(l);
                    docCounter++;
                }
                Label l1 = new Label();
                l1.Size = new System.Drawing.Size(231, 30);
                l1.Name = string.Format("label{0}", docCounter + 1);
                l1.Left = 0;
                l1.Top = (docCounter * 60);
                l1.Text = "Нажмите желтую кнопку или Clr-Fn\nеще раз для выхода";
                l1.BackColor = System.Drawing.Color.PaleGreen;
                l1.TextAlign = ContentAlignment.TopCenter;
                this.panel2.Controls.Add(l1);

            }

            this.panel1.ResumeLayout(false);
            this.ResumeLayout();
        }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     ScannedProductsDataSet ds = new ScannedProductsDataSet();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Ejemplo n.º 4
0
        void Action_OnActionCompleted(ProductsDataSet.DocsTblRow docsRow, ScannedProductsDataSet.ScannedBarcodesRow scannedRow)
        {
            if (this.InvokeRequired)
            {
                ActionsClass.ActionCompleted del =
                    new ActionsClass.ActionCompleted(Action_OnActionCompleted);
                this.Invoke(del,
                    docsRow,
                    scannedRow);
            }
            else
            {
                this.label18.Text = "";
                currentDocRow = docsRow;
                this.actionLabel.Text = TSDUtils.ActionCodeDescription.ActionDescription[docsRow.DocType];

                label20.Text = (scannedRow["PlanQuanity"] == System.DBNull.Value ||
                                scannedRow["PlanQuanity"] == null) ? string.Empty : scannedRow.PlanQuanity.ToString();

                label21.Text = (scannedRow["FactQuantity"] == System.DBNull.Value ||
                                scannedRow["FactQuantity"] == null) ? string.Empty : scannedRow.FactQuantity.ToString();



                if (docsRow.DocType == (byte)TSDUtils.ActionCode.BoxWProducts)
                {
                    //label21.Text = (scannedRow["FactQuantity"] == System.DBNull.Value ||
                    //            scannedRow["FactQuantity"] == null) ? string.Empty : scannedRow.FactQuantity.ToString();

                    ScannedProductsDataSet.ScannedBarcodesRow[] rowsS
                           = ActionsClass.Action.FindByDocIdAndDocType(scannedRow.DocId,
                           scannedRow.DocType);
                    int fQty = 0;
                    for (int i = 0; i < rowsS.Length; i++)
                    {
                        if (rowsS[i].Barcode == currentProductRow.Barcode)
                            fQty += rowsS[i].FactQuantity;
                    }

                    label21.Text = fQty.ToString();

                    if (fQty == scannedRow.PlanQuanity)
                    {


                        ProductsDataSet.DocsTblRow[] docsRows =
                            ActionsClass.Action.GetDataByDocIdAndType(scannedRow.DocId,
                            scannedRow.DocType);

                        int pQuantity = 0;
                        int fQuantity = 0;
                        for (int i = 0; i < docsRows.Length; i++)
                            pQuantity += docsRows[i].Quantity;

                        for (int i = 0; i < rowsS.Length; i++)
                            fQuantity += rowsS[i].FactQuantity;
                        if (pQuantity == fQuantity)
                        {
                            //907218|3001011908672|7|1|8|2011-09-03|7|7|7|907218|002355438|03.09.2011
                            ProductsDataSet.DocsTblRow[] docsNaklRows =
                                ActionsClass.Action.GetDataByDocIdAndType(scannedRow.DocId,
                                (byte)TSDUtils.ActionCode.IncomeBox);


                            //using (DialogForm dlgfrm =
                            //    new DialogForm(
                            DialogResult dr = DialogFrm.ShowMessage(
                                    "Короб по накладной"
                                    , docsNaklRows[0].Text2
                                    , "принят полностью!"
                                    , "Прием товара/nПо нажатию ЭНТЕР ВЫЙТИ в меню");//)
                            ActionsClass.Action.PlaySound(250);
                            //{
                            if (dr == DialogResult.Yes)
                            {
                                //inventRow.NavCode = row.NavCode;
                                //ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.BoxWProducts,
                                //    row,
                                //    inventRow
                                //    );
                            }
                            this.navCodeTB.Text = "";
                            //}
                        }
                    }
                }

                this.Refresh();
            }
        }
Ejemplo n.º 5
0
 void WriteDbTxt(ScannedProductsDataSet.ScannedBarcodesRow row)
 {
     //WriteDbTxt(row, row.FactQuantity);
 }
Ejemplo n.º 6
0
        void WriteDbTxt(ScannedProductsDataSet.ScannedBarcodesRow row, int quantity)
        {
            if (row.RowState == System.Data.DataRowState.Detached ||
                row.RowState == System.Data.DataRowState.Deleted ||
                row["FactQuantity"] == System.DBNull.Value ||
                //row.FactQuantity <= 0 ||
                //quantity <=0 ||
                DoScanEvents == false)
                return;
            
            /*using (System.IO.StreamWriter wr =
                new System.IO.StreamWriter(
                    System.IO.Path.Combine(Program.Default.DatabaseStoragePath, "scannedbarcodes.txt"), true))
            {*/
                //if (row["FactQuantity"] != System.DBNull.Value
                //    && row.FactQuantity > 0)
                {
                    string s =
                            string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}",
                                row.Barcode,
                                row.DocId,
                                row.DocType,
                                quantity,
                                (row["ScannedDate"] == System.DBNull.Value) ?
                                  DateTime.Today.AddHours(_timeShift).ToString("dd.MM.yyyy")
                                  : row.ScannedDate.AddHours(_timeShift).ToString("dd.MM.yyyy"),

                                (row["TerminalId"] == System.DBNull.Value) ?
                                   string.Empty : row.TerminalId.ToString(),
                                row.Priority,
                                row.PlanQuanity
                                );
                    byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s, "\r\n"));
                    //byte[] buff = new byte[] { 0xD, 0xA };

                    writer.Write(buff, 0, buff.Length);
                    writer.Flush();
                    //byte[] buff = System.Text.Encoding.UTF8.GetBytes(s);
                    //writer.Write(buff, 0, buff.Length);
                    //writer.WriteLine(System.
                    //    s);
                }

            //}
            if (row.DocType == (byte)TSDUtils.ActionCode.Reprice)
            {
                using (System.IO.StreamWriter wr =
                   new System.IO.StreamWriter(
                       System.IO.Path.Combine(Program.Default.DatabaseStoragePath, "register.txt"), true))
                {
                    string s =
                                string.Format("{0},{1,11:D}, {2,7:D}",
                                row.Barcode,
                                1,
                                quantity);
                    wr.WriteLine(s);


                }
            }
        }
Ejemplo n.º 7
0
        public void ChangeQtyPosition(
            ProductsDataSet.DocsTblRow docsRow,
            ScannedProductsDataSet.ScannedBarcodesRow scannedRow,
            int diffQty)
        {
            //ScannedProductsDataSet.ScannedBarcodesRow[] r =
            //_scannedProducts.ScannedBarcodes.FindByBarcodeAndDocType(datarow.Barcode, docsRow.DocType);



            //if (scannedRow != null && //existing row
            //    scannedRow.Priority == 0 //not closed
            //    && scannedRow["FactQuantity"] != System.DBNull.Value
            //    && scannedRow.FactQuantity > 0 //scanned already
            //    && Program.СurrentInvId != string.Empty
            //    )
            //{
            //DoScanEvents = false;
            scannedRow.FactQuantity = scannedRow.FactQuantity + diffQty;

            if (OnActionCompleted != null && docsRow != null)
                OnActionCompleted(docsRow, scannedRow);

            return;
            #region old action
            if (diffQty < 0)
            {
                //scannedRow.FactQuantity = 1;
                for (int i = diffQty; i < 0; i++)
                {
                    
                    scannedRow.FactQuantity -= 1;
                    //using (System.IO.StreamWriter wr =
                    //new System.IO.StreamWriter(
                    //    System.IO.Path.Combine(Program.Default.DatabaseStoragePath, "scannedbarcodes.txt"), true))
                    {
                        //if (row["FactQuantity"] != System.DBNull.Value
                        //    && row.FactQuantity > 0)
                        //{
                        string s =
                                string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}",
                                    scannedRow.Barcode,
                                    scannedRow.DocId,
                                    scannedRow.DocType,
                                    -1,
                                    (scannedRow["ScannedDate"] == System.DBNull.Value) ?
                                      DateTime.Today.AddHours(_timeShift).ToString("dd.MM.yyyy")
                                      : scannedRow.ScannedDate.AddHours(_timeShift).ToString("dd.MM.yyyy"),

                                    (scannedRow["TerminalId"] == System.DBNull.Value) ?
                                       string.Empty : scannedRow.TerminalId.ToString(),
                                    scannedRow.Priority,
                                    scannedRow.PlanQuanity
                                    );
                        //writer.WriteLine(s);
                        //byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s, '\n'));
                        byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s, "\r\n"));

                        writer.Write(buff, 0, buff.Length);
                        writer.Flush();
                    }

                }
            }
            else
            {
                if (diffQty > 0)
                {
                    for (int i = 0; i < diffQty; i++)
                    {
                        scannedRow.FactQuantity += 1;
                        //using (System.IO.StreamWriter wr =
                       // new System.IO.StreamWriter(
                        //    System.IO.Path.Combine(Program.Default.DatabaseStoragePath, "scannedbarcodes.txt"), true))
                        {
                            //if (row["FactQuantity"] != System.DBNull.Value
                            //    && row.FactQuantity > 0)
                            //{
                            string s =
                                    string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}",
                                        scannedRow.Barcode,
                                        scannedRow.DocId,
                                        scannedRow.DocType,
                                        1,
                                        (scannedRow["ScannedDate"] == System.DBNull.Value) ?
                                          DateTime.Today.AddHours(_timeShift).ToString("dd.MM.yyyy")
                                          : scannedRow.ScannedDate.AddHours(_timeShift).ToString("dd.MM.yyyy"),

                                        (scannedRow["TerminalId"] == System.DBNull.Value) ?
                                           string.Empty : scannedRow.TerminalId.ToString(),
                                        scannedRow.Priority,
                                        scannedRow.PlanQuanity
                                        );
                            //writer.WriteLine(s);
                            byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s, "\r\n"));
                            //byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s, '\n'));
                            writer.Write(buff, 0, buff.Length);
                            writer.Flush();
                        }
                    }
                }
            }
            #endregion

            //DoScanEvents = true;
            //if (OnActionCompleted != null && docsRow != null)
            //    OnActionCompleted(docsRow, scannedRow);
            
            //}

            //}
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Добавление записи о сканированном коробе, при режиме проверки коробов свой - чужой
 ///ScannedProductsDataSet.ScannedBarcodesRow
 ///long.Parse(barcode),
 ///(byte)TSDUtils.ActionCode.IncomeBox,
 ///row.DocId,
 ///row.Quantity,
 ///row.Priority);
 ///scannedRow.FactQuantity += 1;
 /// </summary>
 /// <param name="row"> ScannedProductsDataSet.ScannedBarcodesRow</param>
 public void IncomeBoxAction(ScannedProductsDataSet.ScannedBarcodesRow scannedRow)
 {
    // using (System.IO.StreamWriter wr =
    //new System.IO.StreamWriter(
    //    System.IO.Path.Combine(Program.Default.DatabaseStoragePath, "scannedbarcodes.txt"), true))
     {
         string s =
                 string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}",
                     scannedRow.Barcode,
                     scannedRow.DocId,
                     scannedRow.DocType,
                     1,
                     DateTime.Today.ToString("dd.MM.yyyy"),
                     Program.Default.TerminalID,
                     0
                     );
         byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s, "\r\n"));
         //byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s,'\n'));
         //byte[] buff = new byte[] { 0xD, 0xA };
         writer.Write(buff, 0, buff.Length);
         writer.Flush();
         //writer.WriteLine(s);
     }
 }