通过REST API调用创建销售订单时适用折扣不会像通过标准Acumatica屏幕创建相同的SO时那样自动应用折扣。折扣应适用且不是“手动” - 通过API创建后运行“重新计算价格”操作将应用折扣。
是否必须在API调用中指定折扣代码,或者是否有某种方法可以像在屏幕上一样自动应用折扣代码?通过API收到的订单被赋予一个唯一的订单类型,因此我们可以合理地为SOOrderEntry图表定制这些特定的订单类型,当最初创建SO以运行“重新计算价格”时,我找不到办法成功触发基本动作。
答案 0 :(得分:2)
目前,通过Web API或导入方案创建或更新的所有销售订单和AR发票均完全跳过折扣。要通过Web API启动折扣计算,您应按以下步骤操作:
在SOOrderEntry BLC扩展程序中创建隐藏操作,以重新计算当前订单的折扣:
<div class="container">
<ul class="thumbnail">
<li>
<div>
<img class="fluid" src="http://via.placeholder.com/400x400" width="" height="" alt="">
</div>
<div class="thumb-caption">
<p>
name goes here
</p>
<p>
subname goes here
</p>
<p>
year
</p>
<img src="http://via.placeholder.com/20x15" width="20" height="15" alt="">
</div>
</li>
<li>
<div>
<img class="fluid" src="http://via.placeholder.com/400x400" width="" height="" alt="">
</div>
<div class="thumb-caption">
<p>
name goes here
</p>
<p>
subname is very very long, and when it is very long, for some reason, it does not center correctly, why?
</p>
<p>
year
</p>
<img src="http://via.placeholder.com/20x15" width="20" height="15" alt="">
</div>
</li>
<li>
<div>
<img class="fluid" src="http://via.placeholder.com/400x400" width="" height="" alt="">
</div>
<div class="thumb-caption">
<p>
name goes here
</p>
<p>
subname goes here
</p>
<p>
year
</p>
<img src="http://via.placeholder.com/20x15" width="20" height="15" alt="">
</div>
</li>
<li>
<div>
<img class="fluid" src="http://via.placeholder.com/400x400" width="" height="" alt="">
</div>
<div class="thumb-caption">
<p>
name goes here
</p>
<p>
subname goes here
</p>
<p>
year
</p>
<img src="http://via.placeholder.com/20x15" width="20" height="15" alt="">
</div>
</li>
<li>
<div>
<img class="fluid" src="http://via.placeholder.com/400x400" width="" height="" alt="">
</div>
<div class="thumb-caption">
<p>
name goes here
</p>
<p>
subname goes here
</p>
<p>
year
</p>
<img src="http://via.placeholder.com/20x15" width="20" height="15" alt="">
</div>
</li>
</ul>
</div>
在扩展端点中添加上述自定义操作的映射,并在创建销售订单并保存在Acumatica中后,通过Contract API在单独的请求中调用操作。
答案 1 :(得分:0)
根据RuslanDev的回答和一些更改,这是在后续API调用中实现并执行的操作:
public PXAction<SOOrder> RecalculateDiscountsFromImport;
[PXButton]
[PXUIField(DisplayName = "Recalculate Discounts",
MapEnableRights = PXCacheRights.Select,
MapViewRights = PXCacheRights.Select,
Visible = false)]
public void recalculateDiscountsFromImport()
{
foreach (SOLine line in Base.Transactions.Select())
{
DiscountEngine<SOLine>.RecalculateDiscountsLine<SOOrderDiscountDetail>(
Base.Transactions.Cache,
Base.Transactions,
line,
line,
Base.DiscountDetails,
Base.Document.Current.BranchID,
Base.Document.Current.CustomerLocationID,
Base.Document.Current.OrderDate.Value);
Base.Transactions.Update(line);
Base.Transactions.SetValueExt<SOLine.manualDisc>(line, false);
}
Base.Actions.PressSave();
}