0

使用 Pick、Pack and Ship 和高级 PDF HTML 模板时,NetSuite 无法显示剩余的拣货数量。因此,如果我们进行部分拣货,我们无法向仓库显示剩余余额。数学很简单,这是我想看到的脚本和函数(基于论坛反馈)。这会起作用吗?部署此脚本的最佳方法是什么,以便将结果存储在自定义列中,直到进行另一个选择?该值将在更改时计算,但可用于所有相关的交易记录。

function SetQtytoPick(type){
  if(type == 'item'){
    var qtyordered = nlapiGetCurrentLineItemValue('item', 'quantity');
    var qtypicked = nlapiGetCurrentLineItemValue('item', 'quantitypicked');
    var qtytopick = qtyordered-qtypicked
    nlapiSetCurrentLineItemValue('item', 'custcol_qty_to_pick', qtytopick);
  }
}
4

1 回答 1

2

Actually one of the really fun things about the Advanced HTML/PDF templates is that you don't need your code. When print the packing slip the template supplies the item fulfillment (as record) and the sales order (as salesorder).

You can get the value you need from the Sales Order's Item Line's quantityfulfilled value.

the following snippet was from a customized packing slip where the customer wanted the PS to always show all the Sales Order's items. It doesn't directly solve your problem but you can see that the template itself can be used to calculate the items remaining to ship at the time of printing.

<#list salesorder.item as tranline>
    <#assign shipped=0>
    <#assign prevShipped=tranline.quantityfulfilled>
    <#assign qtyRemaining=tranline.quantity - prevShipped>
    <#if (tranline.quantitybackordered gt 0)> <#assign qtyRemaining=tranline.quantitybackordered></#if>
    <#list record.item as item><#if tranline.line==item.orderline>
        <#assign shipped=item.quantity>
        <#assign prevShipped=tranline.quantityfulfilled-item.quantity>
    </#if></#list>
    <tr>
    <td colspan="12"><span class="itemname">${tranline.item}</span><#if tranline.itemtype =='NonInvtPart'>**<#assign anyNonInvt='T'></#if><br />${tranline.description?html}</td>
    <td align="center" colspan="3"><#if shipped gt 0><b>${shipped}</b><#else>0</#if></td>
    <td align="center" colspan="3">${tranline.quantity}</td>
    <td align="center" colspan="3">${prevShipped}</td>
    <td align="center" colspan="3">${qtyRemaining}</td>
    <td colspan="4">${tranline.options?html}</td>

    </tr>
    </#list>
</#if>

The other way to do this would be to put your script into a user event script before submit event. You'd deploy it on Item Fulfillments

于 2016-03-05T01:34:53.240 回答