Acumatica 使用图形在收据中添加和释放
我已经创建了一个新的屏幕/页面,该屏幕/页面具有创建和发布接收序列跟踪项目的操作。我的操作似乎创建了文档和详细信息,包括序列规范ok 我现在遇到的问题是,当我尝试使用release.press释放收据时,它会抱怨状态不正确,无法释放。我添加了代码以将保持设置为false,但仍然失败。不确定我是否需要做任何其他事情-我希望它的行为与取消选中保持复选框时相同 我想确定这是在系统中创建文档并发布文档的推荐方法。我也不确定是否有办法检查暂停或部分发布的结果 以下是我的图表上的操作代码:Acumatica 使用图形在收据中添加和释放,acumatica,Acumatica,我已经创建了一个新的屏幕/页面,该屏幕/页面具有创建和发布接收序列跟踪项目的操作。我的操作似乎创建了文档和详细信息,包括序列规范ok 我现在遇到的问题是,当我尝试使用release.press释放收据时,它会抱怨状态不正确,无法释放。我添加了代码以将保持设置为false,但仍然失败。不确定我是否需要做任何其他事情-我希望它的行为与取消选中保持复选框时相同 我想确定这是在系统中创建文档并发布文档的推荐方法。我也不确定是否有办法检查暂停或部分发布的结果 以下是我的图表上的操作代码:
public PXAction<usrEdition> AddItems;
[PXUIField(DisplayName = "Add Items")]
[PXButton(CommitChanges = true)]
protected void addItems()
{
String mySer = "";
INReceiptEntry myRcptEntry = INReceiptEntry.CreateInstance<INReceiptEntry>();
INRegister myINReg = new INRegister();
myINReg.TranDesc = "Edition Creation";
myINReg.DocType = "R";
myINReg.ControlQty = this.Edition.Current.Limit;
myINReg.ControlCost = 0;
myINReg.ControlAmount = 0;
myRcptEntry.receipt.Insert(myINReg);
//Add 1 detail line
INTran myINTran = new INTran();
myINTran.SiteID = 5;
myINTran.InventoryID = this.Edition.Current.InventoryID;
myINTran.UOM = "PIECE";
myINTran.Qty = this.Edition.Current.Limit;
myINTran.TranAmt = 0;
myINTran.TranDesc = "Edition Creation";
myINTran.RefNbr = myRcptEntry.receipt.Current.RefNbr;
myINTran.DocType = "R";
myINTran.InvtMult = 1;
myINTran.UnitCost = 0;
myRcptEntry.transactions.Insert(myINTran);
for (int i = 1; i <= this.Edition.Current.Limit; i++)
{
mySer = this.Edition.Current.EditionType.ToString() + i.ToString().PadLeft(4, '0');
INTranSplit mySplit = new INTranSplit();
mySplit.InventoryID = this.Edition.Current.InventoryID;
mySplit.LotSerialNbr = mySer;
mySplit.Qty = 1;
mySplit.RefNbr = myRcptEntry.receipt.Current.RefNbr;
mySplit.DocType = "R";
mySplit.SiteID = 5;
mySplit.InvtMult = 1;
mySplit.UOM = "PIECE";
myRcptEntry.splits.Insert(mySplit);
}
myINReg.Hold = false;
myRcptEntry.Save.Press();
myRcptEntry.release.Press();
}
#endregion
公共PXAction附加项;
[PXUIField(DisplayName=“添加项”)]
[PXButton(CommitChanges=true)]
受保护的无效附加项()
{
字符串mySer=“”;
INReceiptEntry myrcpEntry=INReceiptEntry.CreateInstance();
INRegister myINReg=新的INRegister();
myINReg.TranDesc=“编辑创建”;
myINReg.DocType=“R”;
myINReg.ControlQty=此.Edition.Current.Limit;
myINReg.ControlCost=0;
myINReg.ControlAmount=0;
MyRcpEntry.收据.插入(myINReg);
//添加1个详图线
intranmyintrant=新的intrant();
myintrn.SiteID=5;
MyIntrn.InventoryID=this.Edition.Current.InventoryID;
myintan.UOM=“件”;
MyIntrant.Qty=此.Edition.Current.Limit;
MyIntrant.TranAmt=0;
myINTran.TranDesc=“编辑创建”;
myintrant.RefNbr=myRcptEntry.receipt.Current.RefNbr;
myINTran.DocType=“R”;
myINTran.InvtMult=1;
myINTran.UnitCost=0;
myRcptEntry.transactions.Insert(myintrant);
对于(int i=1;i您将Hold设置为false,但不更新图形中的记录。这解释了为什么在尝试释放时系统会抱怨状态。此外,您应该检索Insert()的结果调用并使用返回的更新版本来更新它。最后,我认为您不需要设置DocType-它将为您默认
更新的代码示例:
public PXAction<SOOrder> AddItems;
[PXUIField(DisplayName = "Add Items")]
[PXButton(CommitChanges = true)]
protected void addItems()
{
INReceiptEntry myRcptEntry = INReceiptEntry.CreateInstance<INReceiptEntry>();
INRegister myINReg = new INRegister();
myINReg.TranDesc = "Sample Inventory Receipt";
myINReg = myRcptEntry.receipt.Insert(myINReg);
//TODO: Add your detail lines here
myINReg.Hold = false;
myINReg = myRcptEntry.receipt.Update(myINReg);
myRcptEntry.Save.Press();
myRcptEntry.release.Press();
}
公共PXAction附加项;
[PXUIField(DisplayName=“添加项”)]
[PXButton(CommitChanges=true)]
受保护的无效附加项()
{
INReceiptEntry myrcpEntry=INReceiptEntry.CreateInstance();
INRegister myINReg=新的INRegister();
myINReg.TranDesc=“样本库存收据”;
myINReg=MyrCPEntry.receipt.Insert(myINReg);
//TODO:在此处添加详图线
myINReg.Hold=假;
myINReg=myRcptEntry.receipt.Update(myINReg);
myRcptEntry.Save.Press();
myRcptEntry.release.Press();
}
谢谢,这很好!我错误地认为保存会强制更新。