Liste tipindeki kayıtlar üzerinde işlem yapmak için kullanılan nesnedir.
Ürünlerdeki kayıtların XML şablonlarına bakıldığında;
- Header (Başlık) bilgisinden sonra
- IData tipinde bölümler vardır(Transactions, Dispatch...gibi).
Bu alanlara Lines collection property ile ulaşırız.
AppendLine metoduyla bu bölüme satır açar ve alanlarını doldururuz.
C# Örneği
UnityObjects.Data orderslip = null;
UnityObjects.Lines transactionstransaction = null;
orderslip = Global.UnityApp.NewDataObject(UnityObjects.DataObjectType.doSalesOrderSlip);
orderslip.New();
orderslip.DataFields.FieldByName("NUMBER").Value = "~";
orderslip.DataFields.FieldByName("DATE").Value = DateTime.Today;
object MyTime = null;
UnityApp.PackTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, ref MyTime);
orderslip.DataFields.FieldByName("TIME").Value = (int)MyTime;
orderslip.DataFields.FieldByName("ARP_CODE").Value = "AAA";
orderslip.DataFields.FieldByName("ORDER_STATUS").Value = 1;
orderslip.DataFields.FieldByName("CURRSEL_TOTAL").Value = 1;
orderslip.DataFields.FieldByName("AFFECT_RISK").Value = 1;
transactionstransaction = orderslip.DataFields.FieldByName("TRANSACTIONS").Lines;
transactionstransaction.AppendLine();
transactionstransaction[transactionstransaction.Count - 1].FieldByName("TYPE").Value = 0;
transactionstransaction[transactionstransaction.Count - 1].FieldByName("MASTER_CODE").Value = "ITEM01";
transactionstransaction[transactionstransaction.Count - 1].FieldByName("QUANTITY").Value = 1;
transactionstransaction[transactionstransaction.Count - 1].FieldByName("PRICE").Value = 1;
transactionstransaction[transactionstransaction.Count - 1].FieldByName("VAT_RATE").Value = 18;
transactionstransaction[transactionstransaction.Count - 1].FieldByName("UNIT_CODE").Value = "ADET";
transactionstransaction[transactionstransaction.Count - 1].FieldByName("UNIT_CONV1").Value = 1;
transactionstransaction[transactionstransaction.Count - 1].FieldByName("UNIT_CONV2").Value = 1;
transactionstransaction[transactionstransaction.Count - 1].FieldByName("DUE_DATE").Value = DateTime.Today;
transactionstransaction[transactionstransaction.Count - 1].FieldByName("EDT_CURR").Value = 1;
if (orderslip.Post() == true)
{
MessageBox.Show("POST OK !");
}
else
{
if (orderslip.ErrorCode != 0)
{
MessageBox.Show("DBError(" + orderslip.ErrorCode.ToString() + ") - " + orderslip.ErrorDesc + orderslip.DBErrorDesc);
}
else if (orderslip.ValidateErrors.Count > 0)
{
string result = "XML Error List : " + "\n";
for (int i = 0; i < orderslip.ValidateErrors.Count; i++)
{
result += "(" + orderslip.ValidateErrors[i].ID.ToString() + ") - " + orderslip.ValidateErrors[i].Error + "\n";
}
MessageBox.Show(result);
}
}
Copyright © 2018 Logo Yazılım