1、库存调拨明细增加调拨金额字段;
2、采购订单表增加采购金额字段;
This commit is contained in:
parent
7e7a48e008
commit
95c4151f98
|
@ -153,6 +153,7 @@ type ReportAllotDetailData struct {
|
|||
IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码
|
||||
IMEI string `json:"imei"` // 商品串码
|
||||
Remark string `json:"remark"` // 备注
|
||||
AllotAmount float64 `json:"allot_amount"` // 调拨金额
|
||||
}
|
||||
|
||||
// InventoryReportByOtherReq 其他出入库汇总入参
|
||||
|
@ -1166,7 +1167,8 @@ func (m *InventoryReportAllotDetailReq) ReportAllotDetailList(c *gin.Context) (*
|
|||
"erp_inventory_allot_commodity.imei_type, "+
|
||||
"erp_inventory_allot_commodity.imei, "+
|
||||
"erp_inventory_allot_commodity.count, "+
|
||||
"erp_inventory_allot_commodity.remark").
|
||||
"erp_inventory_allot_commodity.remark, "+
|
||||
"erp_inventory_allot_commodity.amount as allot_amount").
|
||||
Joins("JOIN erp_inventory_allot_commodity ON erp_inventory_allot_commodity.allot_order_id = erp_inventory_allot_order.id").
|
||||
Where("erp_inventory_allot_order.state <> ?", ErpInventoryAllotOrderUnAudit) // 排除待审核的订单
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ type ErpPurchaseOrder struct {
|
|||
Commodities []ErpPurchaseCommodity `json:"commodities" gorm:"-"` //
|
||||
InventoryId uint32 `json:"inventory_id" gorm:"-"` // 最近入库人id
|
||||
InventoryName string `json:"inventory_name" gorm:"-"` // 最近入库人名称
|
||||
Amount float64 `json:"amount" gorm:"-"` // 计划采购金额
|
||||
}
|
||||
|
||||
// ErpPurchaseCommodity 采购订单商品表
|
||||
|
@ -93,7 +94,7 @@ type ErpPurchaseCommodity struct {
|
|||
DefaultEmployeePrice float64 `json:"default_employee_price" gorm:"-"` // 默认员工成本价
|
||||
EffectiveCount uint32 `json:"effective_count" gorm:"-"` // 有效数量(该商品实际库存详情处剩余有效数,不包含已出库的数量)
|
||||
ErpCategoryID uint32 `json:"erp_category_id" gorm:"-"` // 商品分类id
|
||||
ErpCategoryName string `json:"erp_category_name" gorm:"-"` // 商品分类名称
|
||||
ErpCategoryName string `json:"erp_category_name" gorm:"-"` // 商品分类名称
|
||||
}
|
||||
|
||||
// ErpPurchaseInventory 采购入库执行信息
|
||||
|
@ -657,12 +658,25 @@ func (m *ErpPurchaseOrderListReq) List(c *gin.Context) (*ErpPurchaseOrderListRes
|
|||
if v.AuditTime != nil && v.AuditTime.IsZero() {
|
||||
orders[i].AuditTime = nil
|
||||
}
|
||||
|
||||
orders[i].Amount, _ = getPurchaseOrderAmount(v.ID)
|
||||
}
|
||||
|
||||
resp.List = orders
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func getPurchaseOrderAmount(purchaseOrderId uint32) (float64, error) {
|
||||
var amount float64
|
||||
err := orm.Eloquent.Table("erp_purchase_commodity").
|
||||
Where("erp_purchase_order_id = ?", purchaseOrderId).
|
||||
Pluck("sum(amount)", &amount).Error
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return amount, nil
|
||||
}
|
||||
|
||||
// newErpPurchaseSn 生成采购订单号
|
||||
func newErpPurchaseSn(purchaseType string) string {
|
||||
var prefix string
|
||||
|
|
Loading…
Reference in New Issue
Block a user