我正在查看过去 12 个月的装运数据,并想要装运的总成品单位及其原材料对应部件。
我已将装运详细信息表与物料清单标题(具有相应的成品项目)连接起来,然后将 BOM HEader 连接到 BOM 详细信息以获取每个成品单位的所有原材料组件和数量。
ShipYear ShipMonth CLASS SHIPMENT_ID INTERNAL_SHIPMENT_LINE_NUM FG_ITEM FG_QTY RM_ITEM RM_QTY_PER_FG_UNIT TOTAL_RM_QTY
2013 6 SHADE CHIPS 9701316 25851201 PM9000015050 2 PM1000010932 2 4
2013 6 SHADE CHIPS 9701316 25851201 PM9000015050 2 PM1000010933 3 6
2013 6 SHADE CHIPS 9701316 25851201 PM9000015050 2 PM1000010934 1 2
2013 6 SHADE CHIPS 9701316 25851201 PM9000015050 2 PM1000010935 4 8
2013 6 SHADE CHIPS 9701316 25851201 PM9000015050 2 PM1000010936 1 2
2013 6 SHADE CHIPS 9701316 25851201 PM9000015050 2 PM1000010937 1 2
2013 6 SHADE CHIPS 9701316 25851201 PM9000015050 2 PM1000010938 1 2
2013 6 SHADE CHIPS 9701316 25851201 PM9000015050 2 PM1000010939 1 2
2013 6 SHADE CHIPS 9701316 25851202 PM9000015074 5 PM1000010932 4 20
2013 6 SHADE CHIPS 9701316 25851202 PM9000015074 5 PM1000010933 1 5
2013 6 SHADE CHIPS 9701316 25851202 PM9000015074 5 PM1000010934 3 15
2013 6 SHADE CHIPS 9701316 25851202 PM9000015074 5 PM1000010935 8 40
2013 6 SHADE CHIPS 9701638 25853677 PM9000015394 1 PM1000010932 1 1
2013 6 SHADE CHIPS 9701638 25853677 PM9000015394 1 PM1000010933 1 1
2013 6 SHADE CHIPS 9701638 25853677 PM9000015394 1 PM1000010934 1 1
2013 6 SHADE CHIPS 9701638 25853677 PM9000015394 1 PM1000010935 4 4
2013 6 SHADE CHIPS 9701638 25853677 PM9000015394 1 PM1000010936 1 1
2013 6 SHADE CHIPS 9701638 25853677 PM9000015394 1 PM1000010937 2 2
2013 6 SHADE CHIPS 9701638 25853677 PM9000015394 1 PM1000010938 3 3
2013 6 SHADE CHIPS 9701638 25853677 PM9000015394 1 PM1000010939 1 1
2013 6 SHADE CHIPS 9701639 25853678 PM9000015404 1 PM1000010932 7 7
2013 6 SHADE CHIPS 9701639 25853678 PM9000015404 1 PM1000010933 1 1
2013 6 SHADE CHIPS 9701639 25853678 PM9000015404 1 PM1000010934 1 1
2013 6 SHADE CHIPS 9701639 25853678 PM9000015404 1 PM1000010935 1 1
2013 6 SHADE CHIPS 9701639 25853678 PM9000015404 1 PM1000010936 1 1
2013 6 SHADE CHIPS 9701639 25853678 PM9000015404 1 PM1000010937 1 1
2013 6 SHADE CHIPS 9701639 25853678 PM9000015404 1 PM1000010938 1 1
2013 6 SHADE CHIPS 9701639 25853678 PM9000015404 1 PM1000010939 1 1
TOTALS 9 58 136
这是一张格式更好的图片:
最后,我想看到以下内容:
Year Month Class FG Units RM Units
2012 6 SHADE CHIPS 3449 50351
2012 7 SHADE CHIPS 288 3714
2012 8 SHADE CHIPS 282 4498
2012 9 SHADE CHIPS 105 1528
2012 12 SHADE CHIPS 539 4002
2013 1 SHADE CHIPS 1972 15284
2013 2 SHADE CHIPS 121 781
2013 3 SHADE CHIPS 60 808
2013 4 SHADE CHIPS 74 1335
2013 5 SHADE CHIPS 5 40
2013 6 FILLER SHADE 1 18
2013 6 SHADE CHIPS 4788 36790
2013 7 FILLER SHADE 1 18
2013 7 SHADE CHIPS 207 1600
我尝试按年月、类、shipID、内部船线、项目进行初始分组,并取 FG_Qty 的最大值和 RM_Qty 的总和。然后把这个结果再次分组,这次只按年月、班级分组,然后对 FG_Qty 和 RM_Qty 求和。
注意:仅一次执行直接分组是行不通的,因为 FG_QTY 的总和被夸大了,因为在原始数据中,由于连接到 BOM 详细信息表,FG_QTY 被复制到多行中。所以我只需要对每个内部装运线 Nbr 计算一次 FG_Qty。