但是linq无法达到预期的结果,可以循环实现结果而不是linq吗? (对不起,我是C#的初学者)
来源1&中的项目2完全相同
Source1:分组表
ItemCode|TotalQty|Shipment|Remarks|Line
=========================================
ITEM01 | 1000 | S001 | R001 | 1 <==10 items here
ITEM01 | 400 | S002 | R002 | 2 <==4 items here
ITEM02 | 2000 | S003 | R003 | 3 <==2 items here
Source2:详情表(14项&amp;行)
RefNo|ItemCode|Quantity|Weight|From
=======================================
R001 | ITEM01 | 100 | 50 | US
R002 | ITEM01 | 100 | 50 | US
R003 | ITEM01 | 100 | 50 | US
. | . | . | . | .
. | . | . | . | .
R013 | ITEM01 | 100 | 50 | US
R014 | ITEM01 | 100 | 50 | US
R015 | ITEM02 | 1000 | 100 | US
R015 | ITEM02 | 1000 | 100 | US
我想将source1和source2结合起来,得到如下结果
Shipment|Line|Remarks|ItemCode|TotalQty|RefNo|Quantity|Weight|From
===================================================================
S001 | 1 | R001 | ITEM01 | 1000 | R001| 100 | 50 | US \\1
S001 | 1 | R001 | ITEM01 | 1000 | R002| 100 | 50 | US \\2
S001 | 1 | R001 | ITEM01 | 1000 | R003| 100 | 50 | US \\3
S001 | 1 | R001 | ITEM01 | 1000 | R004| 100 | 50 | US \\4
S001 | 1 | R001 | ITEM01 | 1000 | R005| 100 | 50 | US \\5
S001 | 1 | R001 | ITEM01 | 1000 | R006| 100 | 50 | US \\6
S001 | 1 | R001 | ITEM01 | 1000 | R007| 100 | 50 | US \\7
S001 | 1 | R001 | ITEM01 | 1000 | R008| 100 | 50 | US \\8
S001 | 1 | R001 | ITEM01 | 1000 | R009| 100 | 50 | US \\9
S001 | 1 | R001 | ITEM01 | 1000 | R010| 100 | 50 | US \\10
S002 | 2 | R002 | ITEM01 | 400 | R011| 100 | 50 | US \\11
S002 | 2 | R002 | ITEM01 | 400 | R012| 100 | 50 | US \\12
S002 | 2 | R002 | ITEM01 | 400 | R013| 100 | 50 | US \\13
S002 | 2 | R002 | ITEM01 | 400 | R014| 100 | 50 | US \\14
S003 | 3 | R003 | ITEM02 | 2000 | R015| 1000 | 100 | US \\15
S003 | 3 | R003 | ITEM02 | 2000 | R016| 1000 | 100 | US \\16
对此有何想法?谢谢你的帮助。