public void setMaterials(Domino.NotesViewClass view) { if (view == null) { return; } SAPWS.ZFSS_SET_MALZEME eq = new sapFIN.SAPWS.ZFSS_SET_MALZEME(); eq.I_MALZEME = new sapFIN.SAPWS.ZFSS_S_MATNR_IMPORT[view.AllEntries.Count]; for (int n = 1; n <= view.AllEntries.Count; n++) { eq.I_MALZEME[n - 1] = new sapFIN.SAPWS.ZFSS_S_MATNR_IMPORT(); eq.I_MALZEME[n - 1].MATNR = Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n), "txtartsachnr"); eq.I_MALZEME[n - 1].ZZPMSID = Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n), "txtartpkid", 20); } SAPWS.ZFSS_SET_MALZEMEResponse res = sapService.ZFSS_SET_MALZEME(eq); }
public void setCustomers(Domino.NotesViewClass view) { if (view == null) { return; } SAPWS.ZFSS_SET_MUSTERI eq = new sapFIN.SAPWS.ZFSS_SET_MUSTERI(); eq.I_MUSTERI = new sapFIN.SAPWS.ZFSS_S_MUSTERI[view.AllEntries.Count]; for (int n = 1; n <= view.AllEntries.Count; n++) { eq.I_MUSTERI[n - 1] = new sapFIN.SAPWS.ZFSS_S_MUSTERI(); eq.I_MUSTERI[n - 1].KUNNR = Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n), "Kunden_Nummer"); //eq.I_MUSTERI[n-1].NAME1 = Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n),"Suchname"); //eq.I_MUSTERI[n - 1].NAME2 = Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n), "CompanyAddress"); } SAPWS.ZFSS_SET_MUSTERIResponse res = sapService.ZFSS_SET_MUSTERI(eq); }
public void setEquipments(Domino.NotesViewClass view) { if (view == null) { return; } SAPWS.ZFSS_SET_EQUIPMENT eq = new sapFIN.SAPWS.ZFSS_SET_EQUIPMENT(); eq.I_EQUIPMENT = new sapFIN.SAPWS.ZFSS_S_EQUIPMENT_IMPORT[view.AllEntries.Count]; for (int n = 1; n <= view.AllEntries.Count; n++) { // Ekipman bilgileri eq.I_EQUIPMENT[n - 1] = new sapFIN.SAPWS.ZFSS_S_EQUIPMENT_IMPORT(); eq.I_EQUIPMENT[n - 1].EQUNR = Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n), "numeqnr"); eq.I_EQUIPMENT[n - 1].ZZSWVER = Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n), "txteqsoftwareversion", 20); eq.I_EQUIPMENT[n - 1].ZZLOCAT = Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n), "txteqstandort", 30); // Malzeme üzerinden gelecek bilgiler eq.I_EQUIPMENT[n - 1].ZZPMSID = Program.lotus.getMaterialPmsId(Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n), "txtartsachnr")); } SAPWS.ZFSS_SET_EQUIPMENTResponse res = sapService.ZFSS_SET_EQUIPMENT(eq); }
public String getMaterialPmsId(String Matnr) { Domino.NotesDocumentClass material = getMaterial(Matnr); return(material != null?Lotus.getItemValue(material, "txtartpkid") : ""); }
static void Main(string[] args) { try { // Ön hazırlıklar appendLog("SAP FSS Integration v" + version); appendLog("Cozumevi Consulting"); appendLog("www.cozumevi.com"); config = new Config(); lotus = new Lotus(); lotus.connect(config.lotusPassword); sap = new Sap(); // Müşteriler //if (paramExists(args, "-mus")) { appendLog("Müşteriler SAP -> FSS yönünde aktariliyor"); lotus.setCustomers(sap.getCustomers()); sap.setStatu(); appendLog("Müşteriler FSS -> SAP yönünde aktariliyor"); sap.setCustomers(lotus.getCustomers()); } // Malzemeler if (paramExists(args, "-mal")) { appendLog("Malzemeler SAP -> FSS yönünde aktariliyor"); lotus.setMaterials(sap.getMaterials()); sap.setStatu(); appendLog("Malzemeler FSS -> SAP yönünde aktariliyor"); sap.setMaterials(lotus.getMaterials()); } // Ekipmanlar if (paramExists(args, "-eki")) { appendLog("Ekipmanlar SAP -> FSS yönünde aktariliyor"); lotus.setEquipments(sap.getEquipments()); sap.setStatu(); appendLog("Ekipmanlar FSS -> SAP yönünde aktariliyor"); sap.setEquipments(lotus.getEquipments()); } // Siparişler (Dispatch) /// Burada özellikle önce FSS -> SAP yaptık /// Zira Dispatch'lerin alanlarının neredeyse tamamı iki tarafta da değişebilir /// Ve biz FSS'te yapılan değişiklikleri daha doğru diye varsayıyoruz if (paramExists(args, "-sip")) { appendLog("Siparişler FSS -> SAP yönünde aktariliyor"); sap.setDispatchs(lotus.getDispatchs()); } /*appendLog("Siparişler SAP -> FSS yönünde aktariliyor"); * SAPWS.ZFSS_S_DISPATCH[] sapDis; * SAPWS.ZFSS_S_DISPATCH_TEXT[] sapDist; * SAPWS.ZFSS_S_DISPATCH_Z7[] sapZ7; * SAPWS.ZFSS_S_DISPATCH_EQUIPMENT[] sapDispEqui; * sap.getDispatchs(out sapDis, out sapDist, out sapZ7, out sapDispEqui); * lotus.setDispatchs(sapDis, sapDist, sapZ7, sapDispEqui); * sap.setStatu();*/ // Teyitler if (paramExists(args, "-tey")) { appendLog("Teyitler FSS -> SAP yönünde aktariliyor"); sap.setConfirmations(lotus.getDispatchs()); } // Bileşenler if (paramExists(args, "-bil")) { appendLog("Bileşenler FSS -> SAP yönünde aktariliyor"); sap.setComponents(lotus.getDispatchs()); } // Final lotus.disconnect(); appendLog("Program bitti"); } catch (Exception ex) { appendLog(ex.ToString()); Console.ReadKey(); } }
public void setDispatchs(Domino.NotesViewClass view) { ArrayList txtr, txti, txtw; int dispcount = 0; int disppos = -1; if (view == null) { return; } // Verileri çek SAPWS.ZFSS_SET_DISPATCH eq = new sapFIN.SAPWS.ZFSS_SET_DISPATCH(); // Toplamda kaç Dispatch ile karşı karşıyayız tespit et ve Dispatch değişkenlerini yarat for (int n = 1; n <= view.AllEntries.Count; n++) { String form = Lotus.getItemValue((Domino.NotesDocumentClass)view.GetNthDocument(n), "FORM"); if (form == "frm_ea") { for (int m = 1; m <= view.GetNthDocument(n).Responses.Count; m++) { Domino.NotesDocumentClass sd = (Domino.NotesDocumentClass)view.GetNthDocument(n).Responses.GetNthDocument(m); String subform = Lotus.getItemValue(sd, "FORM"); if (subform == "frm_gzea") { dispcount++; } } } } if (dispcount <= 0) { return; } eq.I_DISPATCH = new sapFIN.SAPWS.ZFSS_S_DISPATCH_FLD[dispcount]; eq.I_TEXT = new sapFIN.SAPWS.ZFSS_S_DISPATCH_TEXT[0]; // Verileri aktar for (int n = 1; n <= view.AllEntries.Count; n++) { Domino.NotesDocumentClass di = (Domino.NotesDocumentClass)view.GetNthDocument(n); String form = Lotus.getItemValue(di, "FORM"); //if (form == "frm_ea" || form == "frm_gzea") if (form == "frm_ea") { for (int m = 1; m <= view.GetNthDocument(n).Responses.Count; m++) { Domino.NotesDocumentClass sd = (Domino.NotesDocumentClass)view.GetNthDocument(n).Responses.GetNthDocument(m); String subform = Lotus.getItemValue(sd, "FORM"); if (subform == "frm_gzea") { disppos++; eq.I_DISPATCH[disppos] = new sapFIN.SAPWS.ZFSS_S_DISPATCH_FLD(); eq.I_DISPATCH[disppos].AUFNR = Lotus.getItemValue(sd, "SAPtxtNo").Replace("U", ""); eq.I_DISPATCH[disppos].NAME1 = Lotus.getItemValue(sd, "anzeige1", 30); eq.I_DISPATCH[disppos].ZFSE = Lotus.getItemValue(sd, "SAPTSRID", 12); eq.I_DISPATCH[disppos].ZJOBTYPE = Lotus.getItemValue(di, "txtpriority", 4); eq.I_DISPATCH[disppos].AUFK_ERDAT = parseLotusDate(Lotus.getItemValue(di, "dateabestelltam")); eq.I_DISPATCH[disppos].GSTRP = parseLotusDate(Lotus.getItemValue(di, "dateeadue")); eq.I_DISPATCH[disppos].ZCONTACT_NAME1 = Lotus.getItemValue(di, "txteabesteller", 35); eq.I_DISPATCH[disppos].TEL_NUMBER = Lotus.getItemValue(di, "txtcontacttel", 30); txtr = splitText(Lotus.getItemValue(di, "txteakrztxt"), 132); for (int t = 0; t < txtr.Count; t++) { eq.I_TEXT = expandDispatchTextTable(eq.I_TEXT); eq.I_TEXT[eq.I_TEXT.Length - 1].AUFNR = eq.I_DISPATCH[disppos].AUFNR.Replace("U", ""); eq.I_TEXT[eq.I_TEXT.Length - 1].DTTYP = "R"; eq.I_TEXT[eq.I_TEXT.Length - 1].TLINE = (String)txtr[t]; } txti = splitText(Lotus.getItemValue(di, "rtxtinfoIntern"), 132); for (int t = 0; t < txti.Count; t++) { eq.I_TEXT = expandDispatchTextTable(eq.I_TEXT); eq.I_TEXT[eq.I_TEXT.Length - 1].AUFNR = eq.I_DISPATCH[disppos].AUFNR.Replace("U", ""); eq.I_TEXT[eq.I_TEXT.Length - 1].DTTYP = "I"; eq.I_TEXT[eq.I_TEXT.Length - 1].TLINE = (String)txti[t]; } txtw = splitText(Lotus.getItemValue(sd, "rtxtpruefbericht"), 132); for (int t = 0; t < txtw.Count; t++) { eq.I_TEXT = expandDispatchTextTable(eq.I_TEXT); eq.I_TEXT[eq.I_TEXT.Length - 1].AUFNR = eq.I_DISPATCH[disppos].AUFNR.Replace("U", ""); eq.I_TEXT[eq.I_TEXT.Length - 1].DTTYP = "W"; eq.I_TEXT[eq.I_TEXT.Length - 1].TLINE = (String)txtw[t]; } //eq.I_DISPATCH[disppos].AUFNR = Lotus.getItemValue(sd, "txteanrUS"); --> GEREK YOK ZATEN ÜSTTE YAZDIK String tmp = Lotus.getItemValue(di, "txteajobtype"); eq.I_DISPATCH[disppos].VAPLZ = tmp.Trim().Length <= 0 || tmp.IndexOf("-") <= 0 ? "" : tmp.Substring(0, tmp.IndexOf("-")); if (eq.I_DISPATCH[disppos].VAPLZ.Length > 8) { eq.I_DISPATCH[disppos].VAPLZ = eq.I_DISPATCH[disppos].VAPLZ.Substring(0, 8); } eq.I_DISPATCH[disppos].ZINVOICE = Lotus.getItemValue(di, "Invoice") == "1" ? "X" : ""; eq.I_DISPATCH[disppos].QMNUM = Lotus.getItemValue(sd, "numkdkostenstelle"); eq.I_DISPATCH[disppos].ZFSE = Lotus.getItemValue(di, "SAPTSRID"); eq.I_DISPATCH[disppos].KUNNR = Lotus.getItemValue(sd, "txtkdnr"); eq.I_DISPATCH[disppos].EQUNR = Lotus.getItemValue(sd, "numeqnr"); eq.I_DISPATCH[disppos].AUSVN = parseLotusDate(Lotus.getItemValue(di, "dateabestelltam")); if (Lotus.getItemValue(sd, "TXTEQSTATUS") == "2") // yeşil ışık { eq.I_DISPATCH[disppos].AUSBS = parseToday(); } eq.I_DISPATCH[disppos].ZFSSUST = Lotus.getItemValue(di, "numeanr"); // Additional readers String[] ar = Lotus.getItemValues(sd, "AdditionalReaders"); eq.I_Z7 = new sapFIN.SAPWS.ZFSS_S_DISPATCH_Z7[ar.Length]; for (int a = 0; a < ar.Length; a++) { eq.I_Z7[a] = new sapFIN.SAPWS.ZFSS_S_DISPATCH_Z7(); eq.I_Z7[a].AUFNR = eq.I_DISPATCH[disppos].AUFNR.Replace("U", ""); eq.I_Z7[a].PARNR = Program.lotus.getLotusPernr(ar[a]); } } // frm_gzea } // loop at subdocs } // IF FORM } // FOR SAPWS.ZFSS_SET_DISPATCHResponse res = sapService.ZFSS_SET_DISPATCH(eq); }
public void setComponents(Domino.NotesViewClass view) { int dispcount = 0; int disppos = -1; if (view == null) { return; } // Toplamda kaç Dispatch ile karşı karşıyayız tespit et ve Dispatch değişkenlerini yarat for (int n = 1; n <= view.AllEntries.Count; n++) { Domino.NotesDocumentClass di = (Domino.NotesDocumentClass)view.GetNthDocument(n); String form = Lotus.getItemValue(di, "FORM"); if (form == "frm_ea") { for (int m = 1; m <= di.Responses.Count; m++) { Domino.NotesDocumentClass sd = (Domino.NotesDocumentClass)di.Responses.GetNthDocument(m); String subform = Lotus.getItemValue(sd, "FORM"); if (subform == "frm_gzea") { for (int x = 1; x <= sd.Responses.Count; x++) { Domino.NotesDocumentClass co = (Domino.NotesDocumentClass)sd.Responses.GetNthDocument(x); String subform2 = Lotus.getItemValue(co, "FORM"); if (subform2 == "frm_lum") { dispcount++; } } } } } } if (dispcount <= 0) { return; } SAPWS.ZFSS_SET_COMPONENT eq = new sapFIN.SAPWS.ZFSS_SET_COMPONENT(); eq.I_COMPONENT = new sapFIN.SAPWS.ZFSS_S_COMPONENT[dispcount]; // Devam for (int n = 1; n <= view.AllEntries.Count; n++) { Domino.NotesDocumentClass di = (Domino.NotesDocumentClass)view.GetNthDocument(n); String form = Lotus.getItemValue(di, "FORM"); if (form == "frm_ea") { for (int m = 1; m <= di.Responses.Count; m++) { Domino.NotesDocumentClass sd = (Domino.NotesDocumentClass)di.Responses.GetNthDocument(m); String subform = Lotus.getItemValue(sd, "FORM"); if (subform == "frm_gzea") { for (int x = 1; x <= sd.Responses.Count; x++) { Domino.NotesDocumentClass co = (Domino.NotesDocumentClass)sd.Responses.GetNthDocument(x); String subform2 = Lotus.getItemValue(co, "FORM"); if (subform2 == "frm_lum") { disppos++; eq.I_COMPONENT[disppos] = new sapFIN.SAPWS.ZFSS_S_COMPONENT(); eq.I_COMPONENT[disppos].MATNR = Lotus.getItemValue(co, "txtartsachnr", 18); eq.I_COMPONENT[disppos].BDMNG = Lotus.getItemValueAsDecimal(co, "numlumverbrauch"); eq.I_COMPONENT[disppos].MEINS = Lotus.getItemValue(co, "numartme"); eq.I_COMPONENT[disppos].ZZACCNT = Lotus.getItemValue(co, "txtaccindcodeLUM"); eq.I_COMPONENT[disppos].ZZSERNE = Lotus.getItemValue(co, "txtfabriknr"); eq.I_COMPONENT[disppos].ZZSEROL = Lotus.getItemValue(co, "txtfabriknrout"); eq.I_COMPONENT[disppos].POTX1 = Lotus.getItemValue(co, "txtbemerk"); eq.I_COMPONENT[disppos].ZZVANLO = Lotus.getItemValue(co, "txtlumlagerort"); eq.I_COMPONENT[disppos].LUNID = co.UniversalID; eq.I_COMPONENT[disppos].AUFNR = Lotus.getItemValue(co, "SAPtxtNo", 40).Replace("U", ""); } } } } } } SAPWS.ZFSS_SET_COMPONENTResponse res = sapService.ZFSS_SET_COMPONENT(eq); }
public void setConfirmations(Domino.NotesViewClass view) { int dispcount = 0; int disppos = -1; if (view == null) { return; } // Toplamda kaç Dispatch ile karşı karşıyayız tespit et ve Dispatch değişkenlerini yarat for (int n = 1; n <= view.AllEntries.Count; n++) { Domino.NotesDocumentClass di = (Domino.NotesDocumentClass)view.GetNthDocument(n); String form = Lotus.getItemValue(di, "FORM"); if (form == "frm_ea") { for (int m = 1; m <= di.Responses.Count; m++) { Domino.NotesDocumentClass sd = (Domino.NotesDocumentClass)di.Responses.GetNthDocument(m); String subform = Lotus.getItemValue(sd, "FORM"); if (subform == "frm_gzea") { for (int x = 1; x <= sd.Responses.Count; x++) { Domino.NotesDocumentClass co = (Domino.NotesDocumentClass)sd.Responses.GetNthDocument(x); String subform2 = Lotus.getItemValue(co, "FORM"); if (subform2 == "frm_arbleist") { dispcount++; } } } } } } if (dispcount <= 0) { return; } SAPWS.ZFSS_SET_CONFIRMATION eq = new sapFIN.SAPWS.ZFSS_SET_CONFIRMATION(); eq.I_CONFIRMATION = new sapFIN.SAPWS.ZFSS_S_CONFIRMATION[dispcount]; // Devam for (int n = 1; n <= view.AllEntries.Count; n++) { Domino.NotesDocumentClass di = (Domino.NotesDocumentClass)view.GetNthDocument(n); String form = Lotus.getItemValue(di, "FORM"); if (form == "frm_ea") { for (int m = 1; m <= di.Responses.Count; m++) { Domino.NotesDocumentClass sd = (Domino.NotesDocumentClass)di.Responses.GetNthDocument(m); String subform = Lotus.getItemValue(sd, "FORM"); if (subform == "frm_gzea") { for (int x = 1; x <= sd.Responses.Count; x++) { Domino.NotesDocumentClass co = (Domino.NotesDocumentClass)sd.Responses.GetNthDocument(x); String subform2 = Lotus.getItemValue(co, "FORM"); if (subform2 == "frm_arbleist") { disppos++; eq.I_CONFIRMATION[disppos] = new sapFIN.SAPWS.ZFSS_S_CONFIRMATION(); eq.I_CONFIRMATION[disppos].ARBPL = Lotus.getItemValue(co, "numleiststdacttext", 6); eq.I_CONFIRMATION[disppos].BUDAT = parseLotusDate(Lotus.getItemValue(co, "dattatwork")); eq.I_CONFIRMATION[disppos].IEDZ_WAIT = parseLotusTime(Lotus.getItemValue(co, "numwaittimeende")); eq.I_CONFIRMATION[disppos].IEDZ_WORK = parseLotusTime(Lotus.getItemValue(co, "numleiststdende")); eq.I_CONFIRMATION[disppos].ISDZ_WAIT = parseLotusTime(Lotus.getItemValue(co, "numwaittimebeginn")); eq.I_CONFIRMATION[disppos].ISDZ_WORK = parseLotusTime(Lotus.getItemValue(co, "numleiststdbeginn")); eq.I_CONFIRMATION[disppos].ISMNE_TRAV = "H"; eq.I_CONFIRMATION[disppos].ISMNE_WAIT = "H"; eq.I_CONFIRMATION[disppos].ISMNE_WORK = "H"; eq.I_CONFIRMATION[disppos].ISMNW_TRAV = Lotus.getItemValueAsDecimal(co, "numtraveltime"); eq.I_CONFIRMATION[disppos].ISMNW_TRAV = Decimal.Parse(String.Format("{0:00.0}", eq.I_CONFIRMATION[disppos].ISMNW_TRAV)); //eq.I_CONFIRMATION[disppos].ISMNW_WAIT = Lotus.getItemValueAsDecimal(co, "numwaittimeacttextprint"); //eq.I_CONFIRMATION[disppos].ISMNW_WORK = Lotus.getItemValueAsDecimal(co, "numleiststd"); eq.I_CONFIRMATION[disppos].LUNID = co.UniversalID; eq.I_CONFIRMATION[disppos].LTXA1 = Lotus.getItemValue(co, "txtbemerk", 40); eq.I_CONFIRMATION[disppos].AUFNR = Lotus.getItemValue(co, "SAPtxtNo", 40).Replace("U", ""); } } } } } } SAPWS.ZFSS_SET_CONFIRMATIONResponse res = sapService.ZFSS_SET_CONFIRMATION(eq); }