예제 #1
0
        private void SalvaMuasures(int IdMeasure, List <UploadMeasuresElementRequest> UploadMeasuresElements, CertixDS ds)
        {
            int sequenza = 0;

            using (CertixWSBusiness bCertix = new CertixWSBusiness())
            {
                foreach (UploadMeasuresElementRequest m in UploadMeasuresElements)
                {
                    CertixDS.AP_CERTIX_DETTAGLIORow dettaglio = ds.AP_CERTIX_DETTAGLIO.NewAP_CERTIX_DETTAGLIORow();
                    dettaglio.DATAINSERIMENTO   = DateTime.Now;
                    dettaglio.ETICHETTA         = m.Material;
                    dettaglio.IDMISURECERTIX    = IdMeasure;
                    dettaglio.IDMISURECERTIXDET = bCertix.GetID();
                    dettaglio.SEQUENZA          = sequenza;
                    sequenza++;
                    dettaglio.VALORE = m.Measure;
                    ds.AP_CERTIX_DETTAGLIO.AddAP_CERTIX_DETTAGLIORow(dettaglio);
                }
                bCertix.UpdateTable(ds.AP_CERTIX_DETTAGLIO.TableName, ds);
            }
        }
예제 #2
0
        public int CreateIdMeasureFromCodeAndIdLine(int IdLine, string Code, bool IsTest, out List <string> Measures)
        {
            Measures = new List <string>();
            if (IsTest)
            {
                if (IdLine < 0)
                {
                    string m = string.Format("Codice IdLine: {0} non valido", IdLine);
                    throw new ArgumentException(m);
                }

                if (Code == "12345678912345")
                {
                    Measures = new List <string>(new string[] { "Au", "Ni", "Pd" });
                }

                if (Code == "12345678912345")
                {
                    return(DateTime.Now.Minute);
                }

                string messaggio = string.Format("Codice Code: {0} non valido", Code);
                throw new ArgumentException(messaggio);
            }

            //********* PRODUZIONE ******
            CertixDS ds = new CertixDS();

            CertixDS.USR_PRD_MOVFASIRow movFase = VerificaBarcodeODL(Code, ds);
            if (movFase == null)
            {
                string messaggio = string.Format("Codice Code: {0} non valido", Code);
                throw new ArgumentException(messaggio);
            }

            CertixDS.USR_PRD_FASIRow faseGalvanica = EstraiFaseGalvanicaDaODL(movFase, ds);
            if (faseGalvanica == null)
            {
                string messaggio = string.Format("Codice Code: {0} fase galvanica non trovata", Code);
                throw new ArgumentException(messaggio);
            }
            if (faseGalvanica.IsIDMAGAZZNull())
            {
                string messaggio = string.Format("Codice Code: {0} articolo galvanica non trovato", Code);
                throw new ArgumentException(messaggio);
            }
            int idMeasure = -1;

            using (CertixWSBusiness bCertix = new CertixWSBusiness())
            {
                bCertix.FillAP_GALVANICA_SPESSORI(ds, movFase.IDMAGAZZ, faseGalvanica.IDMAGAZZ);


                if (ds.AP_GALVANICA_SPESSORI.Count == 0)
                {
                    string messaggio = string.Format("Codice Code: {0} articolo galvanica dati incompleti", Code);
                    throw new ArgumentException(messaggio);
                }

                CertixDS.AP_CERTIXRow certixRow = ds.AP_CERTIX.NewAP_CERTIXRow();
                certixRow.IDMISURECERTIX = bCertix.GetID();
                idMeasure              = (int)certixRow.IDMISURECERTIX;
                certixRow.IDLINE       = IdLine;
                certixRow.BARCODE      = Code;
                certixRow.IDMAGAZZ     = movFase.IDMAGAZZ;
                certixRow.IDMAGAZZ_WIP = faseGalvanica.IDMAGAZZ;
                certixRow.DATAMISURA   = DateTime.Now;
                ds.AP_CERTIX.AddAP_CERTIXRow(certixRow);

                bCertix.UpdateTable(ds.AP_CERTIX.TableName, ds);
            }
            Measures = ds.AP_GALVANICA_SPESSORI.OrderBy(x => x.SEQUENZA).Select(x => x.ETICHETTA).ToList();
            return(idMeasure);
        }
예제 #3
0
        private void btnSalva_Click(object sender, EventArgs e)
        {
            string brand = (string)ddlBrand.SelectedItem;

            if (string.IsNullOrEmpty(brand))
            {
                lblMessaggio.Text = "Brand non valorizzato";
                return;
            }

            if (string.IsNullOrEmpty(txtFinitura.Text))
            {
                lblMessaggio.Text = "Finitura non valorizzata";
                return;
            }

            if (dgvEtichette.Rows.Count == 0)
            {
                lblMessaggio.Text = "Etichette non inserite";
                return;
            }

            using (CertixWSBusiness bCertix = new CertixWSBusiness())
            {
                CertixDS.AP_GALVANICA_MODELLORow modello = _ds.AP_GALVANICA_MODELLO.Where(x => x.IDMAGAZZ == txtIdmagazz.Text && x.IDMAGAZZ_WIP == txtIdmagazzWip.Text).FirstOrDefault();
                if (modello == null)
                {
                    CertixDS.AP_GALVANICA_MODELLORow galvanicaModello = _ds.AP_GALVANICA_MODELLO.NewAP_GALVANICA_MODELLORow();
                    galvanicaModello.IDGALVAMODEL = bCertix.GetID();
                    galvanicaModello.IDMAGAZZ     = txtIdmagazz.Text;
                    galvanicaModello.IDMAGAZZ_WIP = txtIdmagazzWip.Text;
                    galvanicaModello.MODELLO      = txtModelloMagazz.Text;
                    galvanicaModello.COMPONENTE   = txtModelloMagazzWip.Text;
                    galvanicaModello.BRAND        = brand;
                    galvanicaModello.FINITURA     = txtFinitura.Text;

                    _ds.AP_GALVANICA_MODELLO.AddAP_GALVANICA_MODELLORow(galvanicaModello);
                }

                List <CertixDS.AP_GALVANICA_SPESSORIRow> elementi = _ds.AP_GALVANICA_SPESSORI.Where(x => x.BRAND == brand && x.FINITURA == txtFinitura.Text).ToList();
                foreach (CertixDS.AP_GALVANICA_SPESSORIRow elemento in elementi)
                {
                    elemento.Delete();
                }

                int sequenza = 0;
                foreach (DataGridViewRow dr in dgvEtichette.Rows)
                {
                    if (dr.IsNewRow)
                    {
                        continue;
                    }
                    CertixDS.AP_GALVANICA_SPESSORIRow spessore = _ds.AP_GALVANICA_SPESSORI.NewAP_GALVANICA_SPESSORIRow();
                    spessore.IDGALVASPESSORI = bCertix.GetID();
                    spessore.BRAND           = brand;
                    spessore.FINITURA        = txtFinitura.Text;
                    spessore.SEQUENZA        = sequenza;
                    sequenza++;
                    spessore.ETICHETTA = (string)dr.Cells[0].Value;
                    _ds.AP_GALVANICA_SPESSORI.AddAP_GALVANICA_SPESSORIRow(spessore);
                }

                bCertix.UpdateTable(_ds.AP_GALVANICA_MODELLO.TableName, _ds);
                bCertix.UpdateTable(_ds.AP_GALVANICA_SPESSORI.TableName, _ds);
            }
        }