| | |
| | | //wms_operation_details.amount as adjust_amount,wms_operation.id as operation_id,wms_operation.status |
| | | search.Orm = search.Orm. |
| | | Table("wms_location_product_amount"). |
| | | Select(`wms_location_product_amount.id as location_product_amount_id,wms_location.id as location_id,wms_location.name as location_name, |
| | | Select(`wms_location_product_amount.id as location_product_amount_id,wms_location.id as location_id,wms_location.joint_name as location_name, |
| | | material.id as product_id,material.name as product_name,wms_location_product_amount.amount,material.unit, |
| | | wms_location_product_amount.create_date,material.weight`). |
| | | InnerJoins("inner join material on material.id=wms_location_product_amount.product_id"). |
| | |
| | | } |
| | | records[k].BaseOperationType = constvar.BaseOperationTypeAdjust |
| | | } |
| | | |
| | | productIds = make([]string, 0) |
| | | for _, record := range records { |
| | | productIds = append(productIds, record.ProductId) |
| | | } |
| | | |
| | | products, err := models.NewMaterialSearch().SetIDs(productIds).FindNotTotal() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestError, "查询产品失败") |
| | | return |
| | | } |
| | | |
| | | productMap := models.MaterialMap(products) |
| | | |
| | | for k, v := range records { |
| | | product := productMap[v.ProductId] |
| | | if product == nil { |
| | | continue |
| | | } |
| | | |
| | | moreUnit := product.MoreUnit |
| | | if moreUnit != nil && *moreUnit { |
| | | records[k].AmountMoreUnits = service.CreateMoreUnit(v.Amount, product.MoreUnitList) |
| | | } |
| | | } |
| | | |
| | | util.ResponseFormatListWithPage(c, code.Success, records, int(total), params.Page, params.PageSize) |
| | | } |
| | | |