mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 05:21:57 +00:00
feat(BE): add standard_fcr column to production_standard_details and update related services and validations
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
|||||||
|
-- Remove standard_fcr column from production_standard_details table
|
||||||
|
ALTER TABLE production_standard_details
|
||||||
|
DROP COLUMN IF EXISTS standard_fcr;
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
-- Add standard_fcr column to production_standard_details table
|
||||||
|
ALTER TABLE production_standard_details
|
||||||
|
ADD COLUMN standard_fcr NUMERIC(15, 3);
|
||||||
@@ -891,14 +891,14 @@ func seedProductWarehouse(tx *gorm.DB, createdBy uint) error {
|
|||||||
WarehouseName string
|
WarehouseName string
|
||||||
Quantity float64
|
Quantity float64
|
||||||
}{
|
}{
|
||||||
{ProductName: "DOC Broiler", WarehouseName: "Gudang Priangan", Quantity: 100},
|
{ProductName: "DOC Broiler", WarehouseName: "Gudang Priangan", Quantity: 0},
|
||||||
{ProductName: "281 SPECIAL STARTER", WarehouseName: "Gudang Singaparna", Quantity: 200},
|
{ProductName: "281 SPECIAL STARTER", WarehouseName: "Gudang Singaparna", Quantity: 0},
|
||||||
{ProductName: "281 SPECIAL STARTER", WarehouseName: "Gudang Banten", Quantity: 300},
|
{ProductName: "281 SPECIAL STARTER", WarehouseName: "Gudang Banten", Quantity: 0},
|
||||||
{ProductName: "DOC Broiler", WarehouseName: "Gudang Singaparna 1", Quantity: 5000},
|
{ProductName: "DOC Broiler", WarehouseName: "Gudang Singaparna 1", Quantity: 0},
|
||||||
{ProductName: "Telur Konsumsi Baik", WarehouseName: "Gudang Singaparna 1", Quantity: 600},
|
{ProductName: "Telur Konsumsi Baik", WarehouseName: "Gudang Singaparna 1", Quantity: 0},
|
||||||
{ProductName: "Telur Pecah", WarehouseName: "Gudang Singaparna 1", Quantity: 80},
|
{ProductName: "Telur Pecah", WarehouseName: "Gudang Singaparna 1", Quantity: 0},
|
||||||
{ProductName: "Telur Konsumsi Baik", WarehouseName: "Gudang Cikaum 1", Quantity: 450},
|
{ProductName: "Telur Konsumsi Baik", WarehouseName: "Gudang Cikaum 1", Quantity: 0},
|
||||||
{ProductName: "Telur Pecah", WarehouseName: "Gudang Cikaum 1", Quantity: 60},
|
{ProductName: "Telur Pecah", WarehouseName: "Gudang Cikaum 1", Quantity: 0},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, seed := range seeds {
|
for _, seed := range seeds {
|
||||||
@@ -962,12 +962,24 @@ func seedTransferStock(tx *gorm.DB) error {
|
|||||||
{
|
{
|
||||||
StockTransferId: transfer.Id,
|
StockTransferId: transfer.Id,
|
||||||
ProductId: 1,
|
ProductId: 1,
|
||||||
Quantity: 10,
|
|
||||||
|
SourceProductWarehouseID: func() *uint64 { id := uint64(1); return &id }(),
|
||||||
|
DestProductWarehouseID: func() *uint64 { id := uint64(2); return &id }(),
|
||||||
|
UsageQty: 10,
|
||||||
|
PendingQty: 0,
|
||||||
|
TotalQty: 10,
|
||||||
|
TotalUsed: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
StockTransferId: transfer.Id,
|
StockTransferId: transfer.Id,
|
||||||
ProductId: 2,
|
ProductId: 2,
|
||||||
Quantity: 5,
|
|
||||||
|
SourceProductWarehouseID: func() *uint64 { id := uint64(1); return &id }(),
|
||||||
|
DestProductWarehouseID: func() *uint64 { id := uint64(2); return &id }(),
|
||||||
|
UsageQty: 5,
|
||||||
|
PendingQty: 0,
|
||||||
|
TotalQty: 5,
|
||||||
|
TotalUsed: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for i := range details {
|
for i := range details {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ type ProductionStandardDetail struct {
|
|||||||
TargetHenHouseProduction *float64 `gorm:"type:numeric(15,3)"`
|
TargetHenHouseProduction *float64 `gorm:"type:numeric(15,3)"`
|
||||||
TargetEggWeight *float64 `gorm:"type:numeric(15,3)"`
|
TargetEggWeight *float64 `gorm:"type:numeric(15,3)"`
|
||||||
TargetEggMass *float64 `gorm:"type:numeric(15,3)"`
|
TargetEggMass *float64 `gorm:"type:numeric(15,3)"`
|
||||||
|
StandardFCR *float64 `gorm:"type:numeric(15,3)"`
|
||||||
CreatedAt time.Time `gorm:"type:timestamptz;not null"`
|
CreatedAt time.Time `gorm:"type:timestamptz;not null"`
|
||||||
UpdatedAt time.Time `gorm:"type:timestamptz;not null"`
|
UpdatedAt time.Time `gorm:"type:timestamptz;not null"`
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ type EggProductionStandardDetailDTO struct {
|
|||||||
TargetHenHouseProduction *float64 `json:"target_hen_house_production"`
|
TargetHenHouseProduction *float64 `json:"target_hen_house_production"`
|
||||||
TargetEggWeight *float64 `json:"target_egg_weight"`
|
TargetEggWeight *float64 `json:"target_egg_weight"`
|
||||||
TargetEggMass *float64 `json:"target_egg_mass"`
|
TargetEggMass *float64 `json:"target_egg_mass"`
|
||||||
|
StandardFCR *float64 `json:"standard_fcr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WeeklyProductionStandardDTO struct {
|
type WeeklyProductionStandardDTO struct {
|
||||||
@@ -87,6 +88,7 @@ func ToWeeklyProductionStandardDTOWithDetails(growth entity.StandardGrowthDetail
|
|||||||
TargetHenHouseProduction: detail.TargetHenHouseProduction,
|
TargetHenHouseProduction: detail.TargetHenHouseProduction,
|
||||||
TargetEggWeight: detail.TargetEggWeight,
|
TargetEggWeight: detail.TargetEggWeight,
|
||||||
TargetEggMass: detail.TargetEggMass,
|
TargetEggMass: detail.TargetEggMass,
|
||||||
|
StandardFCR: detail.StandardFCR,
|
||||||
}
|
}
|
||||||
|
|
||||||
return WeeklyProductionStandardDTO{
|
return WeeklyProductionStandardDTO{
|
||||||
@@ -140,6 +142,7 @@ func ToEggProductionStandardDetailDTO(e entity.ProductionStandardDetail) EggProd
|
|||||||
TargetHenHouseProduction: e.TargetHenHouseProduction,
|
TargetHenHouseProduction: e.TargetHenHouseProduction,
|
||||||
TargetEggWeight: e.TargetEggWeight,
|
TargetEggWeight: e.TargetEggWeight,
|
||||||
TargetEggMass: e.TargetEggMass,
|
TargetEggMass: e.TargetEggMass,
|
||||||
|
StandardFCR: e.StandardFCR,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ func (s *productionStandardService) CreateOne(c *fiber.Ctx, req *validation.Crea
|
|||||||
TargetHenHouseProduction: detailReq.ProductionStandardDetails.TargetHenHouseProduction,
|
TargetHenHouseProduction: detailReq.ProductionStandardDetails.TargetHenHouseProduction,
|
||||||
TargetEggWeight: detailReq.ProductionStandardDetails.TargetEggWeight,
|
TargetEggWeight: detailReq.ProductionStandardDetails.TargetEggWeight,
|
||||||
TargetEggMass: detailReq.ProductionStandardDetails.TargetEggMass,
|
TargetEggMass: detailReq.ProductionStandardDetails.TargetEggMass,
|
||||||
|
StandardFCR: detailReq.ProductionStandardDetails.StandardFCR,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := productionStandardDetailRepoTx.CreateOne(c.Context(), productionStandardDetail, nil); err != nil {
|
if err := productionStandardDetailRepoTx.CreateOne(c.Context(), productionStandardDetail, nil); err != nil {
|
||||||
@@ -255,6 +256,7 @@ func (s productionStandardService) UpdateOne(c *fiber.Ctx, req *validation.Updat
|
|||||||
TargetHenHouseProduction: detailReq.ProductionStandardDetails.TargetHenHouseProduction,
|
TargetHenHouseProduction: detailReq.ProductionStandardDetails.TargetHenHouseProduction,
|
||||||
TargetEggWeight: detailReq.ProductionStandardDetails.TargetEggWeight,
|
TargetEggWeight: detailReq.ProductionStandardDetails.TargetEggWeight,
|
||||||
TargetEggMass: detailReq.ProductionStandardDetails.TargetEggMass,
|
TargetEggMass: detailReq.ProductionStandardDetails.TargetEggMass,
|
||||||
|
StandardFCR: detailReq.ProductionStandardDetails.StandardFCR,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := productionStandardDetailRepoTx.CreateOne(c.Context(), productionStandardDetail, nil); err != nil {
|
if err := productionStandardDetailRepoTx.CreateOne(c.Context(), productionStandardDetail, nil); err != nil {
|
||||||
|
|||||||
+1
@@ -5,6 +5,7 @@ type ProductionStandardDetailItem struct {
|
|||||||
TargetHenHouseProduction *float64 `json:"target_hen_house_production" validate:"omitempty,gte=0"`
|
TargetHenHouseProduction *float64 `json:"target_hen_house_production" validate:"omitempty,gte=0"`
|
||||||
TargetEggWeight *float64 `json:"target_egg_weight" validate:"omitempty,gte=0"`
|
TargetEggWeight *float64 `json:"target_egg_weight" validate:"omitempty,gte=0"`
|
||||||
TargetEggMass *float64 `json:"target_egg_mass" validate:"omitempty,gte=0"`
|
TargetEggMass *float64 `json:"target_egg_mass" validate:"omitempty,gte=0"`
|
||||||
|
StandardFCR *float64 `json:"standard_fcr" validate:"omitempty,gte=0"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StandardGrowthDetailItem struct {
|
type StandardGrowthDetailItem struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user