| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System;
- using System.Collections.Generic;
- using InABox.Integration.V6;
- namespace PRSDesktop.Integrations.V6
- {
- public class V6Profile : V6BOMItem, IV6Profile
- {
- public double Length { get; set; }
- public string Finish { get; set; }
- public override void ValidateQuery(string sql, List<string> errors)
- {
- base.ValidateQuery(sql, errors);
- ValidateField(sql, nameof(Length), errors);
- ValidateField(sql, nameof(Finish), errors);
- }
- public static String SQL = $@"select
- e.extn_code as {nameof(Code)},
- e.descr as {nameof(Description)},
- f.fincol_code as {nameof(Finish)},
- round(coalesce(bb.bar_length, 0.0) * 0.0254, 2) as {nameof(Length)},
- sum(bp.piece_count) as {nameof(Quantity)},
- round(bb.cost * coalesce(bb.bar_length, 0.0),2) as {nameof(Cost)}
- from
- bom_piece bp
- left outer join
- extn e on bp.extn_id = e.extn_id
- left outer join
- quote_item qi on qi.quote_item_id = bp.quote_item_id
- left outer join
- quote q on q.quote_id = qi.quote_id
- left outer join
- (Select bcp.bom_piece_id, MAX(bcp.bom_cutplan_id) as bom_cutplan_id from bom_cutplan_piece bcp group by bcp.bom_piece_id) bcp on bcp.bom_piece_id = bp.bom_piece_id
- left outer join
- bom_bar bb on bb.bom_cutplan_id = bcp.bom_cutplan_id
- left outer join
- fincol f on f.fincol_lib_id = bp.fincol_lib_id and f.fincol_id = bp.fincol_id
- where
- 1 = 1
- and
- bb.bar_length is not null
- group by
- e.extn_code,
- e.descr,
- f.fincol_code,
- bb.bar_length,
- bb.cost";
- }
- }
|