feat:完善项目

This commit is contained in:
henry
2021-11-18 18:28:34 +08:00
parent bcceef741b
commit ba423a2d19
20 changed files with 217 additions and 68 deletions

View File

@ -13,7 +13,7 @@ type ManageEquipmentMaterial struct {
// Materials 器材信息
func (m *ManageEquipmentMaterial) Materials(equipmentID uint64) ([]*ManageMaterialBasic, error) {
db := orm.GetDB().Table(m.TableName()+" AS e").
Select("e.id", "m.code", "m.title", "m.unit", "s.name AS manufacturer_name").
Select("e.id", "e.material_id", "m.code", "m.title", "m.price", "m.unit", "s.name AS manufacturer_name").
Joins(fmt.Sprintf("LEFT JOIN %s AS m ON e.material_id = m.id", model.NewManageMaterial().TableName())).
Joins(fmt.Sprintf("LEFT JOIN %s AS s ON m.manufacturer_id = s.id", model.NewManageSupplier().TableName())).
Where("e.equipment_id = ? AND e.is_deleted = ?", equipmentID, model.DeleteStatusForNot)

View File

@ -17,6 +17,7 @@ type (
Code string `json:"code"`
Title string `json:"title"`
Price float64 `json:"price"`
MaterialID uint64 `json:"material_id"`
ManufacturerName string `json:"manufacturer_name"`
}
ManageMaterialInfo struct {

View File

@ -43,5 +43,5 @@ func (m *ManageMaterialPurchase) Purchases(page, pageSize int, count *int64, whe
}
func NewManageMaterialPurchase() *ManageMaterialPurchase {
return &ManageMaterialPurchase{}
return &ManageMaterialPurchase{model.NewManageMaterialPurchase()}
}

View File

@ -10,15 +10,18 @@ type ManageMaterialSupplier struct {
*model.ManageMaterialSupplier
}
// ManageMaterialSupplierBasic 基本信息
type ManageMaterialSupplierBasic struct {
ID uint64 `json:"id"`
SupplierName string `json:"supplier_name"`
ID uint64 `json:"-"`
Stock float64 `json:"-"`
FrozenStock float64 `json:"-"`
SupplierName string `json:"supplier_name"`
}
// Basic 基本信息
func (m *ManageMaterialSupplier) Basic(where ...*model.ModelWhere) ([]*ManageMaterialSupplierBasic, error) {
db := orm.GetDB().Table(m.TableName()+" m_s").
Select("m_s.id", "s.name AS supplier_name").
Select("m_s.id", "m_s.stock", "m_s.frozen_stock", "s.name AS supplier_name").
Joins(fmt.Sprintf("LEFT JOIN %s AS s ON m_s.supplier_id = s.id", model.NewManageSupplier().TableName())).
Where("m_s.is_deleted = ?", model.DeleteStatusForNot)

View File

@ -7,5 +7,5 @@ type ManageMaterialWarehouse struct {
}
func NewManageMaterialWarehouse() *ManageMaterialWarehouse {
return &ManageMaterialWarehouse{}
return &ManageMaterialWarehouse{model.NewManageMaterialWarehouse()}
}