| | |
| | | Joins("left join wms_operation on wms_operation_details.operation_id = wms_operation.id"). |
| | | Where("wms_operation_details.product_id in (?)", productIds). |
| | | Where("wms_operation.from_location_id in (?)", locationIds).Where("wms_operation.status = ?", constvar.OperationStatus_Ready). |
| | | Where("wms_operation.base_operation_type in (?)", []constvar.BaseOperationType{constvar.BaseOperationTypeOutgoing, constvar.BaseOperationTypeInternal}). |
| | | Where("wms_operation.base_operation_type in (?)", []constvar.BaseOperationType{constvar.BaseOperationTypeOutgoing, constvar.BaseOperationTypeInternal, constvar.BaseOperationTypeDisuse}). |
| | | Find(&canUse).Error |
| | | if err != nil { |
| | | return nil, err |
| | |
| | | cu = cu.Add(info.Amount) |
| | | } |
| | | } |
| | | cu = at.Sub(cu) |
| | | p.AvailableNumber = cu.String() |
| | | |
| | | products = append(products, &p) |
| | |
| | | } |
| | | operation.OperationTypeName = operationType.Name |
| | | operation.OperationTypeId = operationType.Id |
| | | location, err := models.NewLocationSearch().SetJointNames([]string{warehouse.Code}).First() |
| | | location, err := models.NewLocationSearch().SetID(warehouse.LocationId).First() |
| | | if err != nil { |
| | | return nil, err |
| | | } |
| | |
| | | } |
| | | operation.ToLocationID = first.Id |
| | | operation.BaseOperationType = constvar.BaseOperationTypeOutgoing |
| | | operation.ReceiverName = req.Addressee |
| | | operation.ReceiverPhone = req.Phone |
| | | operation.ReceiverAddr = req.Address |
| | | operation.Source = req.Source |
| | | if req.DeliverType == 1 { |
| | | for _, product := range req.ProductList { |
| | | var detail models.OperationDetails |