| | |
| | | //查询产品id |
| | | var details []ProductAndLocationInfo |
| | | var productIds []string |
| | | resp := new(GetInventoryProductInfoResponse) |
| | | err := models.NewOperationDetailsSearch().Orm.Model(&models.OperationDetails{}). |
| | | Select("wms_operation_details.product_id,wms_operation_details.amount,wms_operation.from_location_id as location_id"). |
| | | Joins("left join wms_operation on wms_operation.id = wms_operation_details.operation_id"). |
| | | Where("wms_operation.source_number = ?", req.Number).Find(&details).Error |
| | | if err != nil { |
| | | return nil, err |
| | | } |
| | | if len(details) == 0 { |
| | | return resp, nil |
| | | } |
| | | var locationId int |
| | | for _, detail := range details { |
| | |
| | | for _, detail := range details { |
| | | if material.ID == detail.ProductId { |
| | | p.OrderAmount = detail.Amount.String() |
| | | p.Valorem = detail.Amount.Mul(material.SalePrice).String() |
| | | break |
| | | } |
| | | } |
| | |
| | | |
| | | products = append(products, &p) |
| | | } |
| | | resp := new(GetInventoryProductInfoResponse) |
| | | resp.ProductList = products |
| | | return resp, nil |
| | | } |