private static string yeniSiparisEkle(string ficheNo, string cariKodu, DataTable dtSevkView) { UnityKeeper.Unitylogin(); UnityObjects.IUnityApplication UnityAppTutucu = UnityKeeper.UnityApp; object saatsuan = 0; int dksuan = Convert.ToInt16(DateTime.Now.ToString("mm")); int saatisuan = Convert.ToInt16(DateTime.Now.ToString("HH")); int saniyesuan = Convert.ToInt16(DateTime.Now.ToString("ss")); UnityAppTutucu.PackTime(saatisuan, dksuan, saniyesuan, ref saatsuan); //Baslıklar UnityObjects.Data salesdis = UnityAppTutucu.NewDataObject(UnityObjects.DataObjectType.doSalesDispatch); salesdis.New(); salesdis.DataFields.FieldByName("TYPE").Value = 8; salesdis.DataFields.FieldByName("NUMBER").Value = ficheNo; salesdis.DataFields.FieldByName("DATE").Value = DateTime.Now.ToString("dd.MM.yyyy"); salesdis.DataFields.FieldByName("TIME").Value = saatisuan; salesdis.DataFields.FieldByName("ARP_CODE").Value = cariKodu; salesdis.DataFields.FieldByName("CREATED_BY").Value = 1; salesdis.DataFields.FieldByName("DATE_CREATED").Value = DateTime.Now.ToString("dd.MM.yyyy"); salesdis.DataFields.FieldByName("HOUR_CREATED").Value = saatisuan; salesdis.DataFields.FieldByName("MIN_CREATED").Value = dksuan; salesdis.DataFields.FieldByName("SEC_CREATED").Value = saniyesuan; foreach (DataRow dtSatir in dtSevkView.Rows) { //Satirlar string unitRef = Kontrol.degerAra("UNITSETREF", "ITEMS", "LOGICALREF", "=" + dtSatir["STOCKREF"], OpC.firma); string birimSeti = Kontrol.degerAra("CODE", "UNITSETL", "UNITSETREF", "='" + unitRef + "' AND MAINUNIT = 1", OpC.firma); UnityObjects.Lines transactions_lines = salesdis.DataFields.FieldByName("TRANSACTIONS").Lines; transactions_lines.AppendLine(); transactions_lines[transactions_lines.Count - 1].FieldByName("MASTER_CODE").Value = dtSatir["CODE"]; transactions_lines[transactions_lines.Count - 1].FieldByName("MASTER_DEF").Value = dtSatir["CODE"]; transactions_lines[transactions_lines.Count - 1].FieldByName("ORDER_REFERENCE").Value = dtSatir["LOGICALREF"]; transactions_lines[transactions_lines.Count - 1].FieldByName("QUANTITY").Value = dtSatir["guncelCikilan"]; transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CODE").Value = birimSeti; transactions_lines[transactions_lines.Count - 1].FieldByName("MONTH").Value = DateTime.Now.ToString("MM"); transactions_lines[transactions_lines.Count - 1].FieldByName("YEAR").Value = DateTime.Now.ToString("yyyy"); transactions_lines[transactions_lines.Count - 1].FieldByName("TYPE").Value = 0; }//FOREACH BİTİŞ return(UnityKeeper.UnitySendPost(salesdis)); }
private static string yeniUretimFisiOlusturVeSatırEkle(UnityObjects.IUnityApplication UnityApp, DateTime secilenTarih, string malzemeKoduITEM_CODE, int Adet, string FICHENO, string birimSeti, string isIstasyonu, string LineExp) { object saat = 0; int dk = Convert.ToInt16(secilenTarih.ToString("mm")); int saati = Convert.ToInt16(secilenTarih.ToString("HH")); int saniye = Convert.ToInt16(secilenTarih.ToString("ss")); UnityApp.PackTime(saati, dk, saniye, ref saat); object saatsuan = 0; int dksuan = Convert.ToInt16(DateTime.Now.ToString("mm")); int saatisuan = Convert.ToInt16(DateTime.Now.ToString("HH")); int saniyesuan = Convert.ToInt16(DateTime.Now.ToString("ss")); UnityApp.PackTime(saatisuan, dksuan, saniyesuan, ref saatsuan); UnityObjects.Data items = UnityApp.NewDataObject(UnityObjects.DataObjectType.doMaterialSlip); items.New(); items.DataFields.FieldByName("GROUP").Value = 3; items.DataFields.FieldByName("TYPE").Value = 13; items.DataFields.FieldByName("NUMBER").Value = FICHENO; items.DataFields.FieldByName("AUXIL_CODE").Value = "OPERP"; items.DataFields.FieldByName("DATE").Value = secilenTarih.ToString("dd.MM.yyyy"); items.DataFields.FieldByName("TIME").Value = saat; items.DataFields.FieldByName("SOURCE_WSCODE").Value = isIstasyonu; items.DataFields.FieldByName("CREATED_BY").Value = 1; items.DataFields.FieldByName("DATE_CREATED").Value = secilenTarih.ToString("dd.MM.yyyy"); items.DataFields.FieldByName("HOUR_CREATED").Value = DateTime.Now.ToString("HH");; items.DataFields.FieldByName("MIN_CREATED").Value = DateTime.Now.ToString("mm");; items.DataFields.FieldByName("SEC_CREATED").Value = DateTime.Now.ToString("ss");; //Stline Insert UnityObjects.Lines transactions_lines = items.DataFields.FieldByName("TRANSACTIONS").Lines; transactions_lines.AppendLine(); transactions_lines[transactions_lines.Count - 1].FieldByName("ITEM_CODE").Value = malzemeKoduITEM_CODE; transactions_lines[transactions_lines.Count - 1].FieldByName("LINE_TYPE").Value = 0; transactions_lines[transactions_lines.Count - 1].FieldByName("LINE_NUMBER").Value = "~"; transactions_lines[transactions_lines.Count - 1].FieldByName("QUANTITY").Value = Adet; transactions_lines[transactions_lines.Count - 1].FieldByName("DESCRIPTION").Value = LineExp; transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CODE").Value = birimSeti; items.DataFields.FieldByName("DOC_DATE").Value = DateTime.Now.ToString("dd.MM.yyyy");; items.DataFields.FieldByName("DOC_TIME").Value = saatsuan; return(UnityKeeper.UnitySendPost(items)); }
public string Try(string fNo) { UnityKeeper.Unitylogin(); UnityObjects.IUnityApplication UnityAppTutucu = UnityKeeper.UnityApp; UnityObjects.Data items = UnityAppTutucu.NewDataObject(UnityObjects.DataObjectType.doMaterialSlip); items.New(); items.DataFields.FieldByName("GROUP").Value = 3; items.DataFields.FieldByName("TYPE").Value = 13; items.DataFields.FieldByName("NUMBER").Value = fNo; items.DataFields.FieldByName("DATE").Value = "25.12.2019"; items.DataFields.FieldByName("TIME").Value = 271718400; items.DataFields.FieldByName("AUXIL_CODE").Value = "OPERP"; //items.DataFields.FieldByName("SOURCE_WSCODE").Value = 001; items.DataFields.FieldByName("CREATED_BY").Value = 1; items.DataFields.FieldByName("DATE_CREATED").Value = "24.12.2019"; items.DataFields.FieldByName("HOUR_CREATED").Value = 16; items.DataFields.FieldByName("MIN_CREATED").Value = 50; items.DataFields.FieldByName("SEC_CREATED").Value = 40; items.DataFields.FieldByName("MODIFIED_BY").Value = 1; items.DataFields.FieldByName("DATE_MODIFIED").Value = "25.12.2019"; items.DataFields.FieldByName("HOUR_MODIFIED").Value = 17; items.DataFields.FieldByName("MIN_MODIFIED").Value = 49; items.DataFields.FieldByName("SEC_MODIFIED").Value = 24; items.DataFields.FieldByName("DATA_REFERENCE").Value = 50; UnityObjects.Lines transactions_lines = items.DataFields.FieldByName("TRANSACTIONS").Lines; transactions_lines.AppendLine(); transactions_lines[transactions_lines.Count - 1].FieldByName("ITEM_CODE").Value = "PT0950603000PSYG460654"; transactions_lines[transactions_lines.Count - 1].FieldByName("LINE_TYPE").Value = 0; transactions_lines[transactions_lines.Count - 1].FieldByName("LINE_NUMBER").Value = 1; transactions_lines[transactions_lines.Count - 1].FieldByName("QUANTITY").Value = 3; transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CODE").Value = "ADET"; transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CONV1").Value = 1; transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CONV2").Value = 1; transactions_lines[transactions_lines.Count - 1].FieldByName("DATA_REFERENCE").Value = 76; transactions_lines[transactions_lines.Count - 1].FieldByName("EU_VAT_STATUS").Value = 4; transactions_lines[transactions_lines.Count - 1].FieldByName("EDT_CURR").Value = 1; items.DataFields.FieldByName("DOC_DATE").Value = "24.12.2019"; items.DataFields.FieldByName("DOC_TIME").Value = 271722496; string msg; if (items.Post() == true) { msg = ("POST OK !"); } else { if (items.ErrorCode != 0) { msg = ("DBError(" + items.ErrorCode.ToString() + ")-" + items.ErrorDesc + items.DBErrorDesc); } else //if (items.ValidateErrors.Count > 0) { string result = "XML ErrorList:"; for (int i = 0; i < items.ValidateErrors.Count; i++) { result += "(" + items.ValidateErrors[i].ID.ToString() + ") - " + items.ValidateErrors[i].Error; } msg = (result); } } return(msg); }
public static string AmbarTransferFisi(string FICHENO, List <string> SOURCE_MT_REFERENCE, List <string> SOURCE_SLT_REFERENCE, List <string> DATE, List <string> lottanCikilacakMiktar, string malzemeKodu, string souceWh, string desWh, string iadeMiktar, string labelIadeLotno) { object saat = 0; UnityKeeper.Unitylogin(); UnityObjects.IUnityApplication UnityAppTutucu = UnityKeeper.UnityApp; int dk = Convert.ToInt16(DateTime.Now.ToString("mm")); int saati = Convert.ToInt16(DateTime.Now.ToString("HH")); int saniye = Convert.ToInt16(DateTime.Now.ToString("ss")); UnityAppTutucu.PackTime(saati, dk, saniye, ref saat); string itemlogi = Kontrol.degerAra("LOGICALREF", "ITEMS", "CODE", "='" + malzemeKodu + "'", OpC.firma); string unitRef = Kontrol.degerAra("UNITSETREF", "ITEMS", "LOGICALREF", "=" + itemlogi, OpC.firma); string birimSeti = Kontrol.degerAra("CODE", "UNITSETL", "UNITSETREF", "='" + unitRef + "' AND MAINUNIT = 1", OpC.firma); UnityObjects.Data items = UnityAppTutucu.NewDataObject(UnityObjects.DataObjectType.doMaterialSlip); items.New(); items.DataFields.FieldByName("GROUP").Value = 3; items.DataFields.FieldByName("TYPE").Value = 25; items.DataFields.FieldByName("NUMBER").Value = FICHENO; items.DataFields.FieldByName("DATE").Value = DateTime.Now.ToString("dd.MM.yyyy"); items.DataFields.FieldByName("TIME").Value = saat; items.DataFields.FieldByName("SOURCE_WH").Value = souceWh; items.DataFields.FieldByName("DEST_WH").Value = desWh; items.DataFields.FieldByName("DEST_COST_GRP").Value = 1; items.DataFields.FieldByName("RC_RATE").Value = 5.5916; items.DataFields.FieldByName("CREATED_BY").Value = 2; items.DataFields.FieldByName("DATE_CREATED").Value = DateTime.Now.ToString("dd.MM.yyyy"); items.DataFields.FieldByName("HOUR_CREATED").Value = 17; items.DataFields.FieldByName("MIN_CREATED").Value = 11; items.DataFields.FieldByName("SEC_CREATED").Value = 56; items.DataFields.FieldByName("DATA_REFERENCE").Value = 15817; UnityObjects.Lines transactions_lines = items.DataFields.FieldByName("TRANSACTIONS").Lines; transactions_lines.AppendLine(); transactions_lines[transactions_lines.Count - 1].FieldByName("ITEM_CODE").Value = malzemeKodu; transactions_lines[transactions_lines.Count - 1].FieldByName("LINE_TYPE").Value = 0; transactions_lines[transactions_lines.Count - 1].FieldByName("DESTINDEX").Value = 1; transactions_lines[transactions_lines.Count - 1].FieldByName("DESTCOSTGRP").Value = 1; transactions_lines[transactions_lines.Count - 1].FieldByName("LINE_NUMBER").Value = 1; transactions_lines[transactions_lines.Count - 1].FieldByName("QUANTITY").Value = iadeMiktar; transactions_lines[transactions_lines.Count - 1].FieldByName("RC_XRATE").Value = 5.5916; transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CODE").Value = birimSeti; transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CONV1").Value = iadeMiktar; transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CONV2").Value = iadeMiktar; transactions_lines[transactions_lines.Count - 1].FieldByName("DATA_REFERENCE").Value = 31445; int index = 0; string date = DateTime.Now.AddDays(-1).ToString("dd.MM.yyyy"); UnityObjects.Lines sl_details0 = transactions_lines[transactions_lines.Count - 1].FieldByName("SL_DETAILS").Lines; foreach (var miktar in lottanCikilacakMiktar) { sl_details0.AppendLine(); sl_details0[sl_details0.Count - 1].FieldByName("SOURCE_MT_REFERENCE").Value = SOURCE_MT_REFERENCE[index]; sl_details0[sl_details0.Count - 1].FieldByName("SOURCE_SLT_REFERENCE").Value = SOURCE_SLT_REFERENCE[index]; sl_details0[sl_details0.Count - 1].FieldByName("SOURCE_QUANTITY").Value = miktar; sl_details0[sl_details0.Count - 1].FieldByName("IOCODE").Value = 3; sl_details0[sl_details0.Count - 1].FieldByName("SOURCE_WH").Value = souceWh; sl_details0[sl_details0.Count - 1].FieldByName("SL_TYPE").Value = 1; sl_details0[sl_details0.Count - 1].FieldByName("SL_CODE").Value = labelIadeLotno; sl_details0[sl_details0.Count - 1].FieldByName("MU_QUANTITY").Value = miktar; sl_details0[sl_details0.Count - 1].FieldByName("UNIT_CODE").Value = birimSeti; sl_details0[sl_details0.Count - 1].FieldByName("QUANTITY").Value = miktar; sl_details0[sl_details0.Count - 1].FieldByName("UNIT_CONV1").Value = miktar; sl_details0[sl_details0.Count - 1].FieldByName("UNIT_CONV2").Value = miktar; sl_details0[sl_details0.Count - 1].FieldByName("DATE_EXPIRED").Value = DATE[index];// DateTime.Now.AddDays(-1).ToString("dd.MM.yyyy");//"18.07.2019"; //date;//DATE[index].ToString("dd.MM.yyyy"); index++; } return(UnityKeeper.UnitySendPost(items)); }
public static string satinalmaContent(string irsaliyetarih, string FICHENO, object saat, DateTime textIrsaliye, string[] listMiktar, string[] lotName, string[] lotCode, string[] stokCode, string Carikodu) { UnityKeeper.Unitylogin(); UnityObjects.IUnityApplication UnityAppTutucu = UnityKeeper.UnityApp; int dk = Convert.ToInt16(DateTime.Now.ToString("mm")); int saati = Convert.ToInt16(DateTime.Now.ToString("HH")); int saniye = Convert.ToInt16(DateTime.Now.ToString("ss")); UnityAppTutucu.PackTime(saati, dk, saniye, ref saat); UnityObjects.Data purdis = UnityAppTutucu.NewDataObject(UnityObjects.DataObjectType.doPurchDispatch); purdis.New(); purdis.DataFields.FieldByName("TYPE").Value = 1; purdis.DataFields.FieldByName("NUMBER").Value = FICHENO; //FİŞ NUMRASI purdis.DataFields.FieldByName("DOC_NUMBER").Value = "MKBL-" + FICHENO; purdis.DataFields.FieldByName("DATE").Value = textIrsaliye.ToString("dd.MM.yyyy");; purdis.DataFields.FieldByName("TIME").Value = saat; purdis.DataFields.FieldByName("AUXIL_CODE").Value = "Operp"; //ÖZELKOD BEŞ purdis.DataFields.FieldByName("ARP_CODE").Value = Carikodu; //CARİ HESAP KODU purdis.DataFields.FieldByName("CREATED_BY").Value = 1; purdis.DataFields.FieldByName("DATE_CREATED").Value = DateTime.Now.ToString("dd.MM.yyy"); purdis.DataFields.FieldByName("HOUR_CREATED").Value = DateTime.Now.ToString("HH"); purdis.DataFields.FieldByName("MIN_CREATED").Value = DateTime.Now.ToString("mm"); purdis.DataFields.FieldByName("SEC_CREATED").Value = DateTime.Now.ToString("ss"); purdis.DataFields.FieldByName("CURRSEL_TOTALS").Value = 1; int tut = 0; foreach (string item in stokCode) { string itemlogi = Kontrol.degerAra("LOGICALREF", "ITEMS", "CODE", "='" + item + "'", "LG_019_"); string unitRef = Kontrol.degerAra("UNITSETREF", "ITEMS", "LOGICALREF", "=" + itemlogi, "LG_019_"); string birimSeti = Kontrol.degerAra("CODE", "UNITSETL", "UNITSETREF", "='" + unitRef + "' AND MAINUNIT = 1", "LG_019_"); UnityObjects.Lines transactions_lines = purdis.DataFields.FieldByName("TRANSACTIONS").Lines; transactions_lines.AppendLine(); transactions_lines[transactions_lines.Count - 1].FieldByName("TYPE").Value = 0; transactions_lines[transactions_lines.Count - 1].FieldByName("MASTER_CODE").Value = item; //İtems Code transactions_lines[transactions_lines.Count - 1].FieldByName("QUANTITY").Value = listMiktar[tut]; //miktar transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CODE").Value = birimSeti; //Unıt set l transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CONV1").Value = listMiktar[tut]; //UINFO1 transactions_lines[transactions_lines.Count - 1].FieldByName("UNIT_CONV2").Value = listMiktar[tut]; //UINFO2 transactions_lines[transactions_lines.Count - 1].FieldByName("VAT_RATE").Value = 18; //transactions_lines[transactions_lines.Count - 1].FieldByName("DATA_REFERENCE").Value = 6; UnityObjects.Lines sl_details0 = transactions_lines[transactions_lines.Count - 1].FieldByName("SL_DETAILS").Lines; sl_details0.AppendLine(); sl_details0[sl_details0.Count - 1].FieldByName("SOURCE_MT_REFERENCE").Value = 0; sl_details0[sl_details0.Count - 1].FieldByName("SOURCE_SLT_REFERENCE").Value = 0; sl_details0[sl_details0.Count - 1].FieldByName("SOURCE_QUANTITY").Value = 0; sl_details0[sl_details0.Count - 1].FieldByName("IOCODE").Value = 1; sl_details0[sl_details0.Count - 1].FieldByName("SL_TYPE").Value = 1; sl_details0[sl_details0.Count - 1].FieldByName("SL_CODE").Value = lotCode[tut]; //SERİLOT N REFERANSI sl_details0[sl_details0.Count - 1].FieldByName("SL_NAME").Value = lotName[tut]; //SERİLOTN ADI sl_details0[sl_details0.Count - 1].FieldByName("MU_QUANTITY").Value = listMiktar[tut]; //LOT MİKTAR sl_details0[sl_details0.Count - 1].FieldByName("UNIT_CODE").Value = birimSeti; //UNİTsET L sl_details0[sl_details0.Count - 1].FieldByName("QUANTITY").Value = listMiktar[tut]; //AMOUNT sl_details0[sl_details0.Count - 1].FieldByName("REM_QUANTITY").Value = listMiktar[tut]; //AMOUNT sl_details0[sl_details0.Count - 1].FieldByName("LU_REM_QUANTITY").Value = listMiktar[tut]; sl_details0[sl_details0.Count - 1].FieldByName("UNIT_CONV1").Value = listMiktar[tut]; sl_details0[sl_details0.Count - 1].FieldByName("UNIT_CONV2").Value = listMiktar[tut]; sl_details0[sl_details0.Count - 1].FieldByName("DATE_EXPIRED").Value = DateTime.Now.ToString("dd.MM.yyy"); //sl_details0[sl_details0.Count - 1].FieldByName("DATA_REFERENCE").Value = 3; sl_details0[sl_details0.Count - 1].FieldByName("ORGLINKREF").Value = 0; //sl_details0[sl_details0.Count - 1].FieldByName("GUID").Value = "9246B348 - 93B9 - 4BA1 - AC77 - 5C2CE46CDE21"; transactions_lines[transactions_lines.Count - 1].FieldByName("DIST_ORD_REFERENCE").Value = 0; transactions_lines[transactions_lines.Count - 1].FieldByName("MULTI_ADD_TAX").Value = 0; transactions_lines[transactions_lines.Count - 1].FieldByName("EDT_CURR").Value = 1; transactions_lines[transactions_lines.Count - 1].FieldByName("MONTH").Value = textIrsaliye.ToString("MM"); transactions_lines[transactions_lines.Count - 1].FieldByName("YEAR").Value = textIrsaliye.ToString("yyyy"); //transactions_lines[transactions_lines.Count - 1].FieldByName("GUID").Value = "A300883A - C082 - 4DDB - AA30 - 692C535F08FC"; //transactions_lines[transactions_lines.Count - 1].FieldByName("MASTER_DEF").Value = "OnurPlastik Hammmadde"; //transactions_lines[transactions_lines.Count - 1].FieldByName("MASTER_DEF2").Value = "OnurPlastik Hammmadde Deneme"; transactions_lines[transactions_lines.Count - 1].FieldByName("FOREIGN_TRADE_TYPE").Value = 0; transactions_lines[transactions_lines.Count - 1].FieldByName("DISTRIBUTION_TYPE_WHS").Value = 0; transactions_lines[transactions_lines.Count - 1].FieldByName("DISTRIBUTION_TYPE_FNO").Value = 0; tut++; } purdis.DataFields.FieldByName("DEDUCTIONPART1").Value = 2; purdis.DataFields.FieldByName("DEDUCTIONPART2").Value = 3; purdis.DataFields.FieldByName("AFFECT_RISK").Value = 0; purdis.DataFields.FieldByName("DISP_STATUS").Value = 1; //purdis.DataFields.FieldByName("GUID").Value = "8A1F193E - 5117 - 4B15 - A9DD - 0850234DA140"; purdis.DataFields.FieldByName("DOC_DATE").Value = DateTime.Now.ToString("dd.MM.yyy"); purdis.DataFields.FieldByName("DOC_TIME").Value = 170927457; purdis.DataFields.FieldByName("EDESPATCH_STATUS").Value = 12; return(UnityKeeper.UnitySendPost(purdis)); }