Когда я пытаюсь добавить новую строку вложения в существующее вложение (используя объект Attachs2) с помощью метода обновления, DI пытается проверить старые строки, и возможно, что файл не существует в исходном исходном пути. Итак, метод обновления сообщает об ошибке. Я использую код ниже:
Код: Выделить всё
Attachments2 oAtt = oCompany.GetBusinessObject(BoObjectTypes.oAttachments2);
if (oAtt.GetByKey(doc.AttachmentEntry))
{
oAtt.Lines.Add();
oAtt.Lines.FileName = oAttNew.Lines.FileName;
oAtt.Lines.FileExtension = oAttNew.Lines.FileExtension;
oAtt.Lines.SourcePath = oAttNew.Lines.SourcePath;
oAtt.Lines.Override = BoYesNoEnum.tYES;
if (oAtt.Update() != 0)
throw new Exception(oCompany.GetLastErrorDescription());
}
Код: Выделить всё
Documents doc = oCompany.GetBusinessObject(oType);
doc.GetByKey(int.Parse(docEntry));
doc.AttachmentEntry = oAtt.AbsoluteEntry;
StockTransfer oStock = .oCompany.GetBusinessObject(BoObjectTypes.oStockTransfer);
// oStock.AttachmentEntry = oAtt.AbsoluteEntry FAIL
Код: Выделить всё
LandedCostsService service = oCompany.GetCompanyService().GetBusinessService(ServiceTypes.LandedCostsService);
LandedCostParams oParam = service.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCostParams);
LandedCost oLandedCost = service.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost);
oParam.LandedCostNumber = int.Parse(docEntry);
oLandedCost = service.GetLandedCost(oParam);
if (oAtt.GetByKey(oLandedCost.AttachmentEntry)) {
// Code similar to first code block I posted
}
else
{
if (oAttNew.Add() != 0)
throw new Exception(oCompany.GetLastErrorDescription());
oAtt.GetByKey(int.Parse(oCompany.GetNewObjectKey()));
oLandedCost.AttachmentEntry = oAtt.AbsoluteEntry;
try
{
service.UpdateLandedCost(oLandedCost);
}
catch (Exception ex)
{
throw new Exception(ex.Message + oCompany.GetLastErrorDescription());
}
}
С уважением,
Педро
Подробнее здесь: https://stackoverflow.com/questions/211 ... ness-one-9
Мобильная версия