GclBillsGatherModel.pas 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095
  1. unit GclBillsGatherModel;
  2. // 单项目的工程量清单汇总
  3. interface
  4. uses
  5. Classes, mDataRecord, BillsTree;
  6. type
  7. TGatherDataWriteEvent = procedure (AGcls, AXmjs: TList) of object;
  8. TLeafXmjNode = class
  9. private
  10. FID: Integer;
  11. FXmjCode: string;
  12. FXmjName: string;
  13. FXmjUnits: string;
  14. FPeg: string;
  15. FNameDanWei: string;
  16. FNameFenBu: string;
  17. FNameFenXiang: string;
  18. FNameUnit: string;
  19. FPosition: string;
  20. FDrawingCode: string;
  21. public
  22. constructor Create(ALeafXmj, APeg: TBillsIDTreeNode);
  23. property ID: Integer read FID;
  24. property XmjCode: string read FXmjCode;
  25. property XmjName: string read FXmjName;
  26. property XmjUnits: string read FXmjUnits;
  27. property Peg: string read FPeg;
  28. property NameDanWei: string read FNameDanWei;
  29. property NameFenBu: string read FNameFenBu;
  30. property NameFenXiang: string read FNameFenXiang;
  31. property NameUnit: string read FNameUnit;
  32. property Position: string read FPosition;
  33. property DrawingCode: string read FDrawingCode;
  34. end;
  35. TDetailGclNode = class
  36. private
  37. FID: Integer;
  38. FBillsID: Integer;
  39. FTreeSerialNo: Integer;
  40. FOrgQuantity: Double;
  41. FOrgTotalPrice: Double;
  42. FMisQuantity: Double;
  43. FMisTotalPrice: Double;
  44. FOthQuantity: Double;
  45. FOthTotalPrice: Double;
  46. FQuantity: Double;
  47. FTotalPrice: Double;
  48. FCurDealQuantity: Double;
  49. FCurDealTotalPrice: Double;
  50. FCurQcQuantity: Double;
  51. FCurQcTotalPrice: Double;
  52. FCurGatherQuantity: Double;
  53. FCurGatherTotalPrice: Double;
  54. FPreDealQuantity: Double;
  55. FPreDealTotalPrice: Double;
  56. FPreQcQuantity: Double;
  57. FPreQcTotalPrice: Double;
  58. FPreGatherQuantity: Double;
  59. FPreGatherTotalPrice: Double;
  60. FEndDealQuantity: Double;
  61. FEndDealTotalPrice: Double;
  62. FEndQcQuantity: Double;
  63. FEndQcTotalPrice: Double;
  64. FEndGatherQuantity: Double;
  65. FEndGatherTotalPrice: Double;
  66. FAddDealQuantity: Double;
  67. FAddDealTotalPrice: Double;
  68. FAddQcQuantity: Double;
  69. FAddQcTotalPrice: Double;
  70. FAddGatherQuantity: Double;
  71. FAddGatherTotalPrice: Double;
  72. FPM_PreTotalPrice: Double;
  73. FPM_TotalPrice: Double;
  74. FLeafXmj: TLeafXmjNode;
  75. function GetPercent: Double;
  76. public
  77. constructor Create(AID: Integer);
  78. property ID: Integer read FID;
  79. property BillsID: Integer read FBillsID write FBillsID;
  80. property TreeSerialNo: Integer read FTreeSerialNo write FTreeSerialNo;
  81. property OrgQuantity: Double read FOrgQuantity write FOrgQuantity;
  82. property OrgTotalPrice: Double read FOrgTotalPrice write FOrgTotalPrice;
  83. property MisQuantity: Double read FMisQuantity write FMisQuantity;
  84. property MisTotalPrice: Double read FMisTotalPrice write FMisTotalPrice;
  85. property OthQuantity: Double read FOthQuantity write FOthQuantity;
  86. property OthTotalPrice: Double read FOthTotalPrice write FOthTotalPrice;
  87. property Quantity: Double read FQuantity write FQuantity;
  88. property TotalPrice: Double read FTotalPrice write FTotalPrice;
  89. property CurDealQuantity: Double read FCurDealQuantity write FCurDealQuantity;
  90. property CurDealTotalPrice: Double read FCurDealTotalPrice write FCurDealTotalPrice;
  91. property CurQcQuantity: Double read FCurQcQuantity write FCurQcQuantity;
  92. property CurQcTotalPrice: Double read FCurQcTotalPrice write FCurQcTotalPrice;
  93. property CurGatherQuantity: Double read FCurGatherQuantity write FCurGatherQuantity;
  94. property CurGatherTotalPrice: Double read FCurGatherTotalPrice write FCurGatherTotalPrice;
  95. property PreDealQuantity: Double read FPreDealQuantity write FPreDealQuantity;
  96. property PreDealTotalPrice: Double read FPreGatherTotalPrice write FPreGatherTotalPrice;
  97. property PreQcQuantity: Double read FPreQcQuantity write FPreQcQuantity;
  98. property PreQcTotalPrice: Double read FPreQcTotalPrice write FPreQcTotalPrice;
  99. property PreGatherQuantity: Double read FPreGatherQuantity write FPreGatherQuantity;
  100. property PreGatherTotalPrice: Double read FPreGatherTotalPrice write FPreGatherTotalPrice;
  101. property EndDealQuantity: Double read FEndDealQuantity write FEndDealQuantity;
  102. property EndDealTotalPrice: Double read FEndDealTotalPrice write FEndDealTotalPrice;
  103. property EndQcQuantity: Double read FEndQcQuantity write FEndQcQuantity;
  104. property EndQcTotalPrice: Double read FEndQcTotalPrice write FEndQcTotalPrice;
  105. property EndGatherQuantity: Double read FEndGatherQuantity write FEndGatherQuantity;
  106. property EndGatherTotalPrice: Double read FEndGatherTotalPrice write FEndGatherTotalPrice;
  107. property Percent: Double read GetPercent;
  108. property AddDealQuantity: Double read FAddDealQuantity write FAddDealQuantity;
  109. property AddDealTotalPrice: Double read FAddDealTotalPrice write FAddDealTotalPrice;
  110. property AddQcQuantity: Double read FAddQcQuantity write FAddQcQuantity;
  111. property AddQcTotalPrice: Double read FAddQcTotalPrice write FAddQcQuantity;
  112. property AddGatherQuantity: Double read FAddGatherQuantity write FAddGatherQuantity;
  113. property AddGatherTotalPrice: Double read FAddGatherTotalPrice write FAddGatherTotalPrice;
  114. property PM_PreTotalPrice: Double read FPM_PreTotalPrice write FPM_PreTotalPrice;
  115. property PM_TotalPrice: Double read FPM_TotalPrice write FPM_TotalPrice;
  116. property LeafXmj: TLeafXmjNode read FLeafXmj write FLeafXmj;
  117. end;
  118. TDetailDealNode = class
  119. private
  120. FID: Integer;
  121. FDealID: Integer;
  122. FQuantity: Double;
  123. FTotalPrice: Double;
  124. public
  125. constructor Create(AID: Integer);
  126. property ID: Integer read FID;
  127. property DealID: Integer read FDealID write FDealID;
  128. property Quantity: Double read FQuantity write FQuantity;
  129. property TotalPrice: Double read FTotalPrice write FTotalPrice;
  130. end;
  131. TDetailBGLNode = class
  132. private
  133. FID: Integer;
  134. FBGBillsID: Integer;
  135. FBGLID: Integer;
  136. FBGLCode: string;
  137. FBGLName: string;
  138. FBGLApprovalCode: string;
  139. FBGLDrawingCode: string;
  140. FQuantity: Double;
  141. FTotalPrice: Double;
  142. public
  143. constructor Create(AID: Integer);
  144. property ID: Integer read FID;
  145. property BGBillsID: Integer read FBGBillsID write FBGBillsID;
  146. property BGLID: Integer read FBGLID write FBGLID;
  147. property BGLCode: string read FBGLCode write FBGLCode;
  148. property BGLName: string read FBGLName write FBGLName;
  149. property BGLApprovalCode: string read FBGLApprovalCode write FBGLApprovalCode;
  150. property BGLDrawingCode: string read FBGLDrawingCode write FBGLDrawingCode;
  151. property Quantity: Double read FQuantity write FQuantity;
  152. property TotalPrice: Double read FTotalPrice write FTotalPrice;
  153. end;
  154. TGclNode = class
  155. private
  156. FDetailGcls: TList;
  157. FDetailDeals: TList;
  158. FDetailBGLs: TList;
  159. FLeafXmjs: TList;
  160. FID: Integer;
  161. FB_Code: string;
  162. FIndexCode: string;
  163. FName: string;
  164. FUnits: string;
  165. FPrice: Double;
  166. FOrgQuantity: Double;
  167. FOrgTotalPrice: Double;
  168. FMisQuantity: Double;
  169. FMisTotalPrice: Double;
  170. FOthQuantity: Double;
  171. FOthTotalPrice: Double;
  172. FQuantity: Double;
  173. FTotalPrice: Double;
  174. FCurDealQuantity: Double;
  175. FCurDealTotalPrice: Double;
  176. FCurQcQuantity: Double;
  177. FCurQcTotalPrice: Double;
  178. FCurGatherQuantity: Double;
  179. FCurGatherTotalPrice: Double;
  180. FPreDealQuantity: Double;
  181. FPreDealTotalPrice: Double;
  182. FPreQcQuantity: Double;
  183. FPreQcTotalPrice: Double;
  184. FPreGatherQuantity: Double;
  185. FPreGatherTotalPrice: Double;
  186. FEndDealQuantity: Double;
  187. FEndDealTotalPrice: Double;
  188. FEndQcQuantity: Double;
  189. FEndQcTotalPrice: Double;
  190. FEndGatherQuantity: Double;
  191. FEndGatherTotalPrice: Double;
  192. FAddDealQuantity: Double;
  193. FAddDealTotalPrice: Double;
  194. FAddQcQuantity: Double;
  195. FAddQcTotalPrice: Double;
  196. FAddGatherQuantity: Double;
  197. FAddGatherTotalPrice: Double;
  198. FDealQuantity: Double;
  199. FDealTotalPrice: Double;
  200. FBGLQuantity: Double;
  201. FBGLTotalPrice: Double;
  202. FDeal_BGLQuantity: Double;
  203. FDeal_BGLTotalPrice: Double;
  204. FDeal_BGLPercent: Double;
  205. procedure InitCalculate;
  206. procedure GatherDetailGcl;
  207. procedure GatherDetailDeal;
  208. procedure GatherDetailBGL;
  209. procedure CalculateOther;
  210. procedure SetB_Code(const Value: string);
  211. function GetDetailBGL(AIndex: Integer): TDetailBGLNode;
  212. function GetDetailBGLCount: Integer;
  213. function GetDetailDeal(AIndex: Integer): TDetailDealNode;
  214. function GetDetailDealCount: Integer;
  215. function GetDetailGcl(AIndex: Integer): TDetailGclNode;
  216. function GetDetailGclCount: Integer;
  217. function GetLeafXmjCount: Integer;
  218. function GetLeafXmj(AIndex: Integer): TLeafXmjNode;
  219. public
  220. constructor Create(AID: Integer);
  221. destructor Destroy; override;
  222. procedure AddLeafXmj(ALeafXmj: TLeafXmjNode);
  223. function AddDetailGcl(AID: Integer): TDetailGclNode;
  224. function AddDetailDeal(AID: Integer): TDetailDealNode;
  225. function AddDetailBGL(AID: Integer): TDetailBGLNode;
  226. procedure Calculate;
  227. property ID: Integer read FID;
  228. property B_Code: string read FB_Code write SetB_Code;
  229. property IndexCode: string read FIndexCode;
  230. property Name: string read FName write FName;
  231. property Units: string read FUnits write FUnits;
  232. property Price: Double read FPrice write FPrice;
  233. property OrgQuantity: Double read FOrgQuantity;
  234. property OrgTotalPrice: Double read FOrgTotalPrice;
  235. property MisQuantity: Double read FMisQuantity;
  236. property MisTotalPrice: Double read FMisTotalPrice;
  237. property OthQuantity: Double read FOthQuantity;
  238. property OthTotalPrice: Double read FOthTotalPrice;
  239. property Quantity: Double read FQuantity;
  240. property TotalPrice: Double read FTotalPrice;
  241. property CurDealQuantity: Double read FCurDealQuantity;
  242. property CurDealTotalPrice: Double read FCurDealTotalPrice;
  243. property CurQcQuantity: Double read FCurQcQuantity;
  244. property CurQcTotalPrice: Double read FCurQcTotalPrice;
  245. property CurGatherQuantity: Double read FCurGatherQuantity;
  246. property CurGatherTotalPrice: Double read FCurGatherTotalPrice;
  247. property PreDealQuantity: Double read FPreDealQuantity;
  248. property PreDealTotalPrice: Double read FPreGatherTotalPrice;
  249. property PreQcQuantity: Double read FPreQcQuantity;
  250. property PreQcTotalPrice: Double read FPreQcTotalPrice;
  251. property PreGatherQuantity: Double read FPreGatherQuantity;
  252. property PreGatherTotalPrice: Double read FPreGatherTotalPrice;
  253. property EndDealQuantity: Double read FEndDealQuantity;
  254. property EndDealTotalPrice: Double read FEndDealTotalPrice;
  255. property EndQcQuantity: Double read FEndQcQuantity;
  256. property EndQcTotalPrice: Double read FEndQcTotalPrice;
  257. property EndGatherQuantity: Double read FEndGatherQuantity;
  258. property EndGatherTotalPrice: Double read FEndGatherTotalPrice;
  259. property AddDealQuantity: Double read FAddDealQuantity;
  260. property AddDealTotalPrice: Double read FAddGatherTotalPrice;
  261. property AddQcQuantity: Double read FAddQcQuantity;
  262. property AddQcTotalPrice: Double read FAddQcTotalPrice;
  263. property AddGatherQuantity: Double read FAddGatherQuantity;
  264. property AddGatherTotalPrice: Double read FAddGatherTotalPrice;
  265. property DealQuantity: Double read FDealQuantity;
  266. property DealTotalPrice: Double read FDealTotalPrice;
  267. property BGLQuantity: Double read FBGLQuantity;
  268. property BGLTotalPrice: Double read FBGLTotalPrice;
  269. // ---------- Calculate --------------
  270. property Deal_BGLQuantity: Double read FDeal_BGLQuantity;
  271. property Deal_BGLTotalPrice: Double read FDeal_BGLTotalPrice;
  272. property Deal_BGLPercent: Double read FDeal_BGLPercent;
  273. // -----------------------------------
  274. property DetailGclCount: Integer read GetDetailGclCount;
  275. property DetailGcl[AIndex: Integer]: TDetailGclNode read GetDetailGcl;
  276. property LeafXmjCount: Integer read GetLeafXmjCount;
  277. property LeafXmj[AIndex: Integer]: TLeafXmjNode read GetLeafXmj;
  278. property DetailDealCount: Integer read GetDetailDealCount;
  279. property DetailDeal[AIndex: Integer]: TDetailDealNode read GetDetailDeal;
  280. property DetailBGLCount: Integer read GetDetailBGLCount;
  281. property DetailBGL[AIndex: Integer]: TDetailBGLNode read GetDetailBGL;
  282. end;
  283. TGclGatherModel = class
  284. private
  285. FProjectData: TObject;
  286. FBillsTree: TBillsIDTree;
  287. FMergeDetailGcl: Boolean;
  288. FGatherDeal: Boolean;
  289. FGatherBGL: Boolean;
  290. FGcls: TList;
  291. FXmjs: TList;
  292. FNewGclID: Integer;
  293. FNewDetailGclID: Integer;
  294. FNewDetailDealID: Integer;
  295. FNewDetailBGLID: Integer;
  296. FWriteGatherData: TGatherDataWriteEvent;
  297. procedure BeginGather;
  298. procedure EndGather;
  299. function FindLeafXmj(ALeafXmj: TBillsIDTreeNode): TLeafXmjNode;
  300. function NewLeafXmj(ALeafXmj: TBillsIDTreeNode): TLeafXmjNode;
  301. function GetLeafXmj(ANode: TBillsIDTreeNode): TLeafXmjNode;
  302. function FindGclNode(const AB_Code, AName, AUnits: string; APrice: Double): TGclNode;
  303. function NewGclNode(const AB_Code, AName, AUnits: string; APrice: Double): TGclNode;
  304. function GetGclNode(const AB_Code, AName, AUnits: string; APrice: Double): TGclNode; overload;
  305. function GetGclNode(ARec: TBillsRecord): TGclNode; overload;
  306. procedure AddBillsNode(ANode: TMeasureBillsIDTreeNode);
  307. procedure GatherBillsData;
  308. procedure GatherDealData;
  309. procedure GatherBGLData;
  310. procedure CalculateAll;
  311. function GetNewDetailBGLID: Integer;
  312. function GetNewDetailDealID: Integer;
  313. function GetNewDetailGclID: Integer;
  314. public
  315. constructor Create(AProjectData: TObject);
  316. destructor Destroy; override;
  317. procedure Execute;
  318. property GatherDeal: Boolean read FGatherDeal write FGatherDeal;
  319. property GatherBGL: Boolean read FGatherBGL write FGatherBGL;
  320. property NewDetailGclID: Integer read GetNewDetailGclID;
  321. property NewDetailDealID: Integer read GetNewDetailDealID;
  322. property NewDetailBGLID: Integer read GetNewDetailBGLID;
  323. // 在使用汇总模型的数据单元创建数据库写入方法,并赋值,否则汇总数据不写入
  324. property WriteGatherData: TGatherDataWriteEvent read FWriteGatherData write FWriteGatherData;
  325. end;
  326. implementation
  327. uses
  328. ZhAPI, SysUtils, ProjectData, UtilMethods, sdDB, sdIDTree, BGLDm, DB,
  329. Math;
  330. { TGclGatherModel }
  331. procedure TGclGatherModel.AddBillsNode(ANode: TMeasureBillsIDTreeNode);
  332. var
  333. vGclNode: TGclNode;
  334. vDetailGclNode: TDetailGclNode;
  335. vLeafXmj: TLeafXmjNode;
  336. begin
  337. vGclNode := GetGclNode(ANode.Rec);
  338. vDetailGclNode := vGclNode.AddDetailGcl(NewDetailGclID);
  339. vDetailGclNode.BillsID := ANode.ID;
  340. vDetailGclNode.TreeSerialNo := ANode.MajorIndex;
  341. vDetailGclNode.OrgQuantity := ANode.Rec.OrgQuantity.AsFloat;
  342. vDetailGclNode.OrgTotalPrice := ANode.Rec.OrgTotalPrice.AsFloat;
  343. vDetailGclNode.MisQuantity := ANode.Rec.MisQuantity.AsFloat;
  344. vDetailGclNode.MisTotalPrice := ANode.Rec.MisTotalPrice.AsFloat;
  345. vDetailGclNode.OthQuantity := ANode.Rec.OthQuantity.AsFloat;
  346. vDetailGclNode.OthTotalPrice := ANode.Rec.OthTotalPrice.AsFloat;
  347. vDetailGclNode.Quantity := ANode.Rec.Quantity.AsFloat;
  348. vDetailGclNode.TotalPrice := ANode.Rec.TotalPrice.AsFloat;
  349. if Assigned(ANode.StageRec) then
  350. begin
  351. vDetailGclNode.CurDealQuantity := ANode.StageRec.DealQuantity.AsFloat;
  352. vDetailGclNode.CurDealTotalPrice := ANode.StageRec.DealTotalPrice.AsFloat;
  353. vDetailGclNode.CurQcQuantity := ANode.StageRec.QcQuantity.AsFloat;
  354. vDetailGclNode.CurQcTotalPrice := ANode.StageRec.QcTotalPrice.AsFloat;
  355. vDetailGclNode.CurGatherQuantity := ANode.StageRec.GatherQuantity.AsFloat;
  356. vDetailGclNode.CurGatherTotalPrice := ANode.StageRec.GatherTotalPrice.AsFloat;
  357. vDetailGclNode.PreDealQuantity := ANode.StageRec.PreDealQuantity.AsFloat;
  358. vDetailGclNode.PreDealTotalPrice := ANode.StageRec.PreDealTotalPrice.AsFloat;
  359. vDetailGclNode.PreQcQuantity := ANode.StageRec.PreQcQuantity.AsFloat;
  360. vDetailGclNode.PreQcTotalPrice := ANode.StageRec.PreQcTotalPrice.AsFloat;
  361. vDetailGclNode.PreGatherQuantity := ANode.StageRec.PreGatherQuantity.AsFloat;
  362. vDetailGclNode.PreGatherTotalPrice := ANode.StageRec.PreGatherTotalPrice.AsFloat;
  363. vDetailGclNode.EndDealQuantity := ANode.StageRec.EndDealQuantity.AsFloat;
  364. vDetailGclNode.EndDealTotalPrice := ANode.StageRec.EndDealTotalPrice.AsFloat;
  365. vDetailGclNode.EndQcQuantity := ANode.StageRec.EndQcQuantity.AsFloat;
  366. vDetailGclNode.EndQcTotalPrice := ANode.StageRec.EndQcTotalPrice.AsFloat;
  367. vDetailGclNode.EndGatherQuantity := ANode.StageRec.EndGatherQuantity.AsFloat;
  368. vDetailGclNode.EndGatherTotalPrice := ANode.StageRec.EndGatherTotalPrice.AsFloat;
  369. vDetailGclNode.PM_PreTotalPrice := ANode.StageRec.PM_PreTotalPrice.AsFloat;
  370. vDetailGclNode.PM_TotalPrice := ANode.StageRec.PM_TotalPrice.AsFloat;
  371. end;
  372. vDetailGclNode.AddDealQuantity := ANode.Rec.AddDealQuantity.AsFloat;
  373. vDetailGclNode.AddDealTotalPrice := ANode.Rec.AddDealTotalPrice.AsFloat;
  374. vDetailGclNode.AddQcQuantity := ANode.Rec.AddQcQuantity.AsFloat;
  375. vDetailGclNode.AddQcTotalPrice := ANode.Rec.AddQcTotalPrice.AsFloat;
  376. vDetailGclNode.AddGatherQuantity := ANode.Rec.AddGatherQuantity.AsFloat;
  377. vDetailGclNode.AddGatherTotalPrice := ANode.Rec.AddGatherTotalPrice.AsFloat;
  378. vDetailGclNode.LeafXmj := GetLeafXmj(ANode);
  379. vGclNode.AddLeafXmj(vDetailGclNode.LeafXmj);
  380. end;
  381. procedure TGclGatherModel.BeginGather;
  382. begin
  383. FGcls := TList.Create;
  384. FXmjs := TList.Create;
  385. end;
  386. procedure TGclGatherModel.CalculateAll;
  387. var
  388. iGcl: Integer;
  389. begin
  390. for iGcl := 0 to FGcls.Count - 1 do
  391. TGclNode(FGcls.Items[iGcl]).Calculate;
  392. end;
  393. constructor TGclGatherModel.Create(AProjectData: TObject);
  394. begin
  395. FProjectData := AProjectData;
  396. FBillsTree := TProjectData(FProjectData).BillsMeasureData.BillsMeasureTree;
  397. FGatherDeal := False;
  398. FGatherBGL := False;
  399. end;
  400. destructor TGclGatherModel.Destroy;
  401. begin
  402. inherited;
  403. end;
  404. procedure TGclGatherModel.EndGather;
  405. begin
  406. ClearObjects(FXmjs);
  407. FXmjs.Free;
  408. ClearObjects(FGcls);
  409. FGcls.Free;
  410. end;
  411. procedure TGclGatherModel.Execute;
  412. begin
  413. BeginGather;
  414. try
  415. GatherBillsData;
  416. GatherDealData;
  417. GatherBGLData;
  418. CalculateAll;
  419. if Assigned(FWriteGatherData) then
  420. FWriteGatherData(FGcls, FXmjs);
  421. finally
  422. EndGather;
  423. end;
  424. end;
  425. function TGclGatherModel.FindGclNode(const AB_Code, AName, AUnits: string;
  426. APrice: Double): TGclNode;
  427. var
  428. i: Integer;
  429. vGcl: TGclNode;
  430. begin
  431. Result := nil;
  432. for i := 0 to FGcls.Count - 1 do
  433. begin
  434. vGcl := TGclNode(FGcls.Items[i]);
  435. if SameText(vGcl.B_Code, TrimRight(AB_Code)) and
  436. SameText(vGcl.Name, TrimRight(AName)) and
  437. SameText(vGcl.Units, TrimRight(AUnits)) and
  438. (abs(vGcl.Price - APrice) < 0.001) then
  439. begin
  440. Result := vGcl;
  441. Break;
  442. end;
  443. end;
  444. end;
  445. function TGclGatherModel.FindLeafXmj(
  446. ALeafXmj: TBillsIDTreeNode): TLeafXmjNode;
  447. var
  448. iXmj: Integer;
  449. vLeafXmj: TLeafXmjNode;
  450. begin
  451. Result := nil;
  452. for iXmj := 0 to FXmjs.Count - 1 do
  453. begin
  454. vLeafXmj := TLeafXmjNode(FXmjs.Items[iXmj]);
  455. if vLeafXmj.ID = ALeafXmj.ID then
  456. begin
  457. Result := vLeafXmj;
  458. Break;
  459. end;
  460. end;
  461. end;
  462. procedure TGclGatherModel.GatherBGLData;
  463. var
  464. vGclNode: TGclNode;
  465. DetailBGL: TDetailBGLNode;
  466. begin
  467. if not FGatherBGL then Exit;
  468. with TProjectData(FProjectData).BGLData do
  469. begin
  470. cdsBGBills.First;
  471. while not cdsBGBills.Eof do
  472. begin
  473. vGclNode := GetGclNode(cdsBGBillsB_Code.AsString, cdsBGBillsName.AsString,
  474. cdsBGBillsUnits.AsString, cdsBGBillsPrice.AsFloat);
  475. if cdsBGL.FindKey([cdsBGBillsBGID.AsInteger]) then
  476. begin
  477. DetailBGL := vGclNode.AddDetailBGL(NewDetailBGLID);
  478. DetailBGL.BGBillsID := cdsBGBillsID.AsInteger;
  479. DetailBGL.BGLCode := cdsBGLCode.AsString;
  480. DetailBGL.BGLName := cdsBGLName.AsString;
  481. DetailBGL.BGLApprovalCode := cdsBGLApprovalCode.AsString;
  482. DetailBGL.BGLDrawingCode := cdsBGLDrawingCode.AsString;
  483. DetailBGL.BGLID := cdsBGBillsBGID.AsInteger;
  484. DetailBGL.Quantity := cdsBGBillsQuantity.AsFloat;
  485. DetailBGL.TotalPrice := cdsBGBillsTotalPrice.AsFloat;
  486. end;
  487. cdsBGBills.Next;
  488. end;
  489. end;
  490. end;
  491. procedure TGclGatherModel.GatherBillsData;
  492. var
  493. i: Integer;
  494. vNode: TMeasureBillsIDTreeNode;
  495. begin
  496. for i := 0 to FBillsTree.Count - 1 do
  497. begin
  498. vNode := TMeasureBillsIDTreeNode(FBillsTree.Items[i]);
  499. if not vNode.HasChildren and (vNode.Rec.B_Code.AsString <> '') then
  500. AddBillsNode(vNode);
  501. end;
  502. end;
  503. procedure TGclGatherModel.GatherDealData;
  504. var
  505. vGclNode: TGclNode;
  506. vDetailDeal: TDetailDealNode;
  507. iDeal: Integer;
  508. Rec: TsdDataRecord;
  509. begin
  510. if not FGatherDeal then Exit;
  511. with TProjectData(FProjectData).DealBillsData do
  512. for iDeal := 0 to sddDealBills.RecordCount - 1 do
  513. begin
  514. Rec := sddDealBills.Records[iDeal];
  515. vGclNode := GetGclNode(Rec.ValueByName('B_Code').AsString, Rec.ValueByName('Name').AsString,
  516. Rec.ValueByName('Units').AsString, Rec.ValueByName('Price').AsFloat);
  517. vDetailDeal := vGclNode.AddDetailDeal(NewDetailDealID);
  518. vDetailDeal.Quantity := Rec.ValueByName('Quantity').AsFloat;
  519. vDetailDeal.TotalPrice := Rec.ValueByName('TotalPrice').AsFloat;
  520. end;
  521. end;
  522. function TGclGatherModel.GetGclNode(ARec: TBillsRecord): TGclNode;
  523. begin
  524. Result := GetGclNode(ARec.B_Code.AsString, ARec.Name.AsString,
  525. ARec.Units.AsString, ARec.Price.AsFloat);
  526. end;
  527. function TGclGatherModel.GetGclNode(const AB_Code, AName, AUnits: string;
  528. APrice: Double): TGclNode;
  529. begin
  530. Result := FindGclNode(AB_Code, AName, AUnits, APrice);
  531. if not Assigned(Result) then
  532. Result := NewGclNode(AB_Code, AName, AUnits, APrice);
  533. end;
  534. function TGclGatherModel.GetLeafXmj(
  535. ANode: TBillsIDTreeNode): TLeafXmjNode;
  536. function GetFirstXmjParent: TBillsIDTreeNode;
  537. begin
  538. Result := ANode;
  539. while Assigned(Result) and (Result.Rec.B_Code.AsString <> '') do
  540. Result := TBillsIDTreeNode(Result.Parent);
  541. end;
  542. var
  543. vFirstXmjParent: TBillsIDTreeNode;
  544. begin
  545. vFirstXmjParent := GetFirstXmjParent;
  546. Result := nil;
  547. if not Assigned(vFirstXmjParent) then Exit;
  548. Result := FindLeafXmj(vFirstXmjParent);
  549. if not Assigned(Result) then
  550. Result := NewLeafXmj(vFirstXmjParent);
  551. end;
  552. function TGclGatherModel.GetNewDetailBGLID: Integer;
  553. begin
  554. Result := FNewDetailBGLID;
  555. Inc(FNewDetailBGLID)
  556. end;
  557. function TGclGatherModel.GetNewDetailDealID: Integer;
  558. begin
  559. Result := FNewDetailDealID;
  560. Inc(FNewDetailDealID);
  561. end;
  562. function TGclGatherModel.GetNewDetailGclID: Integer;
  563. begin
  564. Result := FNewDetailGclID;
  565. Inc(FNewDetailGclID);
  566. end;
  567. function TGclGatherModel.NewGclNode(const AB_Code, AName, AUnits: string;
  568. APrice: Double): TGclNode;
  569. begin
  570. Result := TGclNode.Create(FNewGclID);
  571. FGcls.Add(Result);
  572. Result.B_Code := TrimRight(AB_Code);
  573. Result.Name := TrimRight(AName);
  574. Result.Units := TrimRight(AUnits);
  575. Result.Price := APrice;
  576. Inc(FNewGclID);
  577. end;
  578. function TGclGatherModel.NewLeafXmj(
  579. ALeafXmj: TBillsIDTreeNode): TLeafXmjNode;
  580. function GetPegNode(ANode: TBillsIDTreeNode): TBillsIDTreeNode;
  581. begin
  582. Result := nil;
  583. if not Assigned(ANode) then Exit;
  584. if CheckPeg(ANode.Rec.Name.AsString) then
  585. Result := ANode
  586. else
  587. Result := GetPegNode(TBillsIDTreeNode(ANode.Parent));
  588. end;
  589. var
  590. vPeg: TBillsIDTreeNode;
  591. begin
  592. vPeg := GetPegNode(ALeafXmj);
  593. Result := TLeafXmjNode.Create(ALeafXmj, vPeg);
  594. FXmjs.Add(Result);
  595. end;
  596. { TGclNode }
  597. function TGclNode.AddDetailBGL(AID: Integer): TDetailBGLNode;
  598. begin
  599. Result := TDetailBGLNode.Create(AID);
  600. FDetailBGLs.Add(Result);
  601. end;
  602. function TGclNode.AddDetailDeal(AID: Integer): TDetailDealNode;
  603. begin
  604. Result := TDetailDealNode.Create(AID);
  605. FDetailDeals.Add(Result);
  606. end;
  607. function TGclNode.AddDetailGcl(AID: Integer): TDetailGclNode;
  608. begin
  609. Result := TDetailGclNode.Create(AID);
  610. FDetailGcls.Add(Result);
  611. end;
  612. procedure TGclNode.AddLeafXmj(ALeafXmj: TLeafXmjNode);
  613. begin
  614. if FLeafXmjs.IndexOf(ALeafXmj) = -1 then
  615. FLeafXmjs.Add(ALeafXmj);
  616. end;
  617. procedure TGclNode.Calculate;
  618. begin
  619. InitCalculate;
  620. GatherDetailGcl;
  621. GatherDetailDeal;
  622. GatherDetailBGL;
  623. CalculateOther;
  624. end;
  625. procedure TGclNode.CalculateOther;
  626. begin
  627. FDeal_BGLQuantity := FQuantity + FBGLQuantity;
  628. FDeal_BGLTotalPrice := FTotalPrice + FBGLTotalPrice;
  629. if FDeal_BGLTotalPrice <> 0 then
  630. FDeal_BGLPercent := CommonRoundTo(FEndGatherTotalPrice/FDeal_BGLTotalPrice*100, -2)
  631. else
  632. FDeal_BGLPercent := 0;
  633. end;
  634. constructor TGclNode.Create(AID: Integer);
  635. begin
  636. FID := AID;
  637. FDetailGcls := TList.Create;
  638. FDetailDeals := TList.Create;
  639. FDetailBGLs := TList.Create;
  640. FLeafXmjs := TList.Create;
  641. end;
  642. destructor TGclNode.Destroy;
  643. begin
  644. FLeafXmjs.Free;
  645. ClearObjects(FDetailBGLs);
  646. FDetailBGLs.Free;
  647. ClearObjects(FDetailDeals);
  648. FDetailDeals.Free;
  649. ClearObjects(FDetailGcls);
  650. FDetailGcls.Free;
  651. inherited;
  652. end;
  653. procedure TGclNode.GatherDetailBGL;
  654. var
  655. iBGL: Integer;
  656. vDetailBGL: TDetailBGLNode;
  657. begin
  658. for iBGL := 0 to DetailBGLCount - 1 do
  659. begin
  660. vDetailBGL := DetailBGL[iBGL];
  661. FBGLQuantity := FBGLQuantity + vDetailBGL.Quantity;
  662. FBGLTotalPrice := FBGLTotalPrice + vDetailBGL.TotalPrice;
  663. end;
  664. end;
  665. procedure TGclNode.GatherDetailDeal;
  666. var
  667. iDeal: Integer;
  668. vDetailDeal: TDetailDealNode;
  669. begin
  670. for iDeal := 0 to DetailDealCount - 1 do
  671. begin
  672. vDetailDeal := DetailDeal[iDeal];
  673. FDealQuantity := FDealQuantity + vDetailDeal.Quantity;
  674. FDealTotalPrice := FDealTotalPrice + vDetailDeal.TotalPrice;
  675. end;
  676. end;
  677. procedure TGclNode.GatherDetailGcl;
  678. var
  679. iGcl: Integer;
  680. vDetailGcl: TDetailGclNode;
  681. begin
  682. for iGcl := 0 to DetailGclCount - 1 do
  683. begin
  684. vDetailGcl := DetailGcl[iGcl];
  685. FOrgQuantity := FOrgQuantity + vDetailGcl.OrgQuantity;
  686. FOrgTotalPrice := FOrgTotalPrice + vDetailGcl.OrgTotalPrice;
  687. FMisQuantity := FMisQuantity + vDetailGcl.MisQuantity;
  688. FMisTotalPrice := FMisTotalPrice + vDetailGcl.MisTotalPrice;
  689. FOthQuantity := FOthQuantity + vDetailGcl.OthQuantity;
  690. FOthTotalPrice := FOthTotalPrice + vDetailGcl.OthTotalPrice;
  691. FQuantity := FQuantity + vDetailGcl.Quantity;
  692. FTotalPrice := FTotalPrice + vDetailGcl.TotalPrice;
  693. FCurDealQuantity := FCurDealQuantity + vDetailGcl.CurDealQuantity;
  694. FCurDealTotalPrice := FCurDealTotalPrice + vDetailGcl.CurDealTotalPrice;
  695. FCurQcQuantity := FCurQcQuantity + vDetailGcl.CurQcQuantity;
  696. FCurQcTotalPrice := FCurQcTotalPrice + vDetailGcl.CurQcTotalPrice;
  697. FCurGatherQuantity := FCurGatherQuantity + vDetailGcl.CurGatherQuantity;
  698. FCurGatherTotalPrice := FCurGatherTotalPrice + vDetailGcl.CurGatherTotalPrice;
  699. FPreDealQuantity := FPreDealQuantity + vDetailGcl.PreDealQuantity;
  700. FPreDealTotalPrice := FPreDealTotalPrice + vDetailGcl.PreDealTotalPrice;
  701. FPreQcQuantity := FPreQcQuantity + vDetailGcl.PreQcQuantity;
  702. FPreQcTotalPrice := FPreQcTotalPrice + vDetailGcl.PreQcTotalPrice;
  703. FPreGatherQuantity := FPreGatherQuantity + vDetailGcl.PreGatherQuantity;
  704. FPreGatherTotalPrice := FPreGatherTotalPrice + vDetailGcl.PreGatherTotalPrice;
  705. FEndDealQuantity := FEndDealQuantity + vDetailGcl.EndDealQuantity;
  706. FEndDealTotalPrice := FEndDealTotalPrice + vDetailGcl.EndDealTotalPrice;
  707. FEndQcQuantity := FEndQcQuantity + vDetailGcl.EndQcQuantity;
  708. FEndQcTotalPrice := FEndQcTotalPrice + vDetailGcl.EndQcTotalPrice;
  709. FEndGatherQuantity := FEndGatherQuantity + vDetailGcl.EndGatherQuantity;
  710. FEndGatherTotalPrice := FEndGatherTotalPrice + vDetailGcl.EndGatherTotalPrice;
  711. FAddDealQuantity := FAddDealQuantity + vDetailGcl.AddDealQuantity;
  712. FAddDealTotalPrice := FAddDealTotalPrice + vDetailGcl.AddDealTotalPrice;
  713. FAddQcQuantity := FAddQcQuantity + vDetailGcl.AddQcQuantity;
  714. FAddQcTotalPrice := FAddQcTotalPrice + vDetailGcl.AddQcTotalPrice;
  715. FAddGatherQuantity := FAddGatherQuantity + vDetailGcl.AddGatherQuantity;
  716. FAddGatherTotalPrice := FAddGatherTotalPrice + vDetailGcl.AddGatherTotalPrice;
  717. end;
  718. end;
  719. function TGclNode.GetDetailBGL(AIndex: Integer): TDetailBGLNode;
  720. begin
  721. Result := TDetailBGLNode(FDetailBGLs.Items[AIndex]);
  722. end;
  723. function TGclNode.GetDetailBGLCount: Integer;
  724. begin
  725. Result := FDetailBGLs.Count;
  726. end;
  727. function TGclNode.GetDetailDeal(AIndex: Integer): TDetailDealNode;
  728. begin
  729. Result := TDetailDealNode(FDetailDeals.Items[AIndex]);
  730. end;
  731. function TGclNode.GetDetailDealCount: Integer;
  732. begin
  733. Result := FDetailDeals.Count;
  734. end;
  735. function TGclNode.GetDetailGcl(AIndex: Integer): TDetailGclNode;
  736. begin
  737. Result := TDetailGclNode(FDetailGcls.Items[AIndex]);
  738. end;
  739. function TGclNode.GetDetailGclCount: Integer;
  740. begin
  741. Result := FDetailGcls.Count;
  742. end;
  743. function TGclNode.GetLeafXmj(AIndex: Integer): TLeafXmjNode;
  744. begin
  745. Result := TLeafXmjNode(FLeafXmjs.Items[AIndex]);
  746. end;
  747. function TGclNode.GetLeafXmjCount: Integer;
  748. begin
  749. Result := FLeafXmjs.Count;
  750. end;
  751. procedure TGclNode.InitCalculate;
  752. begin
  753. FOrgQuantity := 0;
  754. FOrgTotalPrice := 0;
  755. FMisQuantity := 0;
  756. FMisTotalPrice := 0;
  757. FOthQuantity := 0;
  758. FOthTotalPrice := 0;
  759. FQuantity := 0;
  760. FTotalPrice := 0;
  761. FCurDealQuantity := 0;
  762. FCurDealTotalPrice := 0;
  763. FCurQcQuantity := 0;
  764. FCurQcTotalPrice := 0;
  765. FCurGatherQuantity := 0;
  766. FCurGatherTotalPrice := 0;
  767. FPreDealQuantity := 0;
  768. FPreDealTotalPrice := 0;
  769. FPreQcQuantity := 0;
  770. FPreQcTotalPrice := 0;
  771. FPreGatherQuantity := 0;
  772. FPreGatherTotalPrice := 0;
  773. FEndDealQuantity := 0;
  774. FEndDealTotalPrice := 0;
  775. FEndQcQuantity := 0;
  776. FEndQcTotalPrice := 0;
  777. FEndGatherQuantity := 0;
  778. FEndGatherTotalPrice := 0;
  779. FAddDealQuantity := 0;
  780. FAddDealTotalPrice := 0;
  781. FAddQcQuantity := 0;
  782. FAddQcTotalPrice := 0;
  783. FAddGatherQuantity := 0;
  784. FAddGatherTotalPrice := 0;
  785. FDealQuantity := 0;
  786. FDealTotalPrice := 0;
  787. FBGLQuantity := 0;
  788. FBGLTotalPrice := 0;
  789. FDeal_BGLQuantity := 0;
  790. FDeal_BGLTotalPrice := 0;
  791. FDeal_BGLPercent := 0;
  792. end;
  793. procedure TGclNode.SetB_Code(const Value: string);
  794. begin
  795. FB_Code := Value;
  796. FIndexCode := B_CodeToIndexCode(FB_Code);
  797. end;
  798. { TDetailGclNode }
  799. constructor TDetailGclNode.Create(AID: Integer);
  800. begin
  801. FID := AID;
  802. end;
  803. function TDetailGclNode.GetPercent: Double;
  804. var
  805. fTotal: Double;
  806. begin
  807. fTotal := abs(FQuantity + FEndQcQuantity);
  808. if fTotal <> 0 then
  809. Result := CommonRoundTo(abs(FEndGatherQuantity) / fTotal * 100, -2)
  810. else
  811. Result := 0;
  812. end;
  813. { TDetailBGLNode }
  814. constructor TDetailBGLNode.Create(AID: Integer);
  815. begin
  816. FID := AID;
  817. end;
  818. { TDetailDealNode }
  819. constructor TDetailDealNode.Create(AID: Integer);
  820. begin
  821. FID := AID;
  822. end;
  823. { TLeafXmjNode }
  824. constructor TLeafXmjNode.Create(ALeafXmj, APeg: TBillsIDTreeNode);
  825. function GetPegName: string;
  826. begin
  827. if Assigned(APeg) then
  828. Result := APeg.Rec.Name.AsString
  829. else
  830. Result := '';
  831. end;
  832. // 取树结构的第ALevel层节点的名称(level从0开始)
  833. function GetNameByLevel(ANode: TBillsIDTreeNode; ALevel: Integer): string;
  834. begin
  835. Result := '';
  836. if not Assigned(ANode) then Exit;
  837. if ANode.Level = ALevel then
  838. Result := ANode.Rec.Name.AsString
  839. else if ANode.Level > ALevel then
  840. Result := GetNameByLevel(TBillsIDTreeNode(ANode.Parent), ALevel);
  841. end;
  842. function GetNameDanWei(ANode: TBillsIDTreeNode): string;
  843. begin
  844. // 取树结构的第二层节点的名称
  845. Result := GetNameByLevel(ANode, 1);
  846. end;
  847. // ANode为计量单元节点,APegNode为桩号节点
  848. function GetNameFenBu(ANode, APegNode: TBillsIDTreeNode): string;
  849. var
  850. vCurNode: TBillsIDTreeNode;
  851. begin
  852. // 如果计量单元节点的名称为桩号(转化为判断计量单元节点与桩号节点为同一个)
  853. if not Assigned(APegNode) or (ANode.ID = APegNode.ID) then
  854. // 取树结构的第三层节点的名称
  855. Result := GetNameByLevel(ANode, 2)
  856. // 否则,取桩号节点的子节点的名称
  857. else
  858. begin
  859. vCurNode := ANode;
  860. while vCurNode.Level > APegNode.Level + 1 do
  861. vCurNode := TBillsIDTreeNode(vCurNode.Parent);
  862. Result := vCurNode.Rec.Name.AsString;
  863. end;
  864. end;
  865. // ANode为计量单元节点,APegNode为桩号节点
  866. function GetNameFenXiang(ANode, APegNode: TBillsIDTreeNode): string;
  867. var
  868. iTopLevel: Integer;
  869. vCurNode: TBillsIDTreeNode;
  870. begin
  871. if Assigned(APegNode) then
  872. begin
  873. iTopLevel := 3;
  874. if APegNode.ID <> ANode.ID then
  875. iTopLevel := APegNode.Level + 2;
  876. Result := '';
  877. vCurNode := TBillsIDTreeNode(ANode.Parent);
  878. while vCurNode.Level >= iTopLevel do
  879. begin
  880. Result := vCurNode.Rec.Name.AsString + ';' + Result;
  881. vCurNode := TBillsIDTreeNode(vCurNode.Parent);
  882. end;
  883. end
  884. else
  885. Result := GetNameByLevel(ANode, 3);
  886. end;
  887. function GetNameUnit(ANode: TBillsIDTreeNode): string;
  888. begin
  889. Result := ANode.Rec.Name.AsString;
  890. end;
  891. function GetDrawingCode(ANode: TBillsIDTreeNode): string;
  892. begin
  893. Result := '';
  894. if not Assigned(ANode) then Exit;
  895. Result := ANode.Rec.DrawingCode.AsString;
  896. if Result = '' then
  897. Result := GetDrawingCode(TBillsIDTreeNode(ANode.Parent));
  898. end;
  899. function GetPosition(ANode, APegNode: TBillsIDTreeNode): string;
  900. begin
  901. // 如果计量单元节点的名称为桩号(转化为判断计量单元节点与桩号节点为同一个)
  902. if not Assigned(APegNode) or (ANode.ID = APegNode.ID) then
  903. // 取分项工程
  904. Result := GetNameFenXiang(ANode, APegNode)
  905. // 反之,取分项工程+计量单元
  906. else
  907. Result := GetNameFenXiang(ANode, APegNode) + GetNameUnit(ANode);
  908. end;
  909. begin
  910. if not Assigned(ALeafXmj) then Exit;
  911. FID := ALeafXmj.ID;
  912. FXmjCode := ALeafXmj.Rec.Code.AsString;
  913. FXmjName := ALeafXmj.Rec.Name.AsString;
  914. FXmjUnits := ALeafXmj.Rec.Units.AsString;
  915. FPeg := GetPegName;
  916. FNameDanWei := GetNameDanWei(ALeafXmj);
  917. FNameFenBu := GetNameFenBu(ALeafXmj, APeg);
  918. FNameFenXiang := GetNameFenXiang(ALeafXmj, APeg);
  919. FNameUnit := GetNameUnit(ALeafXmj);
  920. FPosition := GetPosition(ALeafXmj, APeg);
  921. FDrawingCode := GetDrawingCode(ALeafXmj);
  922. end;
  923. end.