mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 15:25:43 +00:00
Feat[BE]: add document handling to stock transfer process
This commit is contained in:
@@ -43,6 +43,14 @@ type SupplierSimpleDTO struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type DocumentDTO struct {
|
||||
Id uint `json:"id"`
|
||||
Path string `json:"path"`
|
||||
Name string `json:"name"`
|
||||
Ext string `json:"ext"`
|
||||
Size float64 `json:"size"`
|
||||
}
|
||||
|
||||
type WarehouseDetailDTO struct {
|
||||
Id uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@@ -57,6 +65,7 @@ type TransferListDTO struct {
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Details []TransferDetailItemDTO `json:"details"`
|
||||
Deliveries []TransferDeliveryDTO `json:"deliveries"`
|
||||
Documents []DocumentDTO `json:"documents"`
|
||||
}
|
||||
|
||||
type TransferDetailDTO struct {
|
||||
@@ -79,7 +88,6 @@ type TransferDeliveryDTO struct {
|
||||
VehiclePlate string `json:"vehicle_plate"`
|
||||
DriverName string `json:"driver_name"`
|
||||
DocumentNumber string `json:"document_number"`
|
||||
DocumentPath string `json:"document_path"`
|
||||
ShippingCostItem float64 `json:"shipping_cost_item"`
|
||||
ShippingCostTotal float64 `json:"shipping_cost_total"`
|
||||
Items []TransferDeliveryItemDTO `json:"items"`
|
||||
@@ -174,6 +182,7 @@ func ToTransferListDTO(e entity.StockTransfer) TransferListDTO {
|
||||
Quantity: item.Quantity,
|
||||
})
|
||||
}
|
||||
|
||||
deliveries = append(deliveries, TransferDeliveryDTO{
|
||||
Id: del.Id,
|
||||
Supplier: SupplierSimpleDTO{
|
||||
@@ -183,12 +192,22 @@ func ToTransferListDTO(e entity.StockTransfer) TransferListDTO {
|
||||
VehiclePlate: del.VehiclePlate,
|
||||
DriverName: del.DriverName,
|
||||
DocumentNumber: del.DocumentNumber,
|
||||
DocumentPath: del.DocumentPath,
|
||||
ShippingCostItem: del.ShippingCostItem,
|
||||
ShippingCostTotal: del.ShippingCostTotal,
|
||||
Items: items,
|
||||
})
|
||||
}
|
||||
var documents []DocumentDTO
|
||||
for _, doc := range e.Documents {
|
||||
documents = append(documents, DocumentDTO{
|
||||
Id: doc.Id,
|
||||
Path: doc.Path,
|
||||
Name: doc.Name,
|
||||
Ext: doc.Ext,
|
||||
Size: doc.Size,
|
||||
})
|
||||
}
|
||||
|
||||
return TransferListDTO{
|
||||
TransferRelationDTO: ToTransferRelationDTO(e),
|
||||
CreatedUser: createdUser,
|
||||
@@ -196,6 +215,7 @@ func ToTransferListDTO(e entity.StockTransfer) TransferListDTO {
|
||||
UpdatedAt: e.UpdatedAt,
|
||||
Details: details,
|
||||
Deliveries: deliveries,
|
||||
Documents: documents,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +252,6 @@ func ToTransferDetailDTO(e entity.StockTransfer) TransferDetailDTO {
|
||||
VehiclePlate: del.VehiclePlate,
|
||||
DriverName: del.DriverName,
|
||||
DocumentNumber: del.DocumentNumber,
|
||||
DocumentPath: del.DocumentPath,
|
||||
ShippingCostItem: del.ShippingCostItem,
|
||||
ShippingCostTotal: del.ShippingCostTotal,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user