public CertixDS.USR_PRD_FASIRow EstraiFaseGalvanicaDaODL(CertixDS.USR_PRD_MOVFASIRow movFase, CertixDS ds) { using (CertixWSBusiness bCertix = new CertixWSBusiness()) { bCertix.FillUSR_PRD_FASI(ds, new List <string>(new string[] { movFase.IDPRDFASE })); CertixDS.USR_PRD_FASIRow fase = ds.USR_PRD_FASI.Where(x => x.IDPRDFASE == movFase.IDPRDFASE).FirstOrDefault(); if (fase == null) { string messaggio = string.Format("Nessuna fase trovata per IDPRDFASE: {0} ", movFase.IDPRDFASE); throw new ArgumentException(messaggio); } if (fase.IsIDPRDFASEPADRENull()) { string messaggio = "Impossibile risalire alla fase di galvanica"; throw new ArgumentException(messaggio); } bCertix.FillUSR_PRD_FASI(ds, new List <string>(new string[] { fase.IDPRDFASEPADRE })); CertixDS.USR_PRD_FASIRow faseGalvanica = ds.USR_PRD_FASI.Where(x => x.IDPRDFASE == fase.IDPRDFASEPADRE).FirstOrDefault(); if (faseGalvanica == null) { string messaggio = "Nessuna fase galvanica non trovata per IDPRDFASE: " + fase.IDPRDFASEPADRE; throw new ArgumentException(messaggio); } return(faseGalvanica); } }
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); }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string barcode = textBox1.Text; using (CertixWSBusiness bCertix = new CertixWSBusiness()) { CertixBLL bll = new CertixBLL(); CertixDS.USR_PRD_MOVFASIRow movFase = bll.VerificaBarcodeODL(barcode, _ds); if (movFase == null) { string messaggio = string.Format("Codice Code: {0} non valido", barcode); throw new ArgumentException(messaggio); } txtIdmagazz.Text = movFase.IsIDMAGAZZNull() ? string.Empty : movFase.IDMAGAZZ; if (!movFase.IsIDMAGAZZNull()) { bCertix.FillMAGAZZ(_ds, movFase.IDMAGAZZ); CertixDS.MAGAZZRow magazz = _ds.MAGAZZ.Where(x => x.IDMAGAZZ == movFase.IDMAGAZZ).FirstOrDefault(); if (magazz != null) { txtModelloMagazz.Text = magazz.MODELLO; } } CertixDS.USR_PRD_FASIRow faseGalvanica = bll.EstraiFaseGalvanicaDaODL(movFase, _ds); if (faseGalvanica == null) { string messaggio = string.Format("Codice Code: {0} fase galvanica non trovata", barcode); throw new ArgumentException(messaggio); } if (faseGalvanica.IsIDMAGAZZNull()) { string messaggio = string.Format("Codice Code: {0} articolo galvanica non trovato", barcode); throw new ArgumentException(messaggio); } else { bCertix.FillMAGAZZ(_ds, faseGalvanica.IDMAGAZZ); CertixDS.MAGAZZRow magazz = _ds.MAGAZZ.Where(x => x.IDMAGAZZ == faseGalvanica.IDMAGAZZ).FirstOrDefault(); if (magazz != null) { txtModelloMagazzWip.Text = magazz.MODELLO; } } txtIdmagazzWip.Text = faseGalvanica.IsIDMAGAZZNull() ? string.Empty : faseGalvanica.IDMAGAZZ; bCertix.FillAP_GALVANICA_MODELLO(_ds, movFase.IDMAGAZZ, faseGalvanica.IDMAGAZZ); if (_ds.AP_GALVANICA_MODELLO.Count != 0) { CertixDS.AP_GALVANICA_MODELLORow modello = _ds.AP_GALVANICA_MODELLO.Where(x => x.IDMAGAZZ == txtIdmagazz.Text && x.IDMAGAZZ_WIP == txtIdmagazzWip.Text).FirstOrDefault(); if (modello != null) { ddlBrand.Text = modello.IsBRANDNull() ? string.Empty : modello.BRAND; txtFinitura.Text = modello.IsFINITURANull() ? string.Empty : modello.FINITURA; bCertix.FillAP_GALVANICA_SPESSORI(ddlBrand.Text, txtFinitura.Text, _ds); List <string> etichette = _ds.AP_GALVANICA_SPESSORI.OrderBy(x => x.SEQUENZA).Select(x => x.ETICHETTA).ToList(); foreach (string etichetta in _ds.AP_GALVANICA_SPESSORI.OrderBy(x => x.SEQUENZA).Select(x => x.ETICHETTA).ToList()) { dgvEtichette.Rows.Add(etichetta); } } } } } }