mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 20:05:41 +00:00
auto allocation and batch managemnt, tracking the train
This commit is contained in:
@@ -10,6 +10,8 @@ import { ServiceType } from "../modules/rule-engine/entities/service-type.entity
|
||||
import { ShippingLine } from "../modules/rule-engine/entities/shipping-line.entity";
|
||||
import { SurchargeType } from "../modules/rule-engine/entities/surcharge-type.entity";
|
||||
import { WeightLimitRule } from "../modules/rule-engine/entities/weight-limit-rule.entity";
|
||||
import { Route } from "../modules/routes/entities/route.entity";
|
||||
import { RouteMilestone } from "../modules/routes/entities/route-milestone.entity";
|
||||
import { Yard } from "../modules/rule-engine/entities/yard.entity";
|
||||
|
||||
const STAFF_USER_ID = "00000000-0000-0000-0000-000000000001";
|
||||
@@ -32,6 +34,7 @@ export class PricingDataSeeder {
|
||||
const rRepo = manager.getRepository(Rate);
|
||||
|
||||
await this.upsertReferenceData(manager, ctRepo, stRepo, yRepo, slRepo);
|
||||
await this.seedDomesticRoute(manager, yRepo);
|
||||
await this.seedWeightLimits(wlRepo, ctRepo);
|
||||
await this.seedPriorityRules(prRepo);
|
||||
const containerTypes = await ctRepo.find();
|
||||
@@ -287,6 +290,40 @@ export class PricingDataSeeder {
|
||||
);
|
||||
}
|
||||
|
||||
private async seedDomesticRoute(manager: any, yRepo: any): Promise<void> {
|
||||
const addis = await yRepo.findOneBy({ code: "ADDIS_ABABA" });
|
||||
const direDawa = await yRepo.findOneBy({ code: "DIRE_DAWA" });
|
||||
if (!addis || !direDawa) return;
|
||||
|
||||
const routeRepo = manager.getRepository(Route);
|
||||
const milestoneRepo = manager.getRepository(RouteMilestone);
|
||||
const routeName = "Addis Ababa → Dire Dawa";
|
||||
let route = await routeRepo.findOneBy({ name: routeName });
|
||||
if (!route) {
|
||||
route = await routeRepo.save(
|
||||
routeRepo.create({
|
||||
name: routeName,
|
||||
originYardId: addis.id,
|
||||
destinationYardId: direDawa.id,
|
||||
isActive: true,
|
||||
}),
|
||||
);
|
||||
await milestoneRepo.save([
|
||||
milestoneRepo.create({
|
||||
routeId: route.id,
|
||||
yardId: addis.id,
|
||||
sequenceNo: 1,
|
||||
}),
|
||||
milestoneRepo.create({
|
||||
routeId: route.id,
|
||||
yardId: direDawa.id,
|
||||
sequenceNo: 2,
|
||||
}),
|
||||
]);
|
||||
this.logger.log("Seeded domestic route Addis Ababa → Dire Dawa");
|
||||
}
|
||||
}
|
||||
|
||||
private async seedWeightLimits(wlRepo: any, ctRepo: any): Promise<void> {
|
||||
await wlRepo.createQueryBuilder().delete().execute();
|
||||
const twenty = await ctRepo.findOneByOrFail({ code: "20FT" });
|
||||
@@ -317,6 +354,18 @@ export class PricingDataSeeder {
|
||||
maxVgmTons: 28,
|
||||
effectiveFrom: base,
|
||||
},
|
||||
{
|
||||
containerTypeId: twenty.id,
|
||||
tradeDirection: "DOMESTIC",
|
||||
maxVgmTons: 26,
|
||||
effectiveFrom: base,
|
||||
},
|
||||
{
|
||||
containerTypeId: forty.id,
|
||||
tradeDirection: "DOMESTIC",
|
||||
maxVgmTons: 28,
|
||||
effectiveFrom: base,
|
||||
},
|
||||
]);
|
||||
this.logger.log("Seeded weight limit rules");
|
||||
}
|
||||
@@ -472,6 +521,20 @@ export class PricingDataSeeder {
|
||||
rateValue: 25000,
|
||||
rateUnit: "PER_CONTAINER",
|
||||
},
|
||||
{
|
||||
rateType: "INTERCITY_BULK",
|
||||
containerTypeId: null,
|
||||
currency: "USD",
|
||||
rateValue: 35,
|
||||
rateUnit: "PER_TON",
|
||||
},
|
||||
{
|
||||
rateType: "INTERCITY_BULK",
|
||||
containerTypeId: null,
|
||||
currency: "ETB",
|
||||
rateValue: 1900,
|
||||
rateUnit: "PER_TON",
|
||||
},
|
||||
{
|
||||
rateType: "BULK_IMPORT",
|
||||
containerTypeId: null,
|
||||
|
||||
Reference in New Issue
Block a user