Acumatica 将图像上载到序列号
我在InItemLotserial表中创建了一个自定义NOTEID字段,用于上传自定义页面中每个序列号的图像。它工作正常,没有任何问题 我已经写了一个处理页面来更新现有序列号的图像Acumatica 将图像上载到序列号,acumatica,Acumatica,我在InItemLotserial表中创建了一个自定义NOTEID字段,用于上传自定义页面中每个序列号的图像。它工作正常,没有任何问题 我已经写了一个处理页面来更新现有序列号的图像 protected void AttachImage(InfoINItemLotSerialImport row, INItemLotSerial ser, InventoryItem itm) { string imageurl = row.ImageSourceUrl;
protected void AttachImage(InfoINItemLotSerialImport row, INItemLotSerial ser, InventoryItem itm)
{
string imageurl = row.ImageSourceUrl;
string imageType = row.ImageType;
string sRetVal = string.Empty;
if (itm != null)
{
if (ser != null)
{
try
{
WebClient wc = new WebClient();
byte[] buffer = wc.DownloadData(imageurl);
//MemoryStream ms = new MemoryStream(bytes);
string fileName = Path.GetFileName(imageurl);
fileName = string.Format("Serial Number attribute ({0} {1})\\{2}", itm.InventoryID, ser.LotSerialNbr, fileName);
PX.SM.FileInfo fileinfo = null;
PX.SM.UploadFileMaintenance filegraph = PXGraph.CreateInstance<PX.SM.UploadFileMaintenance>();
fileinfo = new PX.SM.FileInfo(fileName, null, buffer);
fileinfo.IsPublic = true;
if (filegraph.SaveFile(fileinfo))
{
ItemLotSerialMnt oLotSerMnt = PXGraph.CreateInstance<ItemLotSerialMnt>();
oLotSerMnt.lotserailrecdata.Current = ser;
oLotSerMnt.lotserial.Current = ser;
PXNoteAttribute.SetFileNotes(oLotSerMnt.lotserailrecdata.Cache, oLotSerMnt.lotserailrecdata.Current, fileinfo.UID.Value);
PXNoteAttribute.SetNote(oLotSerMnt.lotserailrecdata.Cache, oLotSerMnt.lotserailrecdata.Current, "");
sRetVal = fileinfo.Name;
}
}
catch
{
}
}
}
}
Accumatica支持帮助我解决了这个问题。我错过了要保存的事件
if (filegraph.SaveFile(fileinfo))
{
ItemLotSerialMnt oLotSerMnt = PXGraph.CreateInstance<ItemLotSerialMnt>();
oLotSerMnt.lotserailrecdata.Current = ser;
oLotSerMnt.lotserial.Current = ser;
PXNoteAttribute.SetFileNotes(oLotSerMnt.lotserailrecdata.Cache, oLotSerMnt.lotserailrecdata.Current, fileinfo.UID.Value);
PXNoteAttribute.SetNote(oLotSerMnt.lotserailrecdata.Cache, oLotSerMnt.lotserailrecdata.Current, "");
sRetVal = fileinfo.Name;
oLotSerMnt.Persist();
}
if(filegraph.SaveFile(fileinfo))
{
ItemLotSerialMnt-oLotSerMnt=PXGraph.CreateInstance();
oLotSerMnt.LOTSRAILRECDATA.Current=ser;
oLotSerMnt.lotserial.Current=ser;
PXNoteAttribute.SetFileNotes(oLotSerMnt.lotserailrecdata.Cache、oLotSerMnt.lotserailrecdata.Current、fileinfo.UID.Value);
PXNoteAttribute.SetNote(oLotSerMnt.lotserailrecdata.Cache,oLotSerMnt.lotserailrecdata.Current,“”);
sRetVal=fileinfo.Name;
oplotsermnt.Persist();
}
oLotSerMnt.Persist()您有INItemLotSerial DAC扩展吗?它是否包含PXNoteAttribute?请在您的问题中张贴DAC扩展。
if (filegraph.SaveFile(fileinfo))
{
ItemLotSerialMnt oLotSerMnt = PXGraph.CreateInstance<ItemLotSerialMnt>();
oLotSerMnt.lotserailrecdata.Current = ser;
oLotSerMnt.lotserial.Current = ser;
PXNoteAttribute.SetFileNotes(oLotSerMnt.lotserailrecdata.Cache, oLotSerMnt.lotserailrecdata.Current, fileinfo.UID.Value);
PXNoteAttribute.SetNote(oLotSerMnt.lotserailrecdata.Cache, oLotSerMnt.lotserailrecdata.Current, "");
sRetVal = fileinfo.Name;
oLotSerMnt.Persist();
}