预计发货日期 - 光标?

发布于 2024-10-10 20:03:46 字数 786 浏览 1 评论 0原文

我被要求加入一些“智能”逻辑来估计已延期交货的物品的发货日期。他们希望我使用的逻辑是这样的:

天空中的馅饼/真正的花式展示 如果我们的延期交货数量多于任何单个采购订单,请计算哪些销售订单将提交给哪些入库采购订单并显示适当的日期。 示例:

Open Sales Orders
SO#  123455 – Req Date 12/15/10 – PN A000123  Backorder 2 pcs.
SO#  123462 – Req Date 12/16/10 – PN A000123  Backorder 7 pcs.
SO#  123941 – Req Date 12/17/10 – PN A000123  Backorder 4 pcs.

Open Purchase Orders
PO#  987654 – Promised 12/29/10 – 5 pcs.
PO#  994258 – Promised 1/15/11 – 15 pcs.

Dates we should be displaying
SO#  123455 – ESD = 12/29/10
SO#  123462 – ESD = 1/15/11
SO#  123941 – ESD = 1/15/11

我知道我可以创建一个临时表来保存未结采购订单信息,然后使用游标按请求日期的顺序抓取每个未结销售订单,然后获取满足所需数量的最早采购订单,然后从那个 PO。为了让事情变得更有趣,我们将运送部分货物,因此,如果第一个订单是 7 个,我们将运送 5 个,并将剩余的 2 个置于缺货状态。因此,类似于“5 个于 12/29/10 发货,剩余 2 个于 1/15/11 发货”。有什么建议吗?

I’ve been asked to put some “smart” logic into estimating our shipping dates for items that have been placed on backorder. The logic that they’d like me to use is this:

Pie in the Sky / Real Fancy Display
If we have more on backorder than on any single Purchase Order, calculate which Sales Orders will commit to which inbound Purchase Orders and display the appropriate date.
Example:

Open Sales Orders
SO#  123455 – Req Date 12/15/10 – PN A000123  Backorder 2 pcs.
SO#  123462 – Req Date 12/16/10 – PN A000123  Backorder 7 pcs.
SO#  123941 – Req Date 12/17/10 – PN A000123  Backorder 4 pcs.

Open Purchase Orders
PO#  987654 – Promised 12/29/10 – 5 pcs.
PO#  994258 – Promised 1/15/11 – 15 pcs.

Dates we should be displaying
SO#  123455 – ESD = 12/29/10
SO#  123462 – ESD = 1/15/11
SO#  123941 – ESD = 1/15/11

I know that I could create a temp table to hold the open PO information and then use a cursor to grab each open Sales Order in order by Requested Date and then get the earliest PO that satisfies the quantity needed and then decrement that quantity from that PO. To make things more interesting, we will ship partials, so if the first order was for 7, we’d ship 5 and place the remaining 2 on backorder. So, it would be something like “5 shipped on 12/29/10, remaining 2 to be shipped on 1/15/11”. Any recommendations?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海的爱人是光 2024-10-17 20:03:46

我怀疑这可以用一条 SQL 语句来完成,但它会非常复杂,你会疯狂地尝试编写它。 (在我发布这篇文章后几分钟内,有人可能会证明我是错的。)循环程序代码似乎是这里的惯例。

就在我的脑海中,我可能会做这样的事情:

  • 生成销售和购买活动列表,首先按天排序,然后按(购买然后活动)
  • 迭代此列表,保持跟踪计数器(可用单位)以及已满足和未满足义务的列表(销售)
  • 处理每一行时,跟踪可用项目池,根据需要递增(购买)或递减(销售)
  • 当每个销售项目出现时,取决于然后可用的零件数量,创建显示履行情况的新条目(新表?),无论是完整的还是部分的,和/或跟踪尚未完全处理的销售。

这都是估计/预测,所以您需要保留此例程生成的数据,对吧?

I suspect this could be done with a single SQL statement, but it'd be so fantastically complex you'd be nuts to try and write it. (Someone will probably prove me wrong within minutes of my posting this.) Looping procedural code would seem to be the order of the day here.

Just off the top of my head, I'd probably do seomthing like:

  • Produce a list of Sales and Purcahse activity, ordered first by day and then by (Purchase then Activity)
  • Iterate through this list, keeping track of counters (units available) and lists of met and unmet obligations (Sales)
  • As each row is processed, track the pool of avaialble items, incrementing (Purchases) or decrementing (sales) as necessary
  • As each Sales items comes up, depending on the then-availablile volume of parts, create new entries (new table?) showing fulfillment, whether complete or partial, and/or keep track of Sales that have not yet been fully procssed.

It's all estimate/projection, so you wouldn'd need to persist the data generated by this routine, right?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文