| | |
| | | if err != nil { |
| | | return err |
| | | } |
| | | |
| | | autoCode, codeStandard, maxAutoIncr, err := GetAutoCode(constvar.CodeStandardType_Outgoing) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | |
| | | opTypeMap := make(map[int]*models.OperationType, len(opTypes)) |
| | | for _, opType := range opTypes { |
| | | opTypeMap[opType.WarehouseId] = opType |
| | |
| | | } |
| | | operation := &models.Operation{ |
| | | Id: 0, |
| | | Number: "", |
| | | Number: autoCode, |
| | | SourceNumber: output.SourceNumber, |
| | | OperationTypeId: opTypeMap[output.WarehouseID].Id, |
| | | OperationTypeName: opTypeMap[output.WarehouseID].Name, |
| | |
| | | LocationID: output.LocationID, |
| | | } |
| | | operations = append(operations, operation) |
| | | autoCode = models.GetAutoCode(maxAutoIncr, codeStandard) |
| | | maxAutoIncr++ |
| | | } |
| | | |
| | | return models.NewOperationSearch().CreateBatch(operations) |