NetSuite交易中有很多日期可供选择,特别是销售订单。我正在使用SuiteTalk将NetSuite中的送货信息同步到旧系统。哪个日期是确定何时针对销售订单进行活动以指示发货的正确日期?
答案 0 :(得分:0)
在审核并比较所有销售订单中的所有日期值后,我得出结论,没有明确的赢家显示其有活动的最后日期/时间。公式字段是最佳解决方案。这是一个保存的搜索,用于演示该公式。
请注意下面的公式,它会查找所有相关日期的最长日期。
此计算日期也可用于过滤器,以仅查找最近修改过的销售订单商品,特别是随追踪号码和数量一起发货的商品。
以下是可以剪切和粘贴的格式的公式。
GREATEST({trandate},{lastmodifieddate},{linelastmodifieddate},{billingtransaction.trandate},{billingtransaction.lastmodifieddate},{billingtransaction.linelastmodifieddate})
答案 1 :(得分:0)
答案 2 :(得分:0)
在联系NetSuite支持后,我了解到通过SuiteTalk API无法使用{linelastmodifieddate}。这给我留下了以下日期:
{trandate}
{lastmodifieddate}
{billingtransaction.trandate}
{billingtransaction.lastmodifieddate}
就我而言,我正在监控所有销售订单,以查看何时发货。所以我想知道我们何时在内部完成订单项目或者当我们下载物品时。我遇到的问题是这些日期到处都是。我想包括{linelastmodifieddate},因为有时它是最近的。
由于我们会在物品装运或卸货时开具发票,{billingtransaction.trandate}代表准确的发货日期。 {billingtransaction.quantity}代表并准确发送数量。 {billingtransaction.trackingnumbers}包含该货件的跟踪号列表。这就是我需要查看销售订单中每个订单项的“发货状态”的所有信息。
以下是我开始使用的一些示例代码,用于识别最近发货的销售订单。
service.searchPreferences = new SearchPreferences();
service.searchPreferences.bodyFieldsOnly = false;
service.searchPreferences.returnSearchColumns = true;
TransactionSearchAdvanced customSearch = new TransactionSearchAdvanced()
{
savedSearchScriptId = "customsearch_[your saved search here]"
,criteria = new TransactionSearch()
{
[your criteria here]
}
};
Console.WriteLine("Querying NetSuite");
SearchResult res = service.search(customSearch);
Console.WriteLine("\nThe search() operation completed successfully.");
Console.WriteLine(" Total Records = " + res.totalRecords);
Console.WriteLine(" Total Pages = " + res.totalPages);
Console.WriteLine(" Page Size = " + res.pageSize);
Console.WriteLine(" Current Page Index = " + res.pageIndex);
List<TransactionSearchRow> tsRows = new List<TransactionSearchRow>();
// Page through all the results
while (res.searchRowList.Length > 0)
{
foreach (TransactionSearchRow transactionRow in res.searchRowList)
{
tsRows.Add(transactionRow);
}
Console.WriteLine("\nQuerying NetSuite again...");
res = service.searchMore(++res.pageIndex);
}
// Sort the results
tsRows.Sort(delegate (TransactionSearchRow x, TransactionSearchRow y)
{
return x.basic.tranId[0].searchValue.CompareTo(y.basic.tranId[0].searchValue);
});
int i = 1;
// Parse the results
foreach (TransactionSearchRow tsRow in tsRows)
{
TransactionSearchRowBasic transactionRowBasic = tsRow.basic;
ItemSearchRowBasic itemRowBasic = tsRow.itemJoin;
TransactionSearchRowBasic billingRowBasic = tsRow.billingTransactionJoin;
string itemItemId = "";
string itemDesc = "";
double reqQty = 0;
string billTranId = "";
double billQty = 0;
string billTrackNo = "";
try { itemItemId = itemRowBasic.itemId[0].searchValue; } catch { }
try { itemDesc = itemRowBasic.salesDescription[0].searchValue; } catch { }
try { reqQty = transactionRowBasic.quantity[0].searchValue; } catch { }
try { billTranId = billingRowBasic.tranId[0].searchValue; } catch { }
try { billQty = billingRowBasic.quantity[0].searchValue; } catch { }
try { billTrackNo = billingRowBasic.trackingNumbers[0].searchValue; } catch { }
DateTime trandate = DateTime.MinValue;
DateTime lastmodifieddate = DateTime.MinValue;
DateTime billtrandate = DateTime.MinValue;
DateTime billlastmodifieddate = DateTime.MinValue;
try { trandate = transactionRowBasic.tranDate[0].searchValue; } catch { }
try { lastmodifieddate = transactionRowBasic.lastModifiedDate[0].searchValue; } catch { }
try { billtrandate = billingRowBasic.tranDate[0].searchValue; } catch { }
try { billlastmodifieddate = billingRowBasic.lastModifiedDate[0].searchValue; } catch { }
var list = new List<DateTime>();
list.Add(Convert.ToDateTime(trandate));
list.Add(Convert.ToDateTime(lastmodifieddate));
list.Add(Convert.ToDateTime(billtrandate));
list.Add(Convert.ToDateTime(billlastmodifieddate));
DateTime maxdate = list.Max(date => date);
Console.WriteLine(
$"\n {i++} of {tsRows.Count}" +
$"\n Document Number: {transactionRowBasic.tranId[0].searchValue}" +
$"\n SO Date: {trandate}" +
$"\n SO Modified: {lastmodifieddate}" +
$"\n Invoice Date: {billtrandate}" +
$"\n Invoice Modified: {billlastmodifieddate}" +
$"\n +++Max Date: {maxdate}" +
$"\n Item Name: {itemItemId}" +
$"\n Item Description: {itemDesc}" +
$"\n Bill Doc Number: {billTranId}" +
$"\n Requested Qty: {reqQty}" +
$"\n Bill Qty: {billQty}" +
$"\n Tracking Nos: {billTrackNo}"
);
}
service.logout();
Console.WriteLine("\n\nHit Enter to close this window.");
Console.ReadLine();