无法使用SuiteTalk发送ItemFulfillment

时间:2016-11-09 23:53:02

标签: c# netsuite suitetalk

我需要做些什么才能将ItemFulfillment标记为已发货,包括套餐信息以及可能使用SuiteTalk的其他送货方式/运营商?我们使用WMS Lite RF移动屏幕初始创建ItemFulfillment,然后使用自定义应用程序发送它。

我最初尝试使用ItemFulfillmentPackageList来指定包,但它似乎忽略了我指定的内容并添加了默认包(0.05磅,没有描述或跟踪)。

然后我尝试了ItemFulfillmentPackageUspsList等,如果它与先前在订单和履行记录中指定的承运人匹配,则会出现正确的包裹信息。如果它不匹配,我会收到错误" [Code = JS_EXCEPTION]错误:将运输方法切换到另一个运营商是不受支持的操作,因为它需要重新加载该运营商的物料履行表格。&# 34;我们需要切换运营商的能力,因为我们为某些订单提供免费送货服务,最终将从主要3家运营商提供的价格中选择最便宜的套餐价格。

//curShipment is an EasyPost shipment after purchasing postage.
//it contains relevant information about the package
ItemFulfillment fulfillmentUpdate = new ItemFulfillment();
fulfillmentUpdate.internalId = curFulfillment.internalId;
fulfillmentUpdate.shipStatus = ItemFulfillmentShipStatus._shipped;
fulfillmentUpdate.shipStatusSpecified = true;
fulfillmentUpdate.shipMethod = new RecordRef()
{
    // Get the internalId from a saved dictionary
    internalId = shipMethods.GetNetsuite(curShipment.selected_rate).netsuiteId
};

switch (curShipment.selected_rate.carrier)
{
    case "USPS":
        ItemFulfillmentPackageUsps pkgUsps = new ItemFulfillmentPackageUsps();
        pkgUsps.packageWeightUsps = curShipment.parcel.weight / 16; // Easypost uses Oz, Netsuite uses Lb
        pkgUsps.packageWeightUspsSpecified = true;
        if (string.IsNullOrWhiteSpace(curShipment.parcel.predefined_package))
        {
            pkgUsps.packageLengthUsps = (long)curShipment.parcel.length;
            pkgUsps.packageLengthUspsSpecified = true;
            pkgUsps.packageWidthUsps = (long)curShipment.parcel.width;
            pkgUsps.packageWidthUspsSpecified = true;
            pkgUsps.packageHeightUsps = (long)curShipment.parcel.height;
        }
        pkgUsps.packageTrackingNumberUsps = curShipment.tracking_code;

        ItemFulfillmentPackageUspsList pkgListUsps = new ItemFulfillmentPackageUspsList();
        pkgListUsps.packageUsps = new ItemFulfillmentPackageUsps[] { pkgUsps };
        fulfillmentUpdate.packageUspsList = pkgListUsps;
        break;
    // Cases for the other carriers, almost identical to USPS above
}
SetNetsuitePrefs(); // Sets preferences and authenticates, similar to the ERP example code
WriteResponse response = await System.Threading.Tasks.Task<SearchResult>.Run(() => { return nsService.update(fulfillmentUpdate); });
// Results in error:
// [Code=JS_EXCEPTION] Error: Switching the shipping method to another carrier is an unsupported operation, because it requires reloading the item fulfillment form for that carrier.

1 个答案:

答案 0 :(得分:0)

尝试将shipMethod设置为您将使用的装运项目的RecordRef。如果使用FedEx Shipping Item输入SO,现在您想使用UPS,则相应地设置shipMethod并使用特定于运营商的包列表结构。