Logoobject kullaran c# yazılım diliyle logo tiger'a sipariş kaydı ekleme.
UnityApplication giris = new UnityApplication();
if (giris.Connect())
{
if (giris.UserLogin("LOGO", "LOGO"))
{
if (giris.CompanyLogin(XX)) //Logo şirket numarası
{
//Logoya bağlanıldı
#region Sipariş Kaydı
if (true)
{
string belgeno = item;
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Select * from vwAktarilacakSiparisler Where SiparisNumarasi = @BelgeNumarasi";
cmd.Parameters.AddWithValue("@BelgeNumarasi", "XXXXXXXXXXXXXX");
DataTable dt = (DataTable)ID.Sorgula(cmd, ID.SorgulaTuru.Tablo, new SqlConnection(BAĞLANTI CÜMLESİ));
Data slip = giris.NewDataObject(DataObjectType.doSalesOrderSlip);
slip.New();
//slip.DataFields.FieldByName("GROUP").Value = 3;
//slip.DataFields.FieldByName("TYPE").Value = 25;
slip.DataFields.FieldByName("ARP_CODE").Value = Convert.ToString(dt.Rows[0]["CustomerCode"]);
slip.DataFields.FieldByName("NUMBER").Value = belgeno;
slip.DataFields.FieldByName("DATE").Value = Convert.ToDateTime(dt.Rows[0]["OrderTime"]);
object MyTime = null;
UnityApplication UnityApp = new UnityApplication();
UnityApp.PackTime(
Convert.ToDateTime(dt.Rows[0]["OrderTime"]).Hour,
Convert.ToDateTime(dt.Rows[0]["OrderTime"]).Minute,
Convert.ToDateTime(dt.Rows[0]["OrderTime"]).Second,
ref MyTime);
slip.DataFields.FieldByName("TIME").Value = (int)MyTime;
slip.DataFields.FieldByName("SOURCE_WH").Value = 66;
slip.DataFields.FieldByName("SOURCE_COST_GRP").Value = 66;
slip.DataFields.FieldByName("DIVISION").Value = 62;
slip.DataFields.FieldByName("ORDER_STATUS").Value = 1;
slip.DataFields.FieldByName("WITH_PAYMENT").Value = 0;
slip.DataFields.FieldByName("PAYMENT_CODE").Value = Convert.ToString(dt.Rows[0]["PaymentTypeCode"]);
slip.DataFields.FieldByName("TRADING_GRP").Value = "ORİON";
slip.DataFields.FieldByName("AUXIL_CODE").Value = "B";
slip.DataFields.FieldByName("AUTH_CODE").Value = "ORİON";
string satispersoneli = Convert.ToString(dt.Rows[0]["SalespersonCode"]);
SqlCommand cmd2 = new SqlCommand();
cmd2.CommandType = CommandType.Text;
cmd2.CommandText = "select * from GK_LOGODB.dbo.LG_SLSMAN where CODE = @satispersoneli";
cmd2.Parameters.AddWithValue("@satispersoneli", satispersoneli);
DataTable dtSatisPersoneli = (DataTable)ID.Sorgula(cmd2, ID.SorgulaTuru.Tablo, new SqlConnection(Class_Baglantilar.IDYAZILIM_144));
if(dtSatisPersoneli.Rows.Count > 0)
slip.DataFields.FieldByName("SALESMAN_CODE").Value = satispersoneli; // "60.09 ORİON";
slip.DataFields.FieldByName("NOTES1").Value = Convert.ToString(dt.Rows[0]["InternalDescription"]);
UnityObjects.Lines transactionstransaction = slip.DataFields.FieldByName("TRANSACTIONS").Lines;
foreach (DataRow satir in dt.Rows)
{
{
transactionstransaction.AppendLine();
transactionstransaction[(transactionstransaction.Count - 1)].FieldByName("TYPE").Value = 0;
transactionstransaction[(transactionstransaction.Count - 1)].FieldByName("MASTER_CODE").Value = Convert.ToString(satir["ItemCode"]);
transactionstransaction[(transactionstransaction.Count - 1)].FieldByName("QUANTITY").Value = Convert.ToInt32(satir["Qty"]);
transactionstransaction[(transactionstransaction.Count - 1)].FieldByName("UNIT_CODE").Value = Convert.ToString(satir["UnitCode"]);
transactionstransaction[(transactionstransaction.Count - 1)].FieldByName("VAT_RATE").Value = Convert.ToString(satir["VatRate"]);
double price;
transactionstransaction.GetStockLinePrice(8, out price); // 8 : tanımlı satış fiyatı IDsi
transactionstransaction[transactionstransaction.Count - 1].FieldByName("PRICE").Value = price;
}
}
slip.ApplyCampaign();
{
SqlCommand cmdEFatura = new SqlCommand();
cmdEFatura.CommandType = CommandType.StoredProcedure;
cmdEFatura.CommandText = "IDP_EFaturaKontrolu";
cmdEFatura.Parameters.AddWithValue("@CariKodu", Convert.ToString(dt.Rows[0]["CustomerCode"]));
DataTable dtEFaturaKontrol = (DataTable)ID.Sorgula(cmdEFatura, ID.SorgulaTuru.Tablo, new SqlConnection(Class_Baglantilar.IDYAZILIM_144));
if (dtEFaturaKontrol.Rows.Count > 0)
slip.DataFields.FieldByName("EINVOICE").Value = 1;
else
slip.DataFields.FieldByName("EINVOICE").Value = 2;
}
slip.DataFields.FieldByName("EINVOICE").Value = 1;
if (slip.Post() == true)
{
MessageBox.Show("Sipariş aktarıldı.", "Uyarı");
}
else
{
if (slip.ErrorCode != 0)
{
MessageBox.Show("DBError(" + slip.ErrorCode.ToString() + ")-" + slip.ErrorDesc + slip.DBErrorDesc);
break;
}
else if (slip.ValidateErrors.Count > 0)
{
string result = "XML ErrorList:";
for (int i = 0; i < slip.ValidateErrors.Count; i++)
{
result += "(" + slip.ValidateErrors[i].ID.ToString() + ") - " + slip.ValidateErrors[i].Error;
}
MessageBox.Show(result);
break;
}
}
}
giris.CompanyLogout();
}//Logo şirket girişi
string hata = giris.GetLastErrorString();
giris.UserLogout();
}//Logo kullanıcı girişi
giris.Disconnect();
}//Logo giriş connect
Σχόλια