| | |
| | | dbIn := models.NewOperationDetailsSearch().Orm.Model(&models.OperationDetails{}). |
| | | Joins("left join wms_operation ON wms_operation_details.operation_id=wms_operation.id"). |
| | | Where("wms_operation.base_operation_type=?", constvar.BaseOperationTypeIncoming). |
| | | Where("wms_operation.status=?", constvar.OperationStatus_Ready) |
| | | Where("wms_operation.status in (?)", []int{3, 4}) |
| | | dbOut := models.NewOperationDetailsSearch().Orm.Model(&models.OperationDetails{}). |
| | | Joins("left join wms_operation ON wms_operation_details.operation_id=wms_operation.id"). |
| | | Where("wms_operation.base_operation_type=?", constvar.BaseOperationTypeOutgoing). |
| | | Where("wms_operation.status=?", constvar.OperationStatus_Ready) |
| | | Where("wms_operation.status in (?)", []int{3, 4}) |
| | | if len(locationIds) > 0 { |
| | | dbIn.Where("wms_operation.from_location_id in (?)", locationIds) |
| | | dbIn.Where("wms_operation.to_location_id in (?)", locationIds) |
| | | dbOut.Where("wms_operation.from_location_id in (?)", locationIds) |
| | | } |
| | | err = dbIn.Find(&inHouse).Error |
| | |
| | | resp.ProduceId = material.ID |
| | | resp.ProductName = material.Name |
| | | resp.Cost = material.Cost |
| | | resp.Amount = material.Amount |
| | | resp.Unit = material.Unit |
| | | resp.Value = material.Amount.Mul(material.Cost) |
| | | resp.ProductType = material.CategoryName |
| | |
| | | resp.Out = resp.Out.Add(details.Amount) |
| | | } |
| | | } |
| | | resp.Amount = resp.In.Sub(resp.Out) |
| | | resp.AvailableNumber = resp.Amount |
| | | result = append(result, resp) |
| | | } |
| | |
| | | if params.PageInfo.Check() { |
| | | detailsSearch.SetPage(params.Page, params.PageSize) |
| | | } |
| | | details, total, err := detailsSearch.SetProductId(params.ProduceId).Find() |
| | | details, err := detailsSearch.SetProductId(params.ProduceId).FindNotTotal() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查询操作详情失败") |
| | | return |
| | |
| | | operationIds = append(operationIds, detail.OperationID) |
| | | } |
| | | //获取已完成的操作记录 |
| | | operations, err := models.NewOperationSearch().SetIds(operationIds).SetStatus(constvar.OperationStatus_Finish).FindNotTotal() |
| | | operations, total, err := models.NewOperationSearch().SetIds(operationIds).SetStatus(constvar.OperationStatus_Finish).Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查询操作记录失败") |
| | | return |